summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-17 09:44:50 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-18 01:53:43 +0200
commitbe0ae02edeaf8c4320c217844b2c7fd507447335 (patch)
treefa634ad70976227fc436dd7dae08b41866f515d8 /facetracknoir
parent6e6a432a701e9a57fe0b03ca835a61f4206f2d5e (diff)
bundles are now reloaded when settings window is closed
This happens even if closed by alt+f4 or cancel button.
Diffstat (limited to 'facetracknoir')
-rw-r--r--facetracknoir/ui.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp
index 88699810..86996735 100644
--- a/facetracknoir/ui.cpp
+++ b/facetracknoir/ui.cpp
@@ -358,12 +358,12 @@ void MainWindow::showHeadPose()
}
template<typename t>
-bool mk_dialog(mem<dylib> lib, mem<t>* orig)
+bool mk_dialog(mem<dylib> lib, mem<t>& orig)
{
- if (*orig && (*orig)->isVisible())
+ if (orig && orig->isVisible())
{
- (*orig)->show();
- (*orig)->raise();
+ orig->show();
+ orig->raise();
return false;
}
@@ -373,10 +373,12 @@ bool mk_dialog(mem<dylib> lib, mem<t>* orig)
dialog->setWindowFlags(Qt::Dialog);
dialog->setFixedSize(dialog->size());
- *orig = dialog;
+ orig = dialog;
dialog->show();
dialog->raise();
+ QObject::connect(dialog.get(), &BaseDialog::closing, [&]() -> void { orig = nullptr; });
+
return true;
}
@@ -385,17 +387,17 @@ bool mk_dialog(mem<dylib> lib, mem<t>* orig)
void MainWindow::showTrackerSettings()
{
- if (mk_dialog(current_tracker(), &pTrackerDialog) && libs.pTracker)
+ if (mk_dialog(current_tracker(), pTrackerDialog) && libs.pTracker)
pTrackerDialog->register_tracker(libs.pTracker.get());
}
void MainWindow::showProtocolSettings() {
- if (mk_dialog(current_protocol(), &pProtocolDialog) && libs.pProtocol)
+ if (mk_dialog(current_protocol(), pProtocolDialog) && libs.pProtocol)
pProtocolDialog->register_protocol(libs.pProtocol.get());
}
void MainWindow::showFilterSettings() {
- if (mk_dialog(current_filter(), &pFilterDialog) && libs.pFilter)
+ if (mk_dialog(current_filter(), pFilterDialog) && libs.pFilter)
pFilterDialog->register_filter(libs.pFilter.get());
}