From dc8479928c5aee4c6ad6fe4f59006fb604cee701 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 18 Sep 2016 09:38:01 +0900 Subject: Sources: Run clang-format on everything. --- src/citra_qt/hotkeys.cpp | 55 +++++++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 33 deletions(-) (limited to 'src/citra_qt/hotkeys.cpp') diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp index 41f95c63d..6301259d8 100644 --- a/src/citra_qt/hotkeys.cpp +++ b/src/citra_qt/hotkeys.cpp @@ -4,16 +4,16 @@ #include -#include #include #include +#include #include "citra_qt/hotkeys.h" #include "citra_qt/ui_settings.h" -struct Hotkey -{ - Hotkey() : shortcut(nullptr), context(Qt::WindowShortcut) {} +struct Hotkey { + Hotkey() : shortcut(nullptr), context(Qt::WindowShortcut) { + } QKeySequence keyseq; QShortcut* shortcut; @@ -25,33 +25,28 @@ typedef std::map 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 +55,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 +72,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); -- cgit v1.2.3 From 396a8d91a4423d9c793eeff0798d544613647511 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 18 Sep 2016 18:01:46 -0700 Subject: Manually tweak source formatting and then re-run clang-format --- src/citra_qt/hotkeys.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/citra_qt/hotkeys.cpp') diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp index 6301259d8..3e38223ee 100644 --- a/src/citra_qt/hotkeys.cpp +++ b/src/citra_qt/hotkeys.cpp @@ -12,8 +12,7 @@ #include "citra_qt/ui_settings.h" struct Hotkey { - Hotkey() : shortcut(nullptr), context(Qt::WindowShortcut) { - } + Hotkey() : shortcut(nullptr), context(Qt::WindowShortcut) {} QKeySequence keyseq; QShortcut* shortcut; -- cgit v1.2.3 From ebdae19fd226104baec712b9da9939ff82ef3c3a Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 21 Sep 2016 00:21:23 +0900 Subject: Remove empty newlines in #include blocks. This makes clang-format useful on those. Also add a bunch of forgotten transitive includes, which otherwise prevented compilation. --- src/citra_qt/hotkeys.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/citra_qt/hotkeys.cpp') diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp index 3e38223ee..9037f20f2 100644 --- a/src/citra_qt/hotkeys.cpp +++ b/src/citra_qt/hotkeys.cpp @@ -2,13 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "citra_qt/hotkeys.h" #include - #include #include #include - -#include "citra_qt/hotkeys.h" #include "citra_qt/ui_settings.h" struct Hotkey { -- cgit v1.2.3 From 84fbbe26297652d994d203bde543ec252c2d801a Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Tue, 20 Sep 2016 23:52:38 -0700 Subject: Use negative priorities to avoid special-casing the self-include --- src/citra_qt/hotkeys.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/citra_qt/hotkeys.cpp') diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp index 9037f20f2..158ed506f 100644 --- a/src/citra_qt/hotkeys.cpp +++ b/src/citra_qt/hotkeys.cpp @@ -2,11 +2,11 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "citra_qt/hotkeys.h" #include #include #include #include +#include "citra_qt/hotkeys.h" #include "citra_qt/ui_settings.h" struct Hotkey { -- cgit v1.2.3