summaryrefslogtreecommitdiffstats
path: root/src/citra_qt/hotkeys.h
diff options
context:
space:
mode:
authorchrisvj <chrisvanderjagt@gmail.com>2015-01-04 00:51:14 +0100
committerchrisvj <chrisvanderjagt@gmail.com>2015-01-06 13:51:54 +0100
commitb0a14cfe7f0075d0758371276b7f6384856aa6ff (patch)
tree1c7c0f0f9c707138a0a7f37583c0ef31cd94bec3 /src/citra_qt/hotkeys.h
parentMerge pull request #419 from linkmauve/no-x86-specifics (diff)
downloadyuzu-b0a14cfe7f0075d0758371276b7f6384856aa6ff.tar
yuzu-b0a14cfe7f0075d0758371276b7f6384856aa6ff.tar.gz
yuzu-b0a14cfe7f0075d0758371276b7f6384856aa6ff.tar.bz2
yuzu-b0a14cfe7f0075d0758371276b7f6384856aa6ff.tar.lz
yuzu-b0a14cfe7f0075d0758371276b7f6384856aa6ff.tar.xz
yuzu-b0a14cfe7f0075d0758371276b7f6384856aa6ff.tar.zst
yuzu-b0a14cfe7f0075d0758371276b7f6384856aa6ff.zip
Diffstat (limited to 'src/citra_qt/hotkeys.h')
-rw-r--r--src/citra_qt/hotkeys.h54
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 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include <QShortcut>
+#include <QDialog>
+#include "ui_hotkeys.h"
+
+class QKeySequence;
+class QSettings;
+
+/**
+ * Register a hotkey.
+ *
+ * @param group General group this hotkey belongs to (e.g. "Main Window", "Debugger")
+ * @param action Name of the action (e.g. "Start Emulation", "Load Image")
+ * @param default_keyseq Default key sequence to assign if the hotkey wasn't present in the settings file before
+ * @param default_context Default context to assign if the hotkey wasn't present in the settings file before
+ * @warning Both the group and action strings will be displayed in the hotkey settings dialog
+ */
+void RegisterHotkey(const QString& group, const QString& action, const QKeySequence& default_keyseq = QKeySequence(), Qt::ShortcutContext default_context = Qt::WindowShortcut);
+
+/**
+ * Returns a QShortcut object whose activated() signal can be connected to other QObjects' slots.
+ *
+ * @param widget Parent widget of the returned QShortcut.
+ * @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.
+ */
+QShortcut* GetHotkey(const QString& group, const QString& action, QWidget* widget);
+
+/**
+ * Saves all registered hotkeys to the settings file.
+ *
+ * @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.
+ */
+void SaveHotkeys(QSettings& settings);
+
+/**
+ * Loads hotkeys from the settings file.
+ *
+ * @note Yet unregistered hotkeys which are present in the settings will automatically be registered.
+ */
+void LoadHotkeys(QSettings& settings);
+
+class GHotkeysDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ GHotkeysDialog(QWidget* parent = NULL);
+
+private:
+ Ui::hotkeys ui;
+};