summaryrefslogtreecommitdiff
path: root/src/citra_qt/hotkeys.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt/hotkeys.hxx')
-rw-r--r--src/citra_qt/hotkeys.hxx50
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
5class QKeySequence;
6class 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 */
17void 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 */
25QShortcut* 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 */
32void 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 */
39void LoadHotkeys(QSettings& settings);
40
41class GHotkeysDialog : public QDialog
42{
43 Q_OBJECT
44
45public:
46 GHotkeysDialog(QWidget* parent = NULL);
47
48private:
49 Ui::hotkeys ui;
50};