diff options
author | bunnei <ericbunnie@gmail.com> | 2014-04-08 19:25:03 -0400 |
---|---|---|
committer | bunnei <ericbunnie@gmail.com> | 2014-04-08 19:25:03 -0400 |
commit | 63e46abdb8764bc97e91bae862c8d461e61b1965 (patch) | |
tree | e73f4aa25d7b4015a265e7bbfb6004dab7561027 /src/citra_qt/hotkeys.hxx | |
parent | 03c245345e1f319da5007c15019ed54432029fb8 (diff) |
got rid of 'src' folders in each sub-project
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 00000000..66ef7bb4 --- /dev/null +++ b/src/citra_qt/hotkeys.hxx @@ -0,0 +1,50 @@ +#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; +}; |