diff options
Diffstat (limited to 'src/citra_qt/hotkeys.hxx')
| -rw-r--r-- | src/citra_qt/hotkeys.hxx | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/citra_qt/hotkeys.hxx b/src/citra_qt/hotkeys.hxx new file mode 100644 index 000000000..66ef7bb4e --- /dev/null +++ b/src/citra_qt/hotkeys.hxx | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | #include <QShortcut> | ||
| 2 | #include <QDialog> | ||
| 3 | #include "ui_hotkeys.h" | ||
| 4 | |||
| 5 | class QKeySequence; | ||
| 6 | class QSettings; | ||
| 7 | |||
| 8 | /** | ||
| 9 | * Register a hotkey. | ||
| 10 | * | ||
| 11 | * @param group General group this hotkey belongs to (e.g. "Main Window", "Debugger") | ||
| 12 | * @param action Name of the action (e.g. "Start Emulation", "Load Image") | ||
| 13 | * @param default_keyseq Default key sequence to assign if the hotkey wasn't present in the settings file before | ||
| 14 | * @param default_context Default context to assign if the hotkey wasn't present in the settings file before | ||
| 15 | * @warning Both the group and action strings will be displayed in the hotkey settings dialog | ||
| 16 | */ | ||
| 17 | void RegisterHotkey(const QString& group, const QString& action, const QKeySequence& default_keyseq = QKeySequence(), Qt::ShortcutContext default_context = Qt::WindowShortcut); | ||
| 18 | |||
| 19 | /** | ||
| 20 | * Returns a QShortcut object whose activated() signal can be connected to other QObjects' slots. | ||
| 21 | * | ||
| 22 | * @param widget Parent widget of the returned QShortcut. | ||
| 23 | * @warning If multiple QWidgets' call this function for the same action, the returned QShortcut will be the same. Thus, you shouldn't rely on the caller really being the QShortcut's parent. | ||
| 24 | */ | ||
| 25 | QShortcut* GetHotkey(const QString& group, const QString& action, QWidget* widget); | ||
| 26 | |||
| 27 | /** | ||
| 28 | * Saves all registered hotkeys to the settings file. | ||
| 29 | * | ||
| 30 | * @note Each hotkey group will be stored a settings group; For each hotkey inside that group, a settings group will be created to store the key sequence and the hotkey context. | ||
| 31 | */ | ||
| 32 | void SaveHotkeys(QSettings& settings); | ||
| 33 | |||
| 34 | /** | ||
| 35 | * Loads hotkeys from the settings file. | ||
| 36 | * | ||
| 37 | * @note Yet unregistered hotkeys which are present in the settings will automatically be registered. | ||
| 38 | */ | ||
| 39 | void LoadHotkeys(QSettings& settings); | ||
| 40 | |||
| 41 | class GHotkeysDialog : public QDialog | ||
| 42 | { | ||
| 43 | Q_OBJECT | ||
| 44 | |||
| 45 | public: | ||
| 46 | GHotkeysDialog(QWidget* parent = NULL); | ||
| 47 | |||
| 48 | private: | ||
| 49 | Ui::hotkeys ui; | ||
| 50 | }; | ||