From 166e9d7400ac0be39921f9673245b22d94f5e9da Mon Sep 17 00:00:00 2001 From: Kloen Date: Wed, 23 Sep 2015 12:50:01 +0200 Subject: [PATCH] fixup: Comments, input order, casts closer to variables --- src/citra/config.cpp | 6 +++--- src/citra_qt/config.cpp | 6 +++--- src/citra_qt/config/inputs.cpp | 24 ++++++++++++------------ src/core/settings.h | 18 +++++++++--------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 01a879a23..1bb7ebeff 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -43,9 +43,9 @@ bool Config::LoadINI(INIReader* config, const char* location, const std::string& static const std::array defaults = { GLFW_KEY_X, GLFW_KEY_Z, GLFW_KEY_S, GLFW_KEY_A, GLFW_KEY_Q, GLFW_KEY_W, GLFW_KEY_1, GLFW_KEY_2, - GLFW_KEY_I, GLFW_KEY_K, GLFW_KEY_J, GLFW_KEY_L, - GLFW_KEY_T, GLFW_KEY_G, GLFW_KEY_F, GLFW_KEY_H, - GLFW_KEY_UP, GLFW_KEY_DOWN, GLFW_KEY_LEFT, GLFW_KEY_RIGHT, + GLFW_KEY_J, GLFW_KEY_L, GLFW_KEY_I, GLFW_KEY_K, + GLFW_KEY_F, GLFW_KEY_H, GLFW_KEY_T, GLFW_KEY_G, + GLFW_KEY_LEFT, GLFW_KEY_RIGHT, GLFW_KEY_UP, GLFW_KEY_DOWN, GLFW_KEY_M, GLFW_KEY_N, GLFW_KEY_B }; diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index 5fcc88948..7d22e8c1f 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp @@ -24,9 +24,9 @@ Config::Config() { const std::array Config::defaults = { Qt::Key_X, Qt::Key_Z, Qt::Key_S, Qt::Key_A, Qt::Key_Q, Qt::Key_W, Qt::Key_1, Qt::Key_2, - Qt::Key_I, Qt::Key_K, Qt::Key_J, Qt::Key_L, - Qt::Key_T, Qt::Key_G, Qt::Key_F, Qt::Key_H, - Qt::Key_Up, Qt::Key_Down, Qt::Key_Left, Qt::Key_Right, + Qt::Key_J, Qt::Key_L, Qt::Key_I, Qt::Key_K, + Qt::Key_F, Qt::Key_H, Qt::Key_T, Qt::Key_G, + Qt::Key_Left, Qt::Key_Right, Qt::Key_Up, Qt::Key_Down, Qt::Key_M, Qt::Key_N, Qt::Key_B }; diff --git a/src/citra_qt/config/inputs.cpp b/src/citra_qt/config/inputs.cpp index a3a7ffc41..5084ea6bc 100644 --- a/src/citra_qt/config/inputs.cpp +++ b/src/citra_qt/config/inputs.cpp @@ -17,11 +17,11 @@ #include "common/logging/log.h" InputsDialog::InputsDialog(QWidget* parent) : QDialog(parent) { - // create a copy of the current settings + // Create a copy of the current settings temp_settings = Settings::Values(Settings::values); signal_mapper = new QSignalMapper(this); - // create the QPushButtons + // Create the QPushButtons for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { push_buttons[i] = new QPushButton(this); push_buttons[i]->setCheckable(true); @@ -50,8 +50,8 @@ InputsDialog::InputsDialog(QWidget* parent) : QDialog(parent) { QGridLayout* box = new QGridLayout; for (int x = 0; x <= (Settings::NativeInput::NUM_INPUTS / ARRAY_SIZE(group_names)); ++x) { QLabel* label = new QLabel(tr(label_array[id].c_str())); - box->addWidget(label, (int) x / 2 * 2, (int) x % 2 * 2); - box->addWidget(push_buttons[id], (int) x / 2 * 2 + 1, (int) x % 2 * 2); + box->addWidget(label, (int)x / 2 * 2, (int)x % 2 * 2); + box->addWidget(push_buttons[id], (int)x / 2 * 2 + 1, (int)x % 2 * 2); signal_mapper->setMapping(push_buttons[id], id); connect(push_buttons[id], SIGNAL(clicked()), signal_mapper, SLOT(map())); ++id; @@ -59,12 +59,12 @@ InputsDialog::InputsDialog(QWidget* parent) : QDialog(parent) { break; } group->setLayout(box); - grid->addWidget(group, (int) i % 3, (int) i / 3 * 2); + grid->addWidget(group, (int)i % 3, (int)i / 3 * 2); } connect(signal_mapper, SIGNAL(mapped(int)), this, SLOT(ChangeValue(int))); - // the button box that contains the restore default/ok/cancel buttons + // The button box that contains the restore default/ok/cancel buttons QVBoxLayout* verticalLayout = new QVBoxLayout(); QDialogButtonBox* buttonBox = new QDialogButtonBox(); buttonBox->setOrientation(Qt::Horizontal); @@ -79,11 +79,11 @@ InputsDialog::InputsDialog(QWidget* parent) : QDialog(parent) { setLayout(verticalLayout); setWindowTitle(tr("Input Settings")); - // set up event handlers for the buttons + // Set up event handlers for the buttons QPushButton* defaultButton = buttonBox->button(QDialogButtonBox::RestoreDefaults); connect(defaultButton, SIGNAL(clicked()), this, SLOT(RestoreDefaultSettings())); - // display current key settings + // Display current key settings UpdateKeyLabels(); } @@ -137,25 +137,25 @@ QString InputsDialog::GetKeyName(int key_code) { } void InputsDialog::RestoreDefaultSettings() { - // load the default button settings into temp_settings + // Load the default button settings into temp_settings for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { temp_settings.input_mappings[Settings::NativeInput::All[i]] = Config::defaults[i].toInt(); } - // then display it + // Then display it UpdateKeyLabels(); } void InputsDialog::SaveSettings() { Config config; - // load the temporary settings into our real settings + // Load the temporary settings into our real settings for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { Settings::values.input_mappings[Settings::NativeInput::All[i]] = temp_settings.input_mappings[Settings::NativeInput::All[i]]; } - // then save it + // Then save it config.Save(); // Close the dialog after save the bindings diff --git a/src/core/settings.h b/src/core/settings.h index a3a3c2ac7..c2e7be904 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -13,26 +13,26 @@ namespace NativeInput { enum Values { Y, X, B, A, L, R, ZL, ZR, - CUP, CDOWN, CLEFT, CRIGHT, - DUP, DDOWN, DLEFT, DRIGHT, - SUP, SDOWN, SLEFT, SRIGHT, + CLEFT, CRIGHT, CUP, CDOWN, + DLEFT, DRIGHT, DUP, DDOWN, + SLEFT, SRIGHT, SUP, SDOWN, START, SELECT, HOME, NUM_INPUTS }; static const std::array Mapping = {{ "pad_y", "pad_x", "pad_b", "pad_a", "pad_l", "pad_r", "pad_zl", "pad_zr", - "pad_cup", "pad_cdown", "pad_cleft", "pad_cright", - "pad_dup", "pad_ddown", "pad_dleft", "pad_dright", - "pad_sup", "pad_sdown", "pad_sleft", "pad_sright", + "pad_cleft", "pad_cright", "pad_cup", "pad_cdown", + "pad_dleft", "pad_dright", "pad_dup", "pad_ddown", + "pad_sleft", "pad_sright", "pad_sup", "pad_sdown", "pad_start", "pad_select", "pad_home" }}; static const std::array All = {{ Y, X, B, A, L, R, ZL, ZR, - CUP, CDOWN, CLEFT, CRIGHT, - DUP, DDOWN, DLEFT, DRIGHT, - SUP, SDOWN, SLEFT, SRIGHT, + CLEFT, CRIGHT, CUP, CDOWN, + DLEFT, DRIGHT, DUP, DDOWN, + SLEFT, SRIGHT, SUP, SDOWN, START, SELECT, HOME }}; }