summaryrefslogtreecommitdiffhomepage
path: root/opentrack
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-12-16 13:04:49 +0100
committerStanislaw Halik <sthalik@misaki.pl>2021-12-16 15:32:04 +0100
commit69555ddc87fe727d59385e1752d3ba66aa5549ee (patch)
treedd711aa12ae9a2255cb62674f1109115938aa58e /opentrack
parent8a0ce309c485e47a09e2fbc918d9653dc42c7fb2 (diff)
api, gui, opentrack: allow embedding proto, filter dialogs
Diffstat (limited to 'opentrack')
-rw-r--r--opentrack/main-window.cpp40
1 files changed, 25 insertions, 15 deletions
diff --git a/opentrack/main-window.cpp b/opentrack/main-window.cpp
index d16e7854..f68e1c25 100644
--- a/opentrack/main-window.cpp
+++ b/opentrack/main-window.cpp
@@ -89,10 +89,10 @@ void main_window::init_dylibs()
this, [this](const QString&) { pTrackerDialog = nullptr; if (options_widget) options_widget->tracker_module_changed(); });
connect(ui.iconcomboProtocol, &QComboBox::currentTextChanged,
- this, [this](const QString&) { pProtocolDialog = nullptr; });
+ this, [this](const QString&) { pProtocolDialog = nullptr; if (options_widget) options_widget->proto_module_changed(); });
connect(ui.iconcomboFilter, &QComboBox::currentTextChanged,
- this, [this](const QString&) { pFilterDialog = nullptr; });
+ this, [this](const QString&) { pFilterDialog = nullptr; if (options_widget) options_widget->filter_module_changed(); });
connect(&m.tracker_dll, value_::value_changed<QString>(),
this, &main_window::save_modules,
@@ -409,24 +409,22 @@ void main_window::start_tracker_()
}
if (pTrackerDialog)
- {
- auto* tracker = &*work->libs.pTracker;
- pTrackerDialog->register_tracker(tracker);
- }
-
- if (options_widget)
- {
- // XXX TODO other module types
- auto* tracker = &*work->libs.pTracker;
- options_widget->register_tracker(tracker);
- }
+ pTrackerDialog->register_tracker(&*work->libs.pTracker);
- if (pFilterDialog)
+ if (pFilterDialog && work->libs.pFilter)
pFilterDialog->register_filter(&*work->libs.pFilter);
if (pProtocolDialog)
pProtocolDialog->register_protocol(&*work->libs.pProtocol);
+ if (options_widget)
+ {
+ options_widget->register_tracker(&*work->libs.pTracker);
+ options_widget->register_protocol(&*work->libs.pProtocol);
+ if (work->libs.pFilter)
+ options_widget->register_filter(&*work->libs.pFilter);
+ }
+
pose_update_timer.start(15);
// NB check valid since SelectedLibraries ctor called
@@ -619,6 +617,11 @@ void main_window::show_proto_settings_(bool show)
QObject::connect(&*pProtocolDialog, &IProtocolDialog::closing,
this, [this] { pProtocolDialog = nullptr; });
}
+ else if (show && pFilterDialog && pProtocolDialog->embeddable())
+ {
+ show_options_dialog();
+ options_widget->switch_to_proto_tab();
+ }
}
void main_window::show_filter_settings_(bool show)
@@ -629,6 +632,11 @@ void main_window::show_filter_settings_(bool show)
QObject::connect(&*pFilterDialog, &IFilterDialog::closing,
this, [this] { pFilterDialog = nullptr; });
}
+ else if (show && pFilterDialog && pFilterDialog->embeddable())
+ {
+ show_options_dialog();
+ options_widget->switch_to_filter_tab();
+ }
}
void main_window::show_options_dialog()
@@ -637,8 +645,10 @@ void main_window::show_options_dialog()
return;
show_tracker_settings_(false);
+ show_proto_settings_(false);
+ show_filter_settings_(false);
- if (mk_window(options_widget, true, pTrackerDialog,
+ if (mk_window(options_widget, true, pTrackerDialog, pProtocolDialog, pFilterDialog,
[this](bool flag) { set_keys_enabled(!flag); }))
{
// move shortcuts to a separate bundle and add a migration -sh 20180218