summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-17 22:10:35 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-17 22:32:04 +0200
commit2eafc288d95d750f3a8282ebb503a340cb50a32c (patch)
tree7877d6c20c8cf31121710d0f76c919787f973df3
parentfdef1901054e61e5996c59ac09d9a2646cc76341 (diff)
gui: reload keybindings immediately
Previously the old global keybindings stuck when options dialog got cancelled.
-rw-r--r--gui/main-window.cpp11
-rw-r--r--gui/main-window.hpp1
-rw-r--r--gui/options-dialog.cpp5
-rw-r--r--gui/options-dialog.hpp2
4 files changed, 6 insertions, 13 deletions
diff --git a/gui/main-window.cpp b/gui/main-window.cpp
index b09b70d0..7de95f98 100644
--- a/gui/main-window.cpp
+++ b/gui/main-window.cpp
@@ -374,12 +374,6 @@ void MainWindow::updateButtonState(bool running, bool inertialp)
}
}
-void MainWindow::reload_options()
-{
- if (work)
- work->reload_shortcuts();
-}
-
void MainWindow::startTracker()
{
if (work)
@@ -408,8 +402,7 @@ void MainWindow::startTracker()
save_modules();
work = std::make_shared<Work>(pose, libs, winId());
-
- reload_options();
+ work->reload_shortcuts();
if (pTrackerDialog)
pTrackerDialog->register_tracker(libs.pTracker.get());
@@ -598,7 +591,7 @@ void MainWindow::show_options_dialog()
{
if (mk_window(&options_widget, [&](bool flag) -> void { set_keys_enabled(!flag); }))
{
- connect(options_widget.get(), &OptionsDialog::saving, this, &MainWindow::reload_options);
+ connect(options_widget.get(), &OptionsDialog::closing, this, &MainWindow::register_shortcuts);
options_widget->update_widgets_states(work != nullptr);
}
}
diff --git a/gui/main-window.hpp b/gui/main-window.hpp
index 6923c119..017055eb 100644
--- a/gui/main-window.hpp
+++ b/gui/main-window.hpp
@@ -114,7 +114,6 @@ private slots:
void startTracker();
void stopTracker();
- void reload_options();
void toggle_restore_from_tray(QSystemTrayIcon::ActivationReason e);
diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp
index c6e6dd97..3f051c9f 100644
--- a/gui/options-dialog.cpp
+++ b/gui/options-dialog.cpp
@@ -147,7 +147,7 @@ void OptionsDialog::bind_key(key_opts& kopts, QLabel* label)
d.close();
}
});
- connect(main.b.get(), &options::detail::opt_bundle::reloading, &d, &QDialog::close);
+ connect(main.b.get(), &options::detail::bundle::reloading, &d, &QDialog::close);
pause_keybindings(true);
d.show();
d.exec();
@@ -160,7 +160,7 @@ void OptionsDialog::doOK()
main.b->save();
ui.game_detector->save();
close();
- emit saving();
+ emit closing();
}
void OptionsDialog::doCancel()
@@ -168,6 +168,7 @@ void OptionsDialog::doCancel()
main.b->reload();
ui.game_detector->revert();
close();
+ emit closing();
}
void OptionsDialog::browse_datalogging_file()
diff --git a/gui/options-dialog.hpp b/gui/options-dialog.hpp
index 6854107e..f11513bf 100644
--- a/gui/options-dialog.hpp
+++ b/gui/options-dialog.hpp
@@ -10,7 +10,7 @@ class OptionsDialog : public QWidget
{
Q_OBJECT
signals:
- void saving();
+ void closing();
public:
OptionsDialog(std::function<void(bool)> pause_keybindings);
public slots: