diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-11 14:36:07 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-11 14:36:07 +0100 |
commit | e1d6232217120be879bb639681f61e46e2d48580 (patch) | |
tree | d186ffc3dd72de6e4703d584a41971107ca8389b /gui/settings.cpp | |
parent | 98ef185a5c9075720acb54ec1c2e5fec6e4ab440 (diff) |
cmake, gui, main: make user interface reusable
The work isn't complete. We need moving out all non-reusable parts away
and only keeping user interface logic in a class.
Diffstat (limited to 'gui/settings.cpp')
-rw-r--r-- | gui/settings.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/gui/settings.cpp b/gui/settings.cpp index 3b14dec7..b6d4255e 100644 --- a/gui/settings.cpp +++ b/gui/settings.cpp @@ -14,7 +14,7 @@ #include <QDialog> #include <QFileDialog> -QString OptionsDialog::kopts_to_string(const key_opts& kopts) +QString options_dialog::kopts_to_string(const key_opts& kopts) { if (static_cast<QString>(kopts.guid) != "") { @@ -31,7 +31,7 @@ QString OptionsDialog::kopts_to_string(const key_opts& kopts) return kopts.keycode; } -void OptionsDialog::set_disable_translation_state(bool value) +void options_dialog::set_disable_translation_state(bool value) { group::with_global_settings_object([&](QSettings& s) { @@ -39,7 +39,7 @@ void OptionsDialog::set_disable_translation_state(bool value) }); } -OptionsDialog::OptionsDialog(std::function<void(bool)> pause_keybindings) : +options_dialog::options_dialog(std::function<void(bool)> pause_keybindings) : pause_keybindings(pause_keybindings) { ui.setupUi(this); @@ -145,22 +145,22 @@ OptionsDialog::OptionsDialog(std::function<void(bool)> pause_keybindings) : } } -void OptionsDialog::closeEvent(QCloseEvent *) +void options_dialog::closeEvent(QCloseEvent *) { done(result()); } -void OptionsDialog::bind_key(key_opts& kopts, QLabel* label) +void options_dialog::bind_key(key_opts& kopts, QLabel* label) { kopts.button = -1; kopts.guid = ""; kopts.keycode = ""; - auto k = new KeyboardListener; + auto k = new keyboard_listener; k->setWindowModality(Qt::ApplicationModal); k->deleteLater(); connect(k, - &KeyboardListener::key_pressed, + &keyboard_listener::key_pressed, this, [&](const QKeySequence& s) { @@ -169,7 +169,7 @@ void OptionsDialog::bind_key(key_opts& kopts, QLabel* label) kopts.button = -1; k->close(); }); - connect(k, &KeyboardListener::joystick_button_pressed, + connect(k, &keyboard_listener::joystick_button_pressed, this, [&](const QString& guid, int idx, bool held) { @@ -202,7 +202,7 @@ void OptionsDialog::bind_key(key_opts& kopts, QLabel* label) label->setText(kopts_to_string(kopts)); } -void OptionsDialog::doOK() +void options_dialog::doOK() { if (isHidden()) // close() can return true twice in a row it seems return; @@ -216,7 +216,7 @@ void OptionsDialog::doOK() emit closing(); } -void OptionsDialog::doCancel() +void options_dialog::doCancel() { if (isHidden()) // close() can return true twice in a row it seems return; @@ -229,7 +229,7 @@ void OptionsDialog::doCancel() emit closing(); } -void OptionsDialog::done(int res) +void options_dialog::done(int res) { if (isVisible()) { |