diff options
| author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2016-09-21 11:29:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-21 11:29:48 -0700 |
| commit | d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a (patch) | |
| tree | 8a22ca73ff838f3f0090b29a548ae81087fc90ed /src/citra_qt/hotkeys.cpp | |
| parent | 2a910a6d883f2227edc74aacf5b93a58a3dea07c (diff) | |
| parent | 0e3f0120a8ec2996e73bb6b7b6c9d7531f7a7eb1 (diff) | |
Merge pull request #2086 from linkmauve/clang-format
Add clang-format as part of our {commit,travis}-time checks
Diffstat (limited to 'src/citra_qt/hotkeys.cpp')
| -rw-r--r-- | src/citra_qt/hotkeys.cpp | 54 |
1 files changed, 20 insertions, 34 deletions
diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp index 41f95c63d..158ed506f 100644 --- a/src/citra_qt/hotkeys.cpp +++ b/src/citra_qt/hotkeys.cpp @@ -3,16 +3,13 @@ // Refer to the license.txt file included. #include <map> - -#include <QtGlobal> #include <QKeySequence> #include <QShortcut> - +#include <QtGlobal> #include "citra_qt/hotkeys.h" #include "citra_qt/ui_settings.h" -struct Hotkey -{ +struct Hotkey { Hotkey() : shortcut(nullptr), context(Qt::WindowShortcut) {} QKeySequence keyseq; @@ -25,33 +22,28 @@ typedef std::map<QString, HotkeyMap> HotkeyGroupMap; HotkeyGroupMap hotkey_groups; -void SaveHotkeys() -{ +void SaveHotkeys() { UISettings::values.shortcuts.clear(); - for (auto group : hotkey_groups) - { - for (auto hotkey : group.second) - { + for (auto group : hotkey_groups) { + for (auto hotkey : group.second) { UISettings::values.shortcuts.emplace_back( - UISettings::Shortcut(group.first + "/" + hotkey.first, - UISettings::ContextualShortcut(hotkey.second.keyseq.toString(), - hotkey.second.context))); + UISettings::Shortcut(group.first + "/" + hotkey.first, + UISettings::ContextualShortcut(hotkey.second.keyseq.toString(), + hotkey.second.context))); } } } -void LoadHotkeys() -{ - // Make sure NOT to use a reference here because it would become invalid once we call beginGroup() - for (auto shortcut : UISettings::values.shortcuts) - { +void LoadHotkeys() { + // Make sure NOT to use a reference here because it would become invalid once we call + // beginGroup() + for (auto shortcut : UISettings::values.shortcuts) { QStringList cat = shortcut.first.split("/"); Q_ASSERT(cat.size() >= 2); // RegisterHotkey assigns default keybindings, so use old values as default parameters Hotkey& hk = hotkey_groups[cat[0]][cat[1]]; - if (!shortcut.second.first.isEmpty()) - { + if (!shortcut.second.first.isEmpty()) { hk.keyseq = QKeySequence::fromString(shortcut.second.first); hk.context = (Qt::ShortcutContext)shortcut.second.second; } @@ -60,17 +52,15 @@ void LoadHotkeys() } } -void RegisterHotkey(const QString& group, const QString& action, const QKeySequence& default_keyseq, Qt::ShortcutContext default_context) -{ - if (hotkey_groups[group].find(action) == hotkey_groups[group].end()) - { +void RegisterHotkey(const QString& group, const QString& action, const QKeySequence& default_keyseq, + Qt::ShortcutContext default_context) { + if (hotkey_groups[group].find(action) == hotkey_groups[group].end()) { hotkey_groups[group][action].keyseq = default_keyseq; hotkey_groups[group][action].context = default_context; } } -QShortcut* GetHotkey(const QString& group, const QString& action, QWidget* widget) -{ +QShortcut* GetHotkey(const QString& group, const QString& action, QWidget* widget) { Hotkey& hk = hotkey_groups[group][action]; if (!hk.shortcut) @@ -79,16 +69,12 @@ QShortcut* GetHotkey(const QString& group, const QString& action, QWidget* widge return hk.shortcut; } - -GHotkeysDialog::GHotkeysDialog(QWidget* parent): QWidget(parent) -{ +GHotkeysDialog::GHotkeysDialog(QWidget* parent) : QWidget(parent) { ui.setupUi(this); - for (auto group : hotkey_groups) - { + for (auto group : hotkey_groups) { QTreeWidgetItem* toplevel_item = new QTreeWidgetItem(QStringList(group.first)); - for (auto hotkey : group.second) - { + for (auto hotkey : group.second) { QStringList columns; columns << hotkey.first << hotkey.second.keyseq.toString(); QTreeWidgetItem* item = new QTreeWidgetItem(columns); |
