YODAU 1.0
YEAR OF THE DEPEND ADULT UNDERGARMENT
Loading...
Searching...
No Matches
settings_panel Class Referencefinal

Side panel that exposes stream and line controls to the user. More...

#include <frontend/include/widgets/settings_panel.hpp>

Inheritance diagram for settings_panel:
Collaboration diagram for settings_panel:

Signals

void add_file_stream (const QString &path, const QString &name, bool loop)
 User requested adding a file stream.
void add_local_stream (const QString &source, const QString &name)
 User requested adding a local capture stream.
void add_url_stream (const QString &url, const QString &name)
 User requested adding a URL stream.
void detect_local_sources_requested ()
 User requested re-detection of local sources.
void show_stream_changed (const QString &name, bool show)
 Emitted when a stream's "show in grid" state changes.
void active_stream_selected (const QString &name)
 Emitted when the active stream selection changes.
void active_edit_mode_changed (bool drawing_new)
 Emitted when edit mode changes.
void active_line_params_changed (const QString &name, const QColor &color, bool closed)
 Emitted when any draft-line parameter changes.
void active_line_save_requested (const QString &name, bool closed)
 Emitted when user clicks "add line" in active tab.
void active_line_undo_requested ()
 Emitted when user requests undo of the last draft point.
void active_labels_enabled_changed (bool on)
 Emitted when label visibility toggle changes.
void active_template_selected (const QString &template_name)
 Emitted when template selection changes.
void active_template_color_changed (const QColor &color)
 Emitted when template preview color changes.
void active_template_add_requested (const QString &template_name, const QColor &color)
 Emitted when user adds a template instance to active stream.

Public Member Functions

 settings_panel (QWidget *parent=nullptr)
 Construct the settings panel.
void set_existing_names (QSet< QString > names)
 Replace the set of existing (reserved) names.
void add_existing_name (const QString &name)
 Add one name to the existing-name set.
void remove_existing_name (const QString &name)
 Remove one name from the existing-name set.
void add_stream_entry (const QString &name, const QString &source, bool checked=false) const
 Add a stream row to the streams list.
void set_stream_checked (const QString &name, bool checked) const
 Set the "show" checkbox state for a stream entry.
void remove_stream_entry (const QString &name) const
 Remove a stream entry from the streams list.
void clear_stream_entries ()
 Remove all stream entries and clear name reservations.
void append_event (const QString &text) const
 Append a line to the streams-tab event log.
void set_local_sources (const QStringList &sources) const
 Set detected local sources (e.g., /dev/video*).
void clear_add_inputs () const
 Clear all add-tab input fields and reset validation.
void append_add_log (const QString &text) const
 Append a line to the add-tab log.
void set_active_candidates (const QStringList &names) const
 Set the list of streams that can be selected as active.
void set_active_current (const QString &name) const
 Programmatically select the active stream.
void add_template_candidate (const QString &name) const
 Add one template name as a candidate in the templates combo.
void set_template_candidates (const QStringList &names) const
 Replace the list of template candidates.
void reset_active_line_form ()
 Reset the "new line" form in the active tab.
void reset_active_template_form ()
 Reset the templates form to "none" selection.
void set_active_line_closed (bool closed) const
 Programmatically set active draft "closed" checkbox.
QString active_template_current () const
 Get currently selected template name.
QColor active_template_preview_color () const
 Get current preview color for templates.
void append_active_log (const QString &msg) const
 Append a line to the active-tab log.
void clear_active_log () const
 Clear the active-tab log view.

Private Types

enum class  input_mode { file , local , url }
 Input mode for the add-tab. More...

Private Slots

void on_active_combo_changed (const QString &text)
 Active-stream combo change handler.
void on_active_mode_clicked (int id)
 Edit-mode radio click handler.
void on_active_line_color_clicked ()
 "Choose line color" click handler.
void on_active_line_undo_clicked ()
 "Undo point" click handler.
void on_active_line_save_clicked ()
 "Add line" click handler.
void on_active_line_name_finished ()
 Line name edit finished handler.
void on_active_line_closed_toggled (bool checked)
 Closed-checkbox toggle handler.
void on_active_template_combo_changed (const QString &text)
 Template combo change handler.
void on_active_template_color_clicked ()
 "Choose template color" click handler.
void on_active_template_add_clicked ()
 "Add template" click handler.
void on_stream_item_changed (QTreeWidgetItem *item, int column)
 Streams list item change handler (checkbox column).

Private Member Functions

void build_ui ()
 Build all tabs and root layout.
QWidget * build_add_tab ()
 Build the "add stream" tab.
QWidget * build_streams_tab ()
 Build the "streams" tab.
QWidget * build_active_tab ()
 Build the "active" tab.
QWidget * build_active_stream_box (QWidget *parent)
 Build active-stream selection box.
QWidget * build_edit_mode_box (QWidget *parent)
 Build edit-mode radio group.
QWidget * build_new_line_box (QWidget *parent)
 Build "new line" form box.
QWidget * build_templates_box (QWidget *parent)
 Build templates form box.
void set_mode (input_mode mode)
 Switch add-tab mode and refresh enabled/visible controls.
void update_add_tools () const
 Update visibility/enabled state of add-tab tool boxes.
void update_add_enabled () const
 Update enabled state of the "add" button based on validation.
void on_choose_file ()
 File chooser handler.
void on_add_clicked ()
 "Add" button handler.
void on_refresh_local ()
 "Refresh local sources" handler.
void on_name_changed (QString text) const
 Handler for name edit changes (validation).
QString resolved_name_for_current_input () const
 Resolve the name for the current input (trimmed).
bool name_is_unique (const QString &name) const
 Check if name is not already reserved.
bool current_input_valid () const
 Validate that required input fields for current mode are filled.
void set_name_error (bool error) const
 Apply/remove UI error styling for name edit.
void update_active_tools () const
 Show/hide active-tab tool boxes based on selection/mode.
void set_btn_color (QPushButton *btn, const QColor &c) const
 Paint a QPushButton background to match a chosen color.

Private Attributes

QTabWidget * tabs
 Tab widget hosting add/streams/active tabs.
QSet< QString > existing_names
 Reserved names used for uniqueness checks.
QWidget * add_tab
QLineEdit * name_edit
QButtonGroup * mode_group
QRadioButton * file_radio
QRadioButton * local_radio
QRadioButton * url_radio
input_mode current_mode
QGroupBox * add_file_box = nullptr
QLineEdit * file_path_edit
QPushButton * choose_file_btn
QCheckBox * loop_checkbox
QGroupBox * add_local_box = nullptr
QComboBox * local_sources_combo
QPushButton * refresh_local_btn
QGroupBox * add_url_box = nullptr
QLineEdit * url_edit
QPushButton * add_btn
QPlainTextEdit * add_log_view
QWidget * streams_tab
QTreeWidget * streams_list
QPlainTextEdit * event_log_view
QWidget * active_tab { nullptr }
QComboBox * active_combo { nullptr }
QCheckBox * active_labels_cb = nullptr
QGroupBox * active_mode_box = nullptr
QButtonGroup * active_mode_group { nullptr }
QRadioButton * active_mode_draw_radio { nullptr }
QRadioButton * active_mode_template_radio { nullptr }
QGroupBox * active_line_box { nullptr }
QLineEdit * active_line_name_edit { nullptr }
QCheckBox * active_line_closed_cb { nullptr }
QPushButton * active_line_color_btn { nullptr }
QColor active_line_color { Qt::red }
QPushButton * active_line_undo_btn { nullptr }
QPushButton * active_line_save_btn { nullptr }
QGroupBox * active_templates_box { nullptr }
QComboBox * active_template_combo { nullptr }
QPushButton * active_template_color_btn { nullptr }
QColor active_template_color { Qt::red }
QPushButton * active_template_add_btn { nullptr }
QPlainTextEdit * active_log_view = nullptr

Detailed Description

Side panel that exposes stream and line controls to the user.

The panel itself is a pure UI component:

  • It stores minimal UI state (existing names, active color selections, etc.).
  • It does not access backend directly.
  • It is driven by a controller that listens to signals and calls setters.

Threading:

  • This is a QWidget and must only be used from the Qt GUI thread.

Definition at line 50 of file settings_panel.hpp.

Member Enumeration Documentation

◆ input_mode

enum class settings_panel::input_mode
strongprivate

Input mode for the add-tab.

Enumerator
file 
local 
url 

Definition at line 367 of file settings_panel.hpp.

367{ file, local, url };

Constructor & Destructor Documentation

◆ settings_panel()

settings_panel::settings_panel ( QWidget * parent = nullptr)
explicit

Construct the settings panel.

Builds all UI tabs and initializes default mode to "file".

Parameters
parentOptional parent widget.

Definition at line 22 of file settings_panel.cpp.

23 : QWidget(parent)
24 , tabs(new QTabWidget(this))
25 , add_tab(nullptr)
26 , name_edit(nullptr)
27 , mode_group(new QButtonGroup(this))
28 , file_radio(nullptr)
29 , local_radio(nullptr)
30 , url_radio(nullptr)
32 , file_path_edit(nullptr)
33 , choose_file_btn(nullptr)
34 , loop_checkbox(nullptr)
35 , local_sources_combo(nullptr)
36 , refresh_local_btn(nullptr)
37 , url_edit(nullptr)
38 , add_btn(nullptr)
39 , add_log_view(nullptr)
40 , streams_tab(nullptr)
41 , streams_list(nullptr)
42 , event_log_view(nullptr) {
43
44 build_ui();
47}
QLineEdit * name_edit
QPushButton * choose_file_btn
QRadioButton * url_radio
QPushButton * refresh_local_btn
void update_add_enabled() const
Update enabled state of the "add" button based on validation.
void build_ui()
Build all tabs and root layout.
QPushButton * add_btn
QPlainTextEdit * event_log_view
QPlainTextEdit * add_log_view
QTreeWidget * streams_list
QTabWidget * tabs
Tab widget hosting add/streams/active tabs.
input_mode current_mode
QCheckBox * loop_checkbox
QComboBox * local_sources_combo
QRadioButton * local_radio
void set_mode(input_mode mode)
Switch add-tab mode and refresh enabled/visible controls.
QRadioButton * file_radio
QLineEdit * file_path_edit
QButtonGroup * mode_group
QLineEdit * url_edit

References add_btn, add_log_view, build_ui(), choose_file_btn, current_mode, event_log_view, file, file_path_edit, file_radio, local_radio, local_sources_combo, loop_checkbox, name_edit, refresh_local_btn, set_mode(), streams_list, update_add_enabled(), url_edit, and url_radio.

Referenced by main_window::main_window(), and controller::setup_settings_connections().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ active_edit_mode_changed

void settings_panel::active_edit_mode_changed ( bool drawing_new)
signal

Emitted when edit mode changes.

Parameters
drawing_newtrue for "draw new line", false for "use template".

Referenced by controller::setup_settings_connections().

Here is the caller graph for this function:

◆ active_labels_enabled_changed

void settings_panel::active_labels_enabled_changed ( bool on)
signal

Emitted when label visibility toggle changes.

Parameters
ontrue to enable labels in active view.

Referenced by controller::setup_settings_connections().

Here is the caller graph for this function:

◆ active_line_params_changed

void settings_panel::active_line_params_changed ( const QString & name,
const QColor & color,
bool closed )
signal

Emitted when any draft-line parameter changes.

Parameters
nameDraft/template name (may be empty).
colorDraft color.
closedWhether the draft is closed.

◆ active_line_save_requested

void settings_panel::active_line_save_requested ( const QString & name,
bool closed )
signal

Emitted when user clicks "add line" in active tab.

Parameters
nameDesired line name (may be empty).
closedWhether the line is closed.

◆ active_line_undo_requested

void settings_panel::active_line_undo_requested ( )
signal

Emitted when user requests undo of the last draft point.

Referenced by controller::setup_settings_connections().

Here is the caller graph for this function:

◆ active_stream_selected

void settings_panel::active_stream_selected ( const QString & name)
signal

Emitted when the active stream selection changes.

Empty name indicates "none".

Parameters
nameActive stream name or empty.

◆ active_template_add_requested

void settings_panel::active_template_add_requested ( const QString & template_name,
const QColor & color )
signal

Emitted when user adds a template instance to active stream.

Parameters
template_nameTemplate to add.
colorColor to render that instance with.

◆ active_template_color_changed

void settings_panel::active_template_color_changed ( const QColor & color)
signal

Emitted when template preview color changes.

Parameters
colorNew preview color.

◆ active_template_current()

QString settings_panel::active_template_current ( ) const

Get currently selected template name.

Returns
Template name, trimmed. May be "none" or empty.

Definition at line 294 of file settings_panel.cpp.

294 {
296 return {};
297 }
298 return active_template_combo->currentText().trimmed();
299}
QComboBox * active_template_combo

References active_template_combo.

◆ active_template_preview_color()

QColor settings_panel::active_template_preview_color ( ) const

Get current preview color for templates.

Returns
Preview color.

Definition at line 301 of file settings_panel.cpp.

301 {
303}

◆ active_template_selected

void settings_panel::active_template_selected ( const QString & template_name)
signal

Emitted when template selection changes.

Empty name indicates "none".

Parameters
template_nameSelected template name or empty.

◆ add_existing_name()

void settings_panel::add_existing_name ( const QString & name)

Add one name to the existing-name set.

Parameters
nameName to reserve.

Definition at line 54 of file settings_panel.cpp.

54 {
55 if (name.isEmpty()) {
56 return;
57 }
58 existing_names.insert(name);
60}
QSet< QString > existing_names
Reserved names used for uniqueness checks.
void on_name_changed(QString text) const
Handler for name edit changes (validation).

◆ add_file_stream

void settings_panel::add_file_stream ( const QString & path,
const QString & name,
bool loop )
signal

User requested adding a file stream.

Parameters
pathFile path.
nameDesired stream name (may be empty).
loopWhether to loop playback.

◆ add_local_stream

void settings_panel::add_local_stream ( const QString & source,
const QString & name )
signal

User requested adding a local capture stream.

Parameters
sourceLocal device identifier/path.
nameDesired stream name (may be empty).

◆ add_stream_entry()

void settings_panel::add_stream_entry ( const QString & name,
const QString & source,
bool checked = false ) const

Add a stream row to the streams list.

If the stream already exists in the list, the call is ignored.

Parameters
nameStream name.
sourceHuman-readable source description (type:path/url).
checkedInitial "show in grid" state.

Definition at line 67 of file settings_panel.cpp.

69 {
70 QSignalBlocker blocker(streams_list);
71 for (int i = 0; i < streams_list->topLevelItemCount(); ++i) {
72 const auto item = streams_list->topLevelItem(i);
73 if (item->text(1) == name) {
74 return;
75 }
76 }
77
78 const auto item = new QTreeWidgetItem();
79 item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
80 item->setCheckState(0, checked ? Qt::Checked : Qt::Unchecked);
81 item->setText(1, name);
82 item->setText(2, source);
83 streams_list->addTopLevelItem(item);
84}

References streams_list.

◆ add_template_candidate()

void settings_panel::add_template_candidate ( const QString & name) const

Add one template name as a candidate in the templates combo.

If already present, no change is made.

Parameters
nameTemplate name to add.

Definition at line 197 of file settings_panel.cpp.

197 {
198 if (!active_template_combo || name.isEmpty()) {
199 return;
200 }
201
202 for (int i = 0; i < active_template_combo->count(); ++i) {
203 if (active_template_combo->itemText(i) == name) {
205 return;
206 }
207 }
208
209 active_template_combo->addItem(name);
210
211 if (active_template_combo->count() == 1) {
212 active_template_combo->setCurrentIndex(0);
213 }
214
216}
void update_active_tools() const
Show/hide active-tab tool boxes based on selection/mode.

References active_template_combo, and update_active_tools().

Here is the call graph for this function:

◆ add_url_stream

void settings_panel::add_url_stream ( const QString & url,
const QString & name )
signal

User requested adding a URL stream.

Parameters
urlNetwork URL.
nameDesired stream name (may be empty).

◆ append_active_log()

void settings_panel::append_active_log ( const QString & msg) const

Append a line to the active-tab log.

Prepends the current timestamp automatically.

Parameters
msgLog line.

Definition at line 305 of file settings_panel.cpp.

305 {
306 if (!active_log_view) {
307 return;
308 }
309
310 const auto ts = QDateTime::currentDateTime().toString("HH:mm:ss");
311 active_log_view->appendPlainText(QString("[%1] %2").arg(ts, msg));
312}
QPlainTextEdit * active_log_view

References active_log_view.

◆ append_add_log()

void settings_panel::append_add_log ( const QString & text) const

Append a line to the add-tab log.

Parameters
textLog line.

Definition at line 139 of file settings_panel.cpp.

139 {
140 add_log_view->appendPlainText(text);
141}

References add_log_view.

◆ append_event()

void settings_panel::append_event ( const QString & text) const

Append a line to the streams-tab event log.

Prepends the current timestamp automatically.

Parameters
textLog line.

Definition at line 116 of file settings_panel.cpp.

116 {
117 auto ts = QDateTime::currentDateTime().toString("HH:mm:ss");
118 event_log_view->appendPlainText(QString("[%1] %2").arg(ts, text));
119}

References event_log_view.

◆ build_active_stream_box()

QWidget * settings_panel::build_active_stream_box ( QWidget * parent)
private

Build active-stream selection box.

Definition at line 501 of file settings_panel.cpp.

501 {
502 const auto box = new QGroupBox(str_label("active stream"), parent);
503 const auto box_layout = new QVBoxLayout(box);
504
505 active_combo = new QComboBox(box);
506 active_combo->setEditable(false);
507 active_combo->addItem(str_label("none"), QVariant());
508
509 box_layout->addWidget(active_combo);
510 box->setLayout(box_layout);
511
512 active_labels_cb = new QCheckBox(str_label("labels"), box);
513 active_labels_cb->setChecked(true);
514 box_layout->addWidget(active_labels_cb);
515
516 connect(
517 active_labels_cb, &QCheckBox::toggled, this,
519 );
520
521 connect(
522 active_combo, &QComboBox::currentTextChanged, this,
524 );
525
526 return box;
527}
void active_labels_enabled_changed(bool on)
Emitted when label visibility toggle changes.
QComboBox * active_combo
QCheckBox * active_labels_cb
void on_active_combo_changed(const QString &text)
Active-stream combo change handler.
#define str_label(text)
Create a user-visible localized label.
Definition str_label.hpp:29

References active_combo, and active_labels_cb.

◆ build_active_tab()

QWidget * settings_panel::build_active_tab ( )
private

Build the "active" tab.

Definition at line 479 of file settings_panel.cpp.

479 {
480 const auto w = new QWidget(this);
481 const auto layout = new QVBoxLayout(w);
482 layout->setSpacing(10);
483
484 layout->addWidget(build_active_stream_box(w));
485 layout->addWidget(build_edit_mode_box(w));
486 layout->addWidget(build_new_line_box(w));
487 layout->addWidget(build_templates_box(w));
488
489 active_log_view = new QPlainTextEdit(w);
490 active_log_view->setReadOnly(true);
491 active_log_view->setMinimumHeight(160);
492 active_log_view->setSizePolicy(
493 QSizePolicy::Expanding, QSizePolicy::Expanding
494 );
495 layout->addWidget(active_log_view, 1);
496
497 w->setLayout(layout);
498 return w;
499}
QWidget * build_templates_box(QWidget *parent)
Build templates form box.
QWidget * build_active_stream_box(QWidget *parent)
Build active-stream selection box.
QWidget * build_edit_mode_box(QWidget *parent)
Build edit-mode radio group.
QWidget * build_new_line_box(QWidget *parent)
Build "new line" form box.

References active_log_view.

◆ build_add_tab()

QWidget * settings_panel::build_add_tab ( )
private

Build the "add stream" tab.

Definition at line 336 of file settings_panel.cpp.

336 {
337 const auto w = new QWidget(this);
338 const auto layout = new QVBoxLayout(w);
339 layout->setSpacing(10);
340
341 const auto name_box = new QGroupBox(str_label("name (optional)"), w);
342 const auto name_layout = new QVBoxLayout(name_box);
343 name_edit = new QLineEdit(name_box);
344 name_layout->addWidget(name_edit);
345 name_box->setLayout(name_layout);
346 layout->addWidget(name_box);
347
348 connect(
349 name_edit, &QLineEdit::textChanged, this,
351 );
352
353 const auto mode_box = new QGroupBox(str_label("source"), w);
354 const auto mode_layout = new QHBoxLayout(mode_box);
355 file_radio = new QRadioButton(str_label("file"), mode_box);
356 local_radio = new QRadioButton(str_label("local"), mode_box);
357 url_radio = new QRadioButton(str_label("url"), mode_box);
358
359 mode_group->addButton(file_radio, static_cast<int>(input_mode::file));
360 mode_group->addButton(local_radio, static_cast<int>(input_mode::local));
361 mode_group->addButton(url_radio, static_cast<int>(input_mode::url));
362
363 mode_layout->addWidget(file_radio);
364 mode_layout->addWidget(local_radio);
365 mode_layout->addWidget(url_radio);
366 mode_box->setLayout(mode_layout);
367 layout->addWidget(mode_box);
368
369 connect(mode_group, &QButtonGroup::idClicked, this, [this](int id) {
370 set_mode(static_cast<input_mode>(id));
372 });
373
374 add_file_box = new QGroupBox(str_label("file stream"), w);
375 const auto file_layout = new QVBoxLayout(add_file_box);
376 const auto file_form = new QFormLayout();
377 file_path_edit = new QLineEdit(add_file_box);
378 file_path_edit->setReadOnly(true);
379 loop_checkbox = new QCheckBox(str_label("loop"), add_file_box);
380 loop_checkbox->setChecked(true);
381 file_form->addRow(str_label("path"), file_path_edit);
382 file_form->addRow(QString(), loop_checkbox);
383 file_layout->addLayout(file_form);
384
385 const auto file_btn_row = new QHBoxLayout();
386 choose_file_btn = new QPushButton(str_label("choose file"), add_file_box);
387 file_btn_row->addWidget(choose_file_btn);
388 file_layout->addLayout(file_btn_row);
389
390 add_file_box->setLayout(file_layout);
391 layout->addWidget(add_file_box);
392
393 connect(
394 choose_file_btn, &QPushButton::clicked, this,
396 );
397
398 add_local_box = new QGroupBox(str_label("local sources"), w);
399 const auto local_layout = new QVBoxLayout(add_local_box);
400 local_sources_combo = new QComboBox(add_local_box);
401 local_sources_combo->setEditable(false);
402 local_layout->addWidget(local_sources_combo);
403 refresh_local_btn = new QPushButton(str_label("refresh"), add_local_box);
404 local_layout->addWidget(refresh_local_btn);
405 add_local_box->setLayout(local_layout);
406 layout->addWidget(add_local_box);
407
408 connect(
409 refresh_local_btn, &QPushButton::clicked, this,
411 );
412 connect(
413 local_sources_combo, &QComboBox::currentTextChanged, this,
414 [this]() { update_add_enabled(); }
415 );
416
417 add_url_box = new QGroupBox(str_label("url stream"), w);
418 const auto url_layout = new QVBoxLayout(add_url_box);
419 const auto url_form = new QFormLayout();
420 url_edit = new QLineEdit(add_url_box);
421 url_form->addRow(str_label("url"), url_edit);
422 url_layout->addLayout(url_form);
423 add_url_box->setLayout(url_layout);
424 layout->addWidget(add_url_box);
425
426 connect(url_edit, &QLineEdit::textChanged, this, [this]() {
428 });
429
430 add_btn = new QPushButton(str_label("add"), w);
431 layout->addWidget(add_btn);
432
433 connect(
434 add_btn, &QPushButton::clicked, this, &settings_panel::on_add_clicked
435 );
436
437 add_log_view = new QPlainTextEdit(w);
438 add_log_view->setReadOnly(true);
439 add_log_view->setMinimumHeight(120);
440 layout->addWidget(add_log_view);
441
442 w->setLayout(layout);
445 return w;
446}
void on_add_clicked()
"Add" button handler.
QGroupBox * add_local_box
input_mode
Input mode for the add-tab.
void update_add_tools() const
Update visibility/enabled state of add-tab tool boxes.
QGroupBox * add_url_box
void on_refresh_local()
"Refresh local sources" handler.
QGroupBox * add_file_box
void on_choose_file()
File chooser handler.

References add_btn, add_log_view, choose_file_btn, file, file_path_edit, file_radio, local, local_radio, local_sources_combo, loop_checkbox, mode_group, name_edit, refresh_local_btn, update_add_enabled(), update_add_tools(), url, url_edit, and url_radio.

Here is the call graph for this function:

◆ build_edit_mode_box()

QWidget * settings_panel::build_edit_mode_box ( QWidget * parent)
private

Build edit-mode radio group.

Definition at line 529 of file settings_panel.cpp.

529 {
530 active_mode_box = new QGroupBox(str_label("edit mode"), parent);
531 const auto h = new QHBoxLayout(active_mode_box);
532
533 active_mode_group = new QButtonGroup(active_mode_box);
535 = new QRadioButton(str_label("draw new"), active_mode_box);
537 = new QRadioButton(str_label("use template"), active_mode_box);
538
541
542 active_mode_draw_radio->setChecked(true);
543
544 h->addWidget(active_mode_draw_radio);
545 h->addWidget(active_mode_template_radio);
546 active_mode_box->setLayout(h);
547
548 connect(
549 active_mode_group, &QButtonGroup::idClicked, this,
551 );
552
553 return active_mode_box;
554}
QGroupBox * active_mode_box
void on_active_mode_clicked(int id)
Edit-mode radio click handler.
QRadioButton * active_mode_draw_radio
QButtonGroup * active_mode_group
QRadioButton * active_mode_template_radio

References active_mode_draw_radio, active_mode_group, and active_mode_template_radio.

◆ build_new_line_box()

QWidget * settings_panel::build_new_line_box ( QWidget * parent)
private

Build "new line" form box.

Definition at line 556 of file settings_panel.cpp.

556 {
557 active_line_box = new QGroupBox(str_label("new line"), parent);
558 const auto v = new QVBoxLayout(active_line_box);
559
560 active_line_name_edit = new QLineEdit(active_line_box);
561 active_line_name_edit->setPlaceholderText(
562 str_label("template name (optional)")
563 );
564 v->addWidget(active_line_name_edit);
565
566 active_line_closed_cb = new QCheckBox(str_label("closed"), active_line_box);
567 active_line_closed_cb->setChecked(false);
568 v->addWidget(active_line_closed_cb);
569
571 = new QPushButton(str_label("color"), active_line_box);
573 v->addWidget(active_line_color_btn);
574
576 = new QPushButton(str_label("undo point"), active_line_box);
577 v->addWidget(active_line_undo_btn);
578
579 connect(
580 active_line_undo_btn, &QPushButton::clicked, this,
582 );
583
585 = new QPushButton(str_label("add line"), active_line_box);
586 v->addWidget(active_line_save_btn);
587
588 active_line_box->setLayout(v);
589
590 connect(
591 active_line_color_btn, &QPushButton::clicked, this,
593 );
594
595 connect(
596 active_line_name_edit, &QLineEdit::editingFinished, this,
598 );
599
600 connect(
601 active_line_closed_cb, &QCheckBox::toggled, this,
603 );
604
605 connect(
606 active_line_save_btn, &QPushButton::clicked, this,
608 );
609
611 return active_line_box;
612}
QPushButton * active_line_undo_btn
QLineEdit * active_line_name_edit
void set_btn_color(QPushButton *btn, const QColor &c) const
Paint a QPushButton background to match a chosen color.
void on_active_line_color_clicked()
"Choose line color" click handler.
void on_active_line_closed_toggled(bool checked)
Closed-checkbox toggle handler.
QPushButton * active_line_save_btn
QCheckBox * active_line_closed_cb
void on_active_line_save_clicked()
"Add line" click handler.
QGroupBox * active_line_box
void on_active_line_name_finished()
Line name edit finished handler.
void on_active_line_undo_clicked()
"Undo point" click handler.
QPushButton * active_line_color_btn

References active_line_closed_cb, active_line_color_btn, active_line_name_edit, active_line_save_btn, active_line_undo_btn, and update_active_tools().

Here is the call graph for this function:

◆ build_streams_tab()

QWidget * settings_panel::build_streams_tab ( )
private

Build the "streams" tab.

Definition at line 448 of file settings_panel.cpp.

448 {
449 const auto w = new QWidget(this);
450 const auto layout = new QVBoxLayout(w);
451 layout->setSpacing(10);
452
453 streams_list = new QTreeWidget(w);
454 streams_list->setColumnCount(3);
455 streams_list->setHeaderLabels(
456 { str_label("show"), str_label("name"), str_label("source") }
457 );
458 streams_list->header()->setSectionResizeMode(
459 0, QHeaderView::ResizeToContents
460 );
461 streams_list->header()->setSectionResizeMode(1, QHeaderView::Stretch);
462 streams_list->header()->setSectionResizeMode(2, QHeaderView::Stretch);
463 layout->addWidget(streams_list);
464
465 connect(
466 streams_list, &QTreeWidget::itemChanged, this,
468 );
469
470 event_log_view = new QPlainTextEdit(w);
471 event_log_view->setReadOnly(true);
472 event_log_view->setMinimumHeight(160);
473 layout->addWidget(event_log_view);
474
475 w->setLayout(layout);
476 return w;
477}
void on_stream_item_changed(QTreeWidgetItem *item, int column)
Streams list item change handler (checkbox column).

References event_log_view, and streams_list.

◆ build_templates_box()

QWidget * settings_panel::build_templates_box ( QWidget * parent)
private

Build templates form box.

Definition at line 614 of file settings_panel.cpp.

614 {
615 active_templates_box = new QGroupBox(str_label("templates"), parent);
616 const auto v = new QVBoxLayout(active_templates_box);
617
619 active_template_combo->setEditable(false);
620 active_template_combo->addItem(str_label("none"), QVariant());
621 v->addWidget(active_template_combo);
622
623 connect(
624 active_template_combo, &QComboBox::currentTextChanged, this,
626 );
627
629 = new QPushButton(str_label("color"), active_templates_box);
631 v->addWidget(active_template_color_btn);
632
634 = new QPushButton(str_label("add template"), active_templates_box);
635 v->addWidget(active_template_add_btn);
636
637 active_templates_box->setLayout(v);
638
639 connect(
640 active_template_color_btn, &QPushButton::clicked, this,
642 );
643
644 connect(
645 active_template_add_btn, &QPushButton::clicked, this,
647 );
648
651}
void on_active_template_add_clicked()
"Add template" click handler.
void on_active_template_color_clicked()
"Choose template color" click handler.
QPushButton * active_template_add_btn
void on_active_template_combo_changed(const QString &text)
Template combo change handler.
QPushButton * active_template_color_btn
QGroupBox * active_templates_box

References active_template_add_btn, active_template_color_btn, active_template_combo, and update_active_tools().

Here is the call graph for this function:

◆ build_ui()

void settings_panel::build_ui ( )
private

Build all tabs and root layout.

Definition at line 321 of file settings_panel.cpp.

321 {
322 const auto root_layout = new QVBoxLayout(this);
323 root_layout->setContentsMargins(8, 8, 8, 8);
324 root_layout->addWidget(tabs);
325 // setLayout(root_layout);
326
330
331 tabs->addTab(add_tab, str_label("add stream"));
332 tabs->addTab(streams_tab, str_label("streams"));
333 tabs->addTab(active_tab, str_label("active"));
334}
QWidget * build_streams_tab()
Build the "streams" tab.
QWidget * build_active_tab()
Build the "active" tab.
QWidget * build_add_tab()
Build the "add stream" tab.

References tabs.

Referenced by settings_panel().

Here is the caller graph for this function:

◆ clear_active_log()

void settings_panel::clear_active_log ( ) const

Clear the active-tab log view.

Definition at line 314 of file settings_panel.cpp.

314 {
315 if (!active_log_view) {
316 return;
317 }
318 active_log_view->clear();
319}

References active_log_view.

◆ clear_add_inputs()

void settings_panel::clear_add_inputs ( ) const

Clear all add-tab input fields and reset validation.

Definition at line 130 of file settings_panel.cpp.

130 {
131 name_edit->clear();
132 file_path_edit->clear();
133 url_edit->clear();
134 local_sources_combo->setCurrentIndex(-1);
135 set_name_error(false);
137}
void set_name_error(bool error) const
Apply/remove UI error styling for name edit.

References file_path_edit, local_sources_combo, name_edit, set_name_error(), update_add_enabled(), and url_edit.

Referenced by controller::register_stream_in_ui().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_stream_entries()

void settings_panel::clear_stream_entries ( )

Remove all stream entries and clear name reservations.

Definition at line 110 of file settings_panel.cpp.

110 {
111 streams_list->clear();
112 existing_names.clear();
114}

References streams_list, and update_add_enabled().

Here is the call graph for this function:

◆ current_input_valid()

bool settings_panel::current_input_valid ( ) const
private

Validate that required input fields for current mode are filled.

Definition at line 780 of file settings_panel.cpp.

780 {
781 switch (current_mode) {
782 case input_mode::file: {
783 return !file_path_edit->text().trimmed().isEmpty();
784 }
785 case input_mode::local: {
786 return !local_sources_combo->currentText().trimmed().isEmpty();
787 }
788 case input_mode::url: {
789 return !url_edit->text().trimmed().isEmpty();
790 }
791 }
792 return false;
793}

References current_mode, file, file_path_edit, local, local_sources_combo, url, and url_edit.

Referenced by on_add_clicked(), and update_add_enabled().

Here is the caller graph for this function:

◆ detect_local_sources_requested

void settings_panel::detect_local_sources_requested ( )
signal

User requested re-detection of local sources.

Referenced by main_window::main_window().

Here is the caller graph for this function:

◆ name_is_unique()

bool settings_panel::name_is_unique ( const QString & name) const
private

Check if name is not already reserved.

Definition at line 770 of file settings_panel.cpp.

770 {
771 if (name.isEmpty()) {
772 return true;
773 }
774 if (name.compare(str_label("none"), Qt::CaseInsensitive) == 0) {
775 return false;
776 }
777 return !existing_names.contains(name);
778}

◆ on_active_combo_changed

void settings_panel::on_active_combo_changed ( const QString & text)
privateslot

Active-stream combo change handler.

Definition at line 842 of file settings_panel.cpp.

842 {
843 if (text == str_label("none")) {
844 emit active_stream_selected(QString());
845 } else {
846 emit active_stream_selected(text);
847 }
849}
void active_stream_selected(const QString &name)
Emitted when the active stream selection changes.

References update_active_tools().

Here is the call graph for this function:

◆ on_active_line_closed_toggled

void settings_panel::on_active_line_closed_toggled ( bool checked)
privateslot

Closed-checkbox toggle handler.

Definition at line 891 of file settings_panel.cpp.

891 {
892 Q_UNUSED(checked);
893
895 active_line_name_edit->text().trimmed(), active_line_color,
896 active_line_closed_cb->isChecked()
897 );
898}
void active_line_params_changed(const QString &name, const QColor &color, bool closed)
Emitted when any draft-line parameter changes.

◆ on_active_line_color_clicked

void settings_panel::on_active_line_color_clicked ( )
privateslot

"Choose line color" click handler.

Definition at line 856 of file settings_panel.cpp.

856 {
857 const auto c = QColorDialog::getColor(
858 active_line_color, this, str_label("choose color")
859 );
860 if (!c.isValid()) {
861 return;
862 }
863
866
868 active_line_name_edit->text().trimmed(), active_line_color,
869 active_line_closed_cb->isChecked()
870 );
871}

◆ on_active_line_name_finished

void settings_panel::on_active_line_name_finished ( )
privateslot

Line name edit finished handler.

Definition at line 884 of file settings_panel.cpp.

884 {
886 active_line_name_edit->text().trimmed(), active_line_color,
887 active_line_closed_cb->isChecked()
888 );
889}

◆ on_active_line_save_clicked

void settings_panel::on_active_line_save_clicked ( )
privateslot

"Add line" click handler.

Definition at line 877 of file settings_panel.cpp.

877 {
879 active_line_name_edit->text().trimmed(),
880 active_line_closed_cb->isChecked()
881 );
882}
void active_line_save_requested(const QString &name, bool closed)
Emitted when user clicks "add line" in active tab.

References active_line_closed_cb, and active_line_name_edit.

◆ on_active_line_undo_clicked

void settings_panel::on_active_line_undo_clicked ( )
privateslot

"Undo point" click handler.

Definition at line 873 of file settings_panel.cpp.

873 {
875}
void active_line_undo_requested()
Emitted when user requests undo of the last draft point.

◆ on_active_mode_clicked

void settings_panel::on_active_mode_clicked ( int id)
privateslot

Edit-mode radio click handler.

Definition at line 851 of file settings_panel.cpp.

851 {
852 emit active_edit_mode_changed(id == 0);
854}
void active_edit_mode_changed(bool drawing_new)
Emitted when edit mode changes.

References update_active_tools().

Here is the call graph for this function:

◆ on_active_template_add_clicked

void settings_panel::on_active_template_add_clicked ( )
privateslot

"Add template" click handler.

Definition at line 921 of file settings_panel.cpp.

921 {
923 return;
924 }
925
926 const auto t = active_template_combo->currentText();
927 if (t.isEmpty() || t == str_label("none")) {
928 return;
929 }
930
932}
void active_template_add_requested(const QString &template_name, const QColor &color)
Emitted when user adds a template instance to active stream.

References active_template_combo.

◆ on_active_template_color_clicked

void settings_panel::on_active_template_color_clicked ( )
privateslot

"Choose template color" click handler.

Definition at line 908 of file settings_panel.cpp.

908 {
909 const auto c = QColorDialog::getColor(
910 active_template_color, this, str_label("choose color")
911 );
912 if (!c.isValid()) {
913 return;
914 }
915
919}
void active_template_color_changed(const QColor &color)
Emitted when template preview color changes.

◆ on_active_template_combo_changed

void settings_panel::on_active_template_combo_changed ( const QString & text)
privateslot

Template combo change handler.

Definition at line 900 of file settings_panel.cpp.

900 {
901 if (text.isEmpty() || text == str_label("none")) {
902 emit active_template_selected(QString());
903 } else {
904 emit active_template_selected(text);
905 }
906}
void active_template_selected(const QString &template_name)
Emitted when template selection changes.

◆ on_add_clicked()

void settings_panel::on_add_clicked ( )
private

"Add" button handler.

Definition at line 713 of file settings_panel.cpp.

713 {
714 auto ts = QDateTime::currentDateTime().toString("HH:mm:ss");
715
716 const auto name = resolved_name_for_current_input();
717 if (!name_is_unique(name)) {
718 append_add_log(QString("[%1] error: name already exists").arg(ts));
719 set_name_error(true);
721 return;
722 }
723
724 if (!current_input_valid()) {
725 append_add_log(QString("[%1] error: input is incomplete").arg(ts));
727 return;
728 }
729
730 switch (current_mode) {
731 case input_mode::file: {
732 auto path = file_path_edit->text().trimmed();
733 const auto loop = loop_checkbox->isChecked();
734 append_add_log(QString("[%1] request add file: %2").arg(ts, path));
735 emit add_file_stream(path, name, loop);
736 break;
737 }
738 case input_mode::local: {
739 auto source = local_sources_combo->currentText().trimmed();
740 append_add_log(QString("[%1] request add local: %2").arg(ts, source));
741 emit add_local_stream(source, name);
742 break;
743 }
744 case input_mode::url: {
745 auto url = url_edit->text().trimmed();
746 append_add_log(QString("[%1] request add url: %2").arg(ts, url));
747 emit add_url_stream(url, name);
748 break;
749 }
750 }
751}
bool current_input_valid() const
Validate that required input fields for current mode are filled.
void add_file_stream(const QString &path, const QString &name, bool loop)
User requested adding a file stream.
void add_local_stream(const QString &source, const QString &name)
User requested adding a local capture stream.
void append_add_log(const QString &text) const
Append a line to the add-tab log.
bool name_is_unique(const QString &name) const
Check if name is not already reserved.
QString resolved_name_for_current_input() const
Resolve the name for the current input (trimmed).
void add_url_stream(const QString &url, const QString &name)
User requested adding a URL stream.

References current_input_valid(), current_mode, file, file_path_edit, local, local_sources_combo, loop_checkbox, set_name_error(), update_add_enabled(), url, and url_edit.

Here is the call graph for this function:

◆ on_choose_file()

void settings_panel::on_choose_file ( )
private

File chooser handler.

Definition at line 698 of file settings_panel.cpp.

698 {
699 const auto filters = str_label(
700 "Video files (*.mp4 *.mkv *.avi *.mov *.webm *.m4v);;All files (*)"
701 );
702 auto path = QFileDialog::getOpenFileName(
703 this, str_label("choose video"), QString(), filters
704 );
705 if (!path.isEmpty()) {
706 file_path_edit->setText(path);
707 auto ts = QDateTime::currentDateTime().toString("HH:mm:ss");
708 append_add_log(QString("[%1] file selected: %2").arg(ts, path));
709 }
711}

References file_path_edit, and update_add_enabled().

Here is the call graph for this function:

◆ on_name_changed()

void settings_panel::on_name_changed ( QString text) const
private

Handler for name edit changes (validation).

Definition at line 759 of file settings_panel.cpp.

759 {
760 const auto name = resolved_name_for_current_input();
761 const auto unique = name_is_unique(name);
762 set_name_error(!unique);
764}

References set_name_error(), and update_add_enabled().

Here is the call graph for this function:

◆ on_refresh_local()

void settings_panel::on_refresh_local ( )
private

"Refresh local sources" handler.

Definition at line 753 of file settings_panel.cpp.

753 {
755 const auto ts = QDateTime::currentDateTime().toString("HH:mm:ss");
756 append_add_log(QString("[%1] detect local sources requested").arg(ts));
757}
void detect_local_sources_requested()
User requested re-detection of local sources.

◆ on_stream_item_changed

void settings_panel::on_stream_item_changed ( QTreeWidgetItem * item,
int column )
privateslot

Streams list item change handler (checkbox column).

Definition at line 934 of file settings_panel.cpp.

934 {
935 if (!item) {
936 return;
937 }
938 if (column != 0) {
939 return;
940 }
941
942 const auto name = item->text(1);
943 const bool show = item->checkState(0) == Qt::Checked;
944
945 emit show_stream_changed(name, show);
946
948 QString("show in grid: %1 = %2").arg(name, show ? "true" : "false")
949 );
950}
void show_stream_changed(const QString &name, bool show)
Emitted when a stream's "show in grid" state changes.
void append_event(const QString &text) const
Append a line to the streams-tab event log.

◆ remove_existing_name()

void settings_panel::remove_existing_name ( const QString & name)

Remove one name from the existing-name set.

Parameters
nameName to unreserve.

Definition at line 62 of file settings_panel.cpp.

62 {
63 existing_names.remove(name);
65}

◆ remove_stream_entry()

void settings_panel::remove_stream_entry ( const QString & name) const

Remove a stream entry from the streams list.

Parameters
nameStream name to remove.

Definition at line 100 of file settings_panel.cpp.

100 {
101 for (int i = 0; i < streams_list->topLevelItemCount(); ++i) {
102 const auto item = streams_list->topLevelItem(i);
103 if (item->text(1) == name) {
104 delete streams_list->takeTopLevelItem(i);
105 break;
106 }
107 }
108}

References streams_list.

◆ reset_active_line_form()

void settings_panel::reset_active_line_form ( )

Reset the "new line" form in the active tab.

Clears name, sets closed=false, resets color to red, and emits active_line_params_changed to reflect the reset.

Definition at line 253 of file settings_panel.cpp.

253 {
256 return;
257 }
258
259 active_line_name_edit->clear();
260
261 {
262 QSignalBlocker b(active_line_closed_cb);
263 active_line_closed_cb->setChecked(false);
264 }
265
266 active_line_color = Qt::red;
267 active_line_color_btn->setStyleSheet(
268 QString("background-color: %1;").arg(active_line_color.name())
269 );
270
271 emit active_line_params_changed(QString(), active_line_color, false);
272}

References active_line_closed_cb, active_line_color_btn, and active_line_name_edit.

Referenced by controller::apply_added_line().

Here is the caller graph for this function:

◆ reset_active_template_form()

void settings_panel::reset_active_template_form ( )

Reset the templates form to "none" selection.

Definition at line 274 of file settings_panel.cpp.

274 {
276 return;
277 }
278 const int idx = active_template_combo->findText(str_label("none"));
279 if (idx >= 0) {
280 active_template_combo->setCurrentIndex(idx);
281 } else {
282 active_template_combo->setCurrentIndex(-1);
283 }
284}

References active_template_combo.

Referenced by controller::apply_added_line(), and controller::on_active_template_add_requested().

Here is the caller graph for this function:

◆ resolved_name_for_current_input()

QString settings_panel::resolved_name_for_current_input ( ) const
private

Resolve the name for the current input (trimmed).

Definition at line 766 of file settings_panel.cpp.

766 {
767 return name_edit->text().trimmed();
768}

References name_edit.

◆ set_active_candidates()

void settings_panel::set_active_candidates ( const QStringList & names) const

Set the list of streams that can be selected as active.

Ensures the current selection remains valid if possible, otherwise falls back to "none".

Parameters
namesCandidate active stream names.

Definition at line 143 of file settings_panel.cpp.

143 {
144 if (!active_combo) {
145 return;
146 }
147
148 const QString none_text = str_label("none");
149 const QString current = (active_combo->currentText() == none_text)
150 ? QString()
151 : active_combo->currentText();
152
153 QStringList final_names = names;
154
155 if (!current.isEmpty() && !final_names.contains(current)) {
156 final_names.prepend(current);
157 }
158
159 active_combo->blockSignals(true);
160 active_combo->clear();
161 active_combo->addItem(none_text, QVariant());
162
163 for (const auto& n : final_names) {
164 if (n.isEmpty() || n == none_text) {
165 continue;
166 }
167 active_combo->addItem(n);
168 }
169
170 if (!current.isEmpty() && final_names.contains(current)) {
171 active_combo->setCurrentText(current);
172 } else {
173 active_combo->setCurrentText(none_text);
174 }
175
176 active_combo->blockSignals(false);
178}

References active_combo, and update_active_tools().

Here is the call graph for this function:

◆ set_active_current()

void settings_panel::set_active_current ( const QString & name) const

Programmatically select the active stream.

If name is empty or not among candidates, selects "none".

Parameters
nameStream name to select as active, or empty to clear.

Definition at line 180 of file settings_panel.cpp.

180 {
181 if (!active_combo) {
182 return;
183 }
184
185 active_combo->blockSignals(true);
186 const auto none_text = str_label("none");
187 if (name.isEmpty() || active_combo->findText(name) < 0) {
188 active_combo->setCurrentText(none_text);
189 } else {
190 active_combo->setCurrentText(name);
191 }
192 active_combo->blockSignals(false);
193
195}

References active_combo, and update_active_tools().

Here is the call graph for this function:

◆ set_active_line_closed()

void settings_panel::set_active_line_closed ( bool closed) const

Programmatically set active draft "closed" checkbox.

This does not emit signals.

Parameters
closedNew closed state.

Definition at line 286 of file settings_panel.cpp.

286 {
288 return;
289 }
290 QSignalBlocker b(active_line_closed_cb);
291 active_line_closed_cb->setChecked(closed);
292}

References active_line_closed_cb.

◆ set_btn_color()

void settings_panel::set_btn_color ( QPushButton * btn,
const QColor & c ) const
private

Paint a QPushButton background to match a chosen color.

Definition at line 835 of file settings_panel.cpp.

835 {
836 if (!btn) {
837 return;
838 }
839 btn->setStyleSheet(QString("background-color: %1;").arg(c.name()));
840}

◆ set_existing_names()

void settings_panel::set_existing_names ( QSet< QString > names)

Replace the set of existing (reserved) names.

Used to validate uniqueness of new stream/line/template names.

Parameters
namesSet of names already used by backend/UI.

Definition at line 49 of file settings_panel.cpp.

49 {
50 existing_names = std::move(names);
52}

◆ set_local_sources()

void settings_panel::set_local_sources ( const QStringList & sources) const

Set detected local sources (e.g., /dev/video*).

Updates the local-sources combo box.

Parameters
sourcesList of local source identifiers.

Definition at line 121 of file settings_panel.cpp.

121 {
122 local_sources_combo->clear();
123 local_sources_combo->addItems(sources);
124 if (!sources.isEmpty()) {
125 local_sources_combo->setCurrentIndex(0);
126 }
128}

References local_sources_combo, and update_add_enabled().

Here is the call graph for this function:

◆ set_mode()

void settings_panel::set_mode ( input_mode mode)
private

Switch add-tab mode and refresh enabled/visible controls.

Definition at line 653 of file settings_panel.cpp.

653 {
654 current_mode = mode;
655
656 file_radio->setChecked(mode == input_mode::file);
657 local_radio->setChecked(mode == input_mode::local);
658 url_radio->setChecked(mode == input_mode::url);
659
660 file_path_edit->setEnabled(mode == input_mode::file);
661 choose_file_btn->setEnabled(mode == input_mode::file);
662 loop_checkbox->setEnabled(mode == input_mode::file);
663
664 local_sources_combo->setEnabled(mode == input_mode::local);
665 refresh_local_btn->setEnabled(mode == input_mode::local);
666
667 url_edit->setEnabled(mode == input_mode::url);
670}

References choose_file_btn, current_mode, file, file_path_edit, file_radio, local, local_radio, local_sources_combo, loop_checkbox, refresh_local_btn, update_add_enabled(), update_add_tools(), url, url_edit, and url_radio.

Referenced by settings_panel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_name_error()

void settings_panel::set_name_error ( bool error) const
private

Apply/remove UI error styling for name edit.

Definition at line 795 of file settings_panel.cpp.

795 {
796 if (!error) {
797 name_edit->setStyleSheet(QString());
798 name_edit->setToolTip(QString());
799 return;
800 }
801 name_edit->setStyleSheet("border: 1px solid red;");
802 name_edit->setToolTip(str_label("name is already taken"));
803}

References name_edit.

Referenced by clear_add_inputs(), on_add_clicked(), and on_name_changed().

Here is the caller graph for this function:

◆ set_stream_checked()

void settings_panel::set_stream_checked ( const QString & name,
bool checked ) const

Set the "show" checkbox state for a stream entry.

Parameters
nameStream name.
checkedNew checked state.

Definition at line 86 of file settings_panel.cpp.

88 {
89 // QSignalBlocker blocker(streams_list);
90
91 for (int i = 0; i < streams_list->topLevelItemCount(); ++i) {
92 const auto item = streams_list->topLevelItem(i);
93 if (item->text(1) == name) {
94 item->setCheckState(0, checked ? Qt::Checked : Qt::Unchecked);
95 break;
96 }
97 }
98}

References streams_list.

◆ set_template_candidates()

void settings_panel::set_template_candidates ( const QStringList & names) const

Replace the list of template candidates.

Removes duplicates, inserts a "none" item, and selects it by default.

Parameters
namesTemplate candidate names.

Definition at line 218 of file settings_panel.cpp.

218 {
220 return;
221 }
222
223 const QString none_text = str_label("none");
224
225 active_template_combo->blockSignals(true);
226
227 active_template_combo->clear();
228 active_template_combo->addItem(none_text, QVariant());
229
230 QSet<QString> seen;
231 for (const auto& n : names) {
232 const auto t = n.trimmed();
233 if (t.isEmpty()) {
234 continue;
235 }
236 if (t == none_text) {
237 continue;
238 }
239 if (seen.contains(t)) {
240 continue;
241 }
242 seen.insert(t);
243 active_template_combo->addItem(t);
244 }
245
246 active_template_combo->setCurrentIndex(0);
247
248 active_template_combo->blockSignals(false);
249
251}

References active_template_combo, and update_active_tools().

Here is the call graph for this function:

◆ show_stream_changed

void settings_panel::show_stream_changed ( const QString & name,
bool show )
signal

Emitted when a stream's "show in grid" state changes.

Parameters
nameStream name.
showNew visibility state.

◆ update_active_tools()

void settings_panel::update_active_tools ( ) const
private

Show/hide active-tab tool boxes based on selection/mode.

Definition at line 805 of file settings_panel.cpp.

805 {
806 if (!active_combo) {
807 return;
808 }
809
810 const bool has_active = active_combo->currentText() != str_label("none");
811 const bool drawing_mode
813
814 if (active_mode_box) {
815 active_mode_box->setVisible(has_active);
816 active_mode_box->setEnabled(has_active);
817 }
818
819 if (active_line_box) {
820 const bool show_line = has_active && drawing_mode;
821 active_line_box->setVisible(show_line);
822 active_line_box->setEnabled(show_line);
823 }
824
825 const bool has_templates
827
829 const bool show_tpl = has_active && has_templates && !drawing_mode;
830 active_templates_box->setVisible(show_tpl);
831 active_templates_box->setEnabled(show_tpl);
832 }
833}

References active_combo, active_mode_draw_radio, and active_template_combo.

Referenced by add_template_candidate(), build_new_line_box(), build_templates_box(), on_active_combo_changed(), on_active_mode_clicked(), set_active_candidates(), set_active_current(), and set_template_candidates().

Here is the caller graph for this function:

◆ update_add_enabled()

void settings_panel::update_add_enabled ( ) const
private

Update enabled state of the "add" button based on validation.

Definition at line 691 of file settings_panel.cpp.

691 {
692 const auto name = resolved_name_for_current_input();
693 const auto unique = name_is_unique(name);
694 const auto input_ok = current_input_valid();
695 add_btn->setEnabled(unique && input_ok);
696}

References add_btn, and current_input_valid().

Referenced by build_add_tab(), clear_add_inputs(), clear_stream_entries(), on_add_clicked(), on_choose_file(), on_name_changed(), set_local_sources(), set_mode(), and settings_panel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_add_tools()

void settings_panel::update_add_tools ( ) const
private

Update visibility/enabled state of add-tab tool boxes.

Definition at line 672 of file settings_panel.cpp.

672 {
674 return;
675 }
676
677 const bool file_on = current_mode == input_mode::file;
678 const bool local_on = current_mode == input_mode::local;
679 const bool url_on = current_mode == input_mode::url;
680
681 add_file_box->setVisible(file_on);
682 add_file_box->setEnabled(file_on);
683
684 add_local_box->setVisible(local_on);
685 add_local_box->setEnabled(local_on);
686
687 add_url_box->setVisible(url_on);
688 add_url_box->setEnabled(url_on);
689}

References current_mode, file, local, and url.

Referenced by build_add_tab(), and set_mode().

Here is the caller graph for this function:

Member Data Documentation

◆ active_combo

QComboBox* settings_panel::active_combo { nullptr }
private

◆ active_labels_cb

QCheckBox* settings_panel::active_labels_cb = nullptr
private

Definition at line 489 of file settings_panel.hpp.

Referenced by build_active_stream_box().

◆ active_line_box

QGroupBox* settings_panel::active_line_box { nullptr }
private

Definition at line 496 of file settings_panel.hpp.

496{ nullptr };

◆ active_line_closed_cb

QCheckBox* settings_panel::active_line_closed_cb { nullptr }
private

◆ active_line_color

QColor settings_panel::active_line_color { Qt::red }
private

Definition at line 500 of file settings_panel.hpp.

500{ Qt::red };

◆ active_line_color_btn

QPushButton* settings_panel::active_line_color_btn { nullptr }
private

Definition at line 499 of file settings_panel.hpp.

499{ nullptr };

Referenced by build_new_line_box(), and reset_active_line_form().

◆ active_line_name_edit

QLineEdit* settings_panel::active_line_name_edit { nullptr }
private

Definition at line 497 of file settings_panel.hpp.

497{ nullptr };

Referenced by build_new_line_box(), on_active_line_save_clicked(), and reset_active_line_form().

◆ active_line_save_btn

QPushButton* settings_panel::active_line_save_btn { nullptr }
private

Definition at line 502 of file settings_panel.hpp.

502{ nullptr };

Referenced by build_new_line_box().

◆ active_line_undo_btn

QPushButton* settings_panel::active_line_undo_btn { nullptr }
private

Definition at line 501 of file settings_panel.hpp.

501{ nullptr };

Referenced by build_new_line_box().

◆ active_log_view

QPlainTextEdit* settings_panel::active_log_view = nullptr
private

Definition at line 510 of file settings_panel.hpp.

Referenced by append_active_log(), build_active_tab(), and clear_active_log().

◆ active_mode_box

QGroupBox* settings_panel::active_mode_box = nullptr
private

Definition at line 491 of file settings_panel.hpp.

◆ active_mode_draw_radio

QRadioButton* settings_panel::active_mode_draw_radio { nullptr }
private

Definition at line 493 of file settings_panel.hpp.

493{ nullptr };

Referenced by build_edit_mode_box(), and update_active_tools().

◆ active_mode_group

QButtonGroup* settings_panel::active_mode_group { nullptr }
private

Definition at line 492 of file settings_panel.hpp.

492{ nullptr };

Referenced by build_edit_mode_box().

◆ active_mode_template_radio

QRadioButton* settings_panel::active_mode_template_radio { nullptr }
private

Definition at line 494 of file settings_panel.hpp.

494{ nullptr };

Referenced by build_edit_mode_box().

◆ active_tab

QWidget* settings_panel::active_tab { nullptr }
private

Definition at line 487 of file settings_panel.hpp.

487{ nullptr };

◆ active_template_add_btn

QPushButton* settings_panel::active_template_add_btn { nullptr }
private

Definition at line 508 of file settings_panel.hpp.

508{ nullptr };

Referenced by build_templates_box().

◆ active_template_color

QColor settings_panel::active_template_color { Qt::red }
private

Definition at line 507 of file settings_panel.hpp.

507{ Qt::red };

◆ active_template_color_btn

QPushButton* settings_panel::active_template_color_btn { nullptr }
private

Definition at line 506 of file settings_panel.hpp.

506{ nullptr };

Referenced by build_templates_box().

◆ active_template_combo

QComboBox* settings_panel::active_template_combo { nullptr }
private

◆ active_templates_box

QGroupBox* settings_panel::active_templates_box { nullptr }
private

Definition at line 504 of file settings_panel.hpp.

504{ nullptr };

◆ add_btn

QPushButton* settings_panel::add_btn
private

Definition at line 478 of file settings_panel.hpp.

Referenced by build_add_tab(), settings_panel(), and update_add_enabled().

◆ add_file_box

QGroupBox* settings_panel::add_file_box = nullptr
private

Definition at line 466 of file settings_panel.hpp.

◆ add_local_box

QGroupBox* settings_panel::add_local_box = nullptr
private

Definition at line 471 of file settings_panel.hpp.

◆ add_log_view

QPlainTextEdit* settings_panel::add_log_view
private

Definition at line 479 of file settings_panel.hpp.

Referenced by append_add_log(), build_add_tab(), and settings_panel().

◆ add_tab

QWidget* settings_panel::add_tab
private

Definition at line 457 of file settings_panel.hpp.

◆ add_url_box

QGroupBox* settings_panel::add_url_box = nullptr
private

Definition at line 475 of file settings_panel.hpp.

◆ choose_file_btn

QPushButton* settings_panel::choose_file_btn
private

Definition at line 468 of file settings_panel.hpp.

Referenced by build_add_tab(), set_mode(), and settings_panel().

◆ current_mode

input_mode settings_panel::current_mode
private

◆ event_log_view

QPlainTextEdit* settings_panel::event_log_view
private

Definition at line 484 of file settings_panel.hpp.

Referenced by append_event(), build_streams_tab(), and settings_panel().

◆ existing_names

QSet<QString> settings_panel::existing_names
private

Reserved names used for uniqueness checks.

Definition at line 454 of file settings_panel.hpp.

◆ file_path_edit

QLineEdit* settings_panel::file_path_edit
private

◆ file_radio

QRadioButton* settings_panel::file_radio
private

Definition at line 461 of file settings_panel.hpp.

Referenced by build_add_tab(), set_mode(), and settings_panel().

◆ local_radio

QRadioButton* settings_panel::local_radio
private

Definition at line 462 of file settings_panel.hpp.

Referenced by build_add_tab(), set_mode(), and settings_panel().

◆ local_sources_combo

QComboBox* settings_panel::local_sources_combo
private

◆ loop_checkbox

QCheckBox* settings_panel::loop_checkbox
private

Definition at line 469 of file settings_panel.hpp.

Referenced by build_add_tab(), on_add_clicked(), set_mode(), and settings_panel().

◆ mode_group

QButtonGroup* settings_panel::mode_group
private

Definition at line 460 of file settings_panel.hpp.

Referenced by build_add_tab().

◆ name_edit

QLineEdit* settings_panel::name_edit
private

◆ refresh_local_btn

QPushButton* settings_panel::refresh_local_btn
private

Definition at line 473 of file settings_panel.hpp.

Referenced by build_add_tab(), set_mode(), and settings_panel().

◆ streams_list

QTreeWidget* settings_panel::streams_list
private

◆ streams_tab

QWidget* settings_panel::streams_tab
private

Definition at line 482 of file settings_panel.hpp.

◆ tabs

QTabWidget* settings_panel::tabs
private

Tab widget hosting add/streams/active tabs.

Definition at line 452 of file settings_panel.hpp.

Referenced by build_ui().

◆ url_edit

QLineEdit* settings_panel::url_edit
private

◆ url_radio

QRadioButton* settings_panel::url_radio
private

Definition at line 463 of file settings_panel.hpp.

Referenced by build_add_tab(), set_mode(), and settings_panel().


The documentation for this class was generated from the following files: