diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-06-07 07:40:35 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-06-07 08:09:44 +0200 |
commit | 6bd4fbe269bf0b0629daff1093372e0537b24186 (patch) | |
tree | bdf6f120fff3938fa232a9ed68cb194a69fd5dd2 /facetracknoir/ui.cpp | |
parent | 71856701c8bedad3d992cb63620e695df8727812 (diff) |
ui: if dialog window exists, raise it, don't destroy and recreate
Diffstat (limited to 'facetracknoir/ui.cpp')
-rw-r--r-- | facetracknoir/ui.cpp | 64 |
1 files changed, 48 insertions, 16 deletions
diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp index 2df7b99c..284367ce 100644 --- a/facetracknoir/ui.cpp +++ b/facetracknoir/ui.cpp @@ -352,50 +352,82 @@ mem<t> mk_dialog(mem<dylib> lib) void MainWindow::showTrackerSettings() { - auto dialog = mk_dialog<ITrackerDialog>(current_tracker()); - - if (dialog) { + if (pTrackerDialog && pTrackerDialog->isVisible()) + { + pTrackerDialog->show(); + pTrackerDialog->raise(); + } + else + { + auto dialog = mk_dialog<ITrackerDialog>(current_tracker()); pTrackerDialog = dialog; if (libs.pTracker != nullptr) dialog->register_tracker(libs.pTracker.get()); dialog->show(); + dialog->raise(); } } void MainWindow::showProtocolSettings() { - auto dialog = mk_dialog<IProtocolDialog>(current_protocol()); - - if (dialog) { + if (pProtocolDialog && pProtocolDialog->isVisible()) + { + pProtocolDialog->show(); + pProtocolDialog->raise(); + } else + { + auto dialog = mk_dialog<IProtocolDialog>(current_protocol()); pProtocolDialog = dialog; if (libs.pProtocol != nullptr) dialog->register_protocol(libs.pProtocol.get()); dialog->show(); + dialog->raise(); } } void MainWindow::showFilterSettings() { - auto dialog = mk_dialog<IFilterDialog>(current_filter()); - - if (dialog) + if (pFilterDialog && pFilterDialog->isVisible()) + { + pFilterDialog->show(); + pFilterDialog->raise(); + } else { + auto dialog = mk_dialog<IFilterDialog>(current_filter()); pFilterDialog = dialog; if (libs.pFilter != nullptr) dialog->register_filter(libs.pFilter.get()); dialog->show(); + dialog->raise(); } } void MainWindow::showKeyboardShortcuts() { - shortcuts_widget = std::make_shared<OptionsDialog>(); - shortcuts_widget->setWindowFlags(Qt::Dialog); - connect(shortcuts_widget.get(), SIGNAL(reload()), this, SLOT(bindKeyboardShortcuts())); - shortcuts_widget->show(); + if (shortcuts_widget && shortcuts_widget->isVisible()) + { + shortcuts_widget->show(); + shortcuts_widget->raise(); + } + else + { + shortcuts_widget = std::make_shared<OptionsDialog>(); + shortcuts_widget->setWindowFlags(Qt::Dialog); + connect(shortcuts_widget.get(), SIGNAL(reload()), this, SLOT(bindKeyboardShortcuts())); + shortcuts_widget->show(); + shortcuts_widget->raise(); + } } void MainWindow::showCurveConfiguration() { - mapping_widget = std::make_shared<MapWidget>(pose, s); - mapping_widget->setWindowFlags(Qt::Dialog); - mapping_widget->show(); + if (mapping_widget && mapping_widget->isVisible()) + { + mapping_widget->show(); + mapping_widget->raise(); + } + else + { + mapping_widget = std::make_shared<MapWidget>(pose, s); + mapping_widget->setWindowFlags(Qt::Dialog); + mapping_widget->show(); + } } void MainWindow::exit() { |