diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-12-06 18:49:54 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-12-06 18:49:54 +0100 |
commit | 58f7f332bcae5bbb13d6ef0c6ec351c53a39852e (patch) | |
tree | 12f39ef1b4247b048939cf20ecd49fb095a8e923 | |
parent | 0f67a9e324bd2d4def5fa3e27ff0e0d4e5115a58 (diff) |
move shortcut dialog to ui module
-rw-r--r-- | facetracknoir/keyboard.ui (renamed from opentrack/keyboard.ui) | 0 | ||||
-rw-r--r-- | facetracknoir/shortcut-dialog.cpp | 43 | ||||
-rw-r--r-- | facetracknoir/shortcut-dialog.hpp | 21 | ||||
-rw-r--r-- | facetracknoir/ui.h | 1 | ||||
-rw-r--r-- | opentrack/shortcuts.cpp | 41 | ||||
-rw-r--r-- | opentrack/shortcuts.h | 16 |
6 files changed, 66 insertions, 56 deletions
diff --git a/opentrack/keyboard.ui b/facetracknoir/keyboard.ui index 903bb20f..903bb20f 100644 --- a/opentrack/keyboard.ui +++ b/facetracknoir/keyboard.ui diff --git a/facetracknoir/shortcut-dialog.cpp b/facetracknoir/shortcut-dialog.cpp new file mode 100644 index 00000000..f2934c15 --- /dev/null +++ b/facetracknoir/shortcut-dialog.cpp @@ -0,0 +1,43 @@ +#include "shortcut-dialog.hpp" + +KeyboardShortcutDialog::KeyboardShortcutDialog() +{ + ui.setupUi( this ); + + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); + + for ( int i = 0; i < global_key_sequences.size(); i++) { + ui.cbxCenterKey->addItem(global_key_sequences.at(i)); + ui.cbxToggleKey->addItem(global_key_sequences.at(i)); + ui.cbxZeroKey->addItem(global_key_sequences.at(i)); + } + + tie_setting(s.center.key_index, ui.cbxCenterKey); + tie_setting(s.center.alt, ui.chkCenterAlt); + tie_setting(s.center.shift, ui.chkCenterShift); + tie_setting(s.center.ctrl, ui.chkCenterCtrl); + + tie_setting(s.toggle.key_index, ui.cbxToggleKey); + tie_setting(s.toggle.alt, ui.chkToggleAlt); + tie_setting(s.toggle.shift, ui.chkToggleShift); + tie_setting(s.toggle.ctrl, ui.chkToggleCtrl); + + tie_setting(s.zero.key_index, ui.cbxZeroKey); + tie_setting(s.zero.alt, ui.chkZeroAlt); + tie_setting(s.zero.shift, ui.chkZeroShift); + tie_setting(s.zero.ctrl, ui.chkZeroCtrl); + + tie_setting(s.s_main.tray_enabled, ui.trayp); +} + +void KeyboardShortcutDialog::doOK() { + s.b->save(); + this->close(); + emit reload(); +} + +void KeyboardShortcutDialog::doCancel() { + s.b->reload(); + close(); +} diff --git a/facetracknoir/shortcut-dialog.hpp b/facetracknoir/shortcut-dialog.hpp new file mode 100644 index 00000000..2a364822 --- /dev/null +++ b/facetracknoir/shortcut-dialog.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include <QObject> +#include <QWidget> +#include "ui_keyboard.h" +#include "opentrack/shortcuts.h" + +class KeyboardShortcutDialog: public QWidget +{ + Q_OBJECT +signals: + void reload(); +public: + KeyboardShortcutDialog(); +private: + Ui::UICKeyboardShortcutDialog ui; + Shortcuts::settings s; +private slots: + void doOK(); + void doCancel(); +}; diff --git a/facetracknoir/ui.h b/facetracknoir/ui.h index 70700cbb..2be10ee7 100644 --- a/facetracknoir/ui.h +++ b/facetracknoir/ui.h @@ -54,6 +54,7 @@ #include "opentrack/work.hpp" #include "opentrack/state.hpp" #include "curve-config.h" +#include "shortcut-dialog.hpp" using namespace options; diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp index c9e9ce41..e81b6bb0 100644 --- a/opentrack/shortcuts.cpp +++ b/opentrack/shortcuts.cpp @@ -1,47 +1,6 @@ #include "shortcuts.h" #include <QMutexLocker> -KeyboardShortcutDialog::KeyboardShortcutDialog() -{ - ui.setupUi( this ); - - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - - for ( int i = 0; i < global_key_sequences.size(); i++) { - ui.cbxCenterKey->addItem(global_key_sequences.at(i)); - ui.cbxToggleKey->addItem(global_key_sequences.at(i)); - ui.cbxZeroKey->addItem(global_key_sequences.at(i)); - } - - tie_setting(s.center.key_index, ui.cbxCenterKey); - tie_setting(s.center.alt, ui.chkCenterAlt); - tie_setting(s.center.shift, ui.chkCenterShift); - tie_setting(s.center.ctrl, ui.chkCenterCtrl); - - tie_setting(s.toggle.key_index, ui.cbxToggleKey); - tie_setting(s.toggle.alt, ui.chkToggleAlt); - tie_setting(s.toggle.shift, ui.chkToggleShift); - tie_setting(s.toggle.ctrl, ui.chkToggleCtrl); - - tie_setting(s.zero.key_index, ui.cbxZeroKey); - tie_setting(s.zero.alt, ui.chkZeroAlt); - tie_setting(s.zero.shift, ui.chkZeroShift); - tie_setting(s.zero.ctrl, ui.chkZeroCtrl); - - tie_setting(s.s_main.tray_enabled, ui.trayp); -} - -void KeyboardShortcutDialog::doOK() { - s.b->save(); - this->close(); - emit reload(); -} - -void KeyboardShortcutDialog::doCancel() { - s.b->reload(); - close(); -} #if defined(_WIN32) #include <windows.h> diff --git a/opentrack/shortcuts.h b/opentrack/shortcuts.h index 7f5f9f1f..6989ea29 100644 --- a/opentrack/shortcuts.h +++ b/opentrack/shortcuts.h @@ -13,7 +13,6 @@ #include "opentrack/plugin-support.h" #include "opentrack/options.hpp" #include "opentrack/main-settings.hpp" -#include "ui_keyboard.h" using namespace options; @@ -129,17 +128,4 @@ signals: void zero(); }; -class KeyboardShortcutDialog: public QWidget -{ - Q_OBJECT -signals: - void reload(); -public: - KeyboardShortcutDialog(); -private: - Ui::UICKeyboardShortcutDialog ui; - Shortcuts::settings s; -private slots: - void doOK(); - void doCancel(); -}; + |