diff options
Diffstat (limited to 'src/citra_qt/hotkeys.h')
| -rw-r--r-- | src/citra_qt/hotkeys.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/citra_qt/hotkeys.h b/src/citra_qt/hotkeys.h new file mode 100644 index 000000000..75c7cc625 --- /dev/null +++ b/src/citra_qt/hotkeys.h | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <QShortcut> | ||
| 6 | #include <QDialog> | ||
| 7 | #include "ui_hotkeys.h" | ||
| 8 | |||
| 9 | class QKeySequence; | ||
| 10 | class QSettings; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * Register a hotkey. | ||
| 14 | * | ||
| 15 | * @param group General group this hotkey belongs to (e.g. "Main Window", "Debugger") | ||
| 16 | * @param action Name of the action (e.g. "Start Emulation", "Load Image") | ||
| 17 | * @param default_keyseq Default key sequence to assign if the hotkey wasn't present in the settings file before | ||
| 18 | * @param default_context Default context to assign if the hotkey wasn't present in the settings file before | ||
| 19 | * @warning Both the group and action strings will be displayed in the hotkey settings dialog | ||
| 20 | */ | ||
| 21 | void RegisterHotkey(const QString& group, const QString& action, const QKeySequence& default_keyseq = QKeySequence(), Qt::ShortcutContext default_context = Qt::WindowShortcut); | ||
| 22 | |||
| 23 | /** | ||
| 24 | * Returns a QShortcut object whose activated() signal can be connected to other QObjects' slots. | ||
| 25 | * | ||
| 26 | * @param widget Parent widget of the returned QShortcut. | ||
| 27 | * @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. | ||
| 28 | */ | ||
| 29 | QShortcut* GetHotkey(const QString& group, const QString& action, QWidget* widget); | ||
| 30 | |||
| 31 | /** | ||
| 32 | * Saves all registered hotkeys to the settings file. | ||
| 33 | * | ||
| 34 | * @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. | ||
| 35 | */ | ||
| 36 | void SaveHotkeys(QSettings& settings); | ||
| 37 | |||
| 38 | /** | ||
| 39 | * Loads hotkeys from the settings file. | ||
| 40 | * | ||
| 41 | * @note Yet unregistered hotkeys which are present in the settings will automatically be registered. | ||
| 42 | */ | ||
| 43 | void LoadHotkeys(QSettings& settings); | ||
| 44 | |||
| 45 | class GHotkeysDialog : public QDialog | ||
| 46 | { | ||
| 47 | Q_OBJECT | ||
| 48 | |||
| 49 | public: | ||
| 50 | GHotkeysDialog(QWidget* parent = NULL); | ||
| 51 | |||
| 52 | private: | ||
| 53 | Ui::hotkeys ui; | ||
| 54 | }; | ||