diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-06-29 10:09:42 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-06-29 13:18:22 +0200 |
commit | 87622615e5adc5b96f404b3255aa6af5a90043ee (patch) | |
tree | 9231116ead1dd109b2700422b1ca640a9a3dbed9 | |
parent | 68e5a04f438fafd984ac0bf0424fa75294a8dc06 (diff) |
gui/options: fix cancel button
The "struct opts" dtor doesn't run at dialog close time so invoke
"reload" on the bundle explicitly.
-rw-r--r-- | gui/options-dialog.cpp | 8 | ||||
-rw-r--r-- | gui/options-dialog.hpp | 4 | ||||
-rw-r--r-- | gui/ui.cpp | 2 | ||||
-rw-r--r-- | opentrack-logic/main-settings.hpp | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp index 49df4309..212c6078 100644 --- a/gui/options-dialog.cpp +++ b/gui/options-dialog.cpp @@ -29,9 +29,7 @@ static QString kopts_to_string(const key_opts& kopts) return kopts.keycode; } -OptionsDialog::OptionsDialog(main_settings& main, - std::function<void(bool)> pause_keybindings) : - main(main), +OptionsDialog::OptionsDialog(std::function<void(bool)> pause_keybindings) : pause_keybindings(pause_keybindings) { ui.setupUi(this); @@ -133,7 +131,8 @@ void OptionsDialog::bind_key(key_opts& kopts, QLabel* label) delete l; } -void OptionsDialog::doOK() { +void OptionsDialog::doOK() +{ main.b->save(); ui.game_detector->save(); close(); @@ -142,6 +141,7 @@ void OptionsDialog::doOK() { void OptionsDialog::doCancel() { + main.b->reload(); ui.game_detector->revert(); close(); } diff --git a/gui/options-dialog.hpp b/gui/options-dialog.hpp index eee9d090..6b04aa09 100644 --- a/gui/options-dialog.hpp +++ b/gui/options-dialog.hpp @@ -12,9 +12,9 @@ class OptionsDialog: public QWidget signals: void reload(); public: - OptionsDialog(main_settings& main, std::function<void(bool)> pause_keybindings); + OptionsDialog(std::function<void(bool)> pause_keybindings); private: - main_settings& main; + main_settings main; std::function<void(bool)> pause_keybindings; Ui::UI_Settings ui; void closeEvent(QCloseEvent *) override { doCancel(); } @@ -492,7 +492,7 @@ bool mk_window(mem<t>* place, Args&&... params) void MainWindow::show_options_dialog() { - if (mk_window(&options_widget, s, [&](bool flag) -> void { set_keys_enabled(!flag); })) + if (mk_window(&options_widget, [&](bool flag) -> void { set_keys_enabled(!flag); })) { connect(options_widget.get(), SIGNAL(reload()), this, SLOT(reload_options())); } diff --git a/opentrack-logic/main-settings.hpp b/opentrack-logic/main-settings.hpp index 16ff59e4..34997ea0 100644 --- a/opentrack-logic/main-settings.hpp +++ b/opentrack-logic/main-settings.hpp @@ -47,7 +47,7 @@ struct key_opts {} }; -struct main_settings : opts +struct main_settings { value<QString> tracker_dll, filter_dll, protocol_dll; axis_opts a_x, a_y, a_z, a_yaw, a_pitch, a_roll; |