From 3eb737a5f5b199fd3f9951a7060255f46011e9ff Mon Sep 17 00:00:00 2001 From: LittleWhite Date: Sun, 24 Jan 2016 21:54:04 +0100 Subject: Add more stuff to configure. --- src/citra_qt/config.cpp | 22 ++++---- src/citra_qt/configure.ui | 4 +- src/citra_qt/configure_debug.cpp | 21 ++++---- src/citra_qt/configure_debug.h | 10 ++-- src/citra_qt/configure_debug.ui | 108 +++++++++++++++++++++++-------------- src/citra_qt/configure_dialog.cpp | 7 +-- src/citra_qt/configure_dialog.h | 10 ++-- src/citra_qt/configure_general.cpp | 23 ++++---- src/citra_qt/configure_general.h | 10 ++-- src/citra_qt/configure_general.ui | 80 +++++++++++++++++++++++++-- src/citra_qt/hotkeys.cpp | 7 +-- src/citra_qt/hotkeys.h | 2 + src/citra_qt/main.cpp | 9 ++-- src/citra_qt/main.h | 1 - src/citra_qt/ui_settings.h | 17 +++--- 15 files changed, 211 insertions(+), 120 deletions(-) diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index 981d92a9c..ecf5c5a75 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp @@ -82,24 +82,23 @@ void Config::ReadValues() { qt_config->beginGroup("Paths"); UISettings::values.roms_path = qt_config->value("romsPath").toString(); UISettings::values.symbols_path = qt_config->value("symbolsPath").toString(); - UISettings::values.gamedir_path = qt_config->value("gameListRootDir", ".").toString(); + UISettings::values.gamedir = qt_config->value("gameListRootDir", ".").toString(); UISettings::values.gamedir_deepscan = qt_config->value("gameListDeepScan", false).toBool(); UISettings::values.recent_files = qt_config->value("recentFiles").toStringList(); qt_config->endGroup(); qt_config->beginGroup("Shortcuts"); QStringList groups = qt_config->childGroups(); - for (auto group : groups) - { + for (auto group : groups) { qt_config->beginGroup(group); QStringList hotkeys = qt_config->childGroups(); - for (auto hotkey : hotkeys) - { + for (auto hotkey : hotkeys) { qt_config->beginGroup(hotkey); - UISettings::values.shortcuts.push_back(UISettings::Shortcut(group + "/" + hotkey, - UISettings::ContextedShortcut(qt_config->value("KeySeq").toString(), - qt_config->value("Context").toInt()))); + UISettings::values.shortcuts.emplace_back( + UISettings::Shortcut(group + "/" + hotkey, + UISettings::ContextualShortcut(qt_config->value("KeySeq").toString(), + qt_config->value("Context").toInt()))); qt_config->endGroup(); } @@ -109,6 +108,7 @@ void Config::ReadValues() { UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool(); UISettings::values.display_titlebar = qt_config->value("displayTitleBars", true).toBool(); + UISettings::values.confirm_before_closing = qt_config->value("confirmClose",true).toBool(); UISettings::values.first_start = qt_config->value("firstStart", true).toBool(); qt_config->endGroup(); @@ -167,14 +167,13 @@ void Config::SaveValues() { qt_config->beginGroup("Paths"); qt_config->setValue("romsPath", UISettings::values.roms_path); qt_config->setValue("symbolsPath", UISettings::values.symbols_path); - qt_config->setValue("gameListRootDir", UISettings::values.gamedir_path); + qt_config->setValue("gameListRootDir", UISettings::values.gamedir); qt_config->setValue("gameListDeepScan", UISettings::values.gamedir_deepscan); qt_config->setValue("recentFiles", UISettings::values.recent_files); qt_config->endGroup(); qt_config->beginGroup("Shortcuts"); - for (auto shortcut : UISettings::values.shortcuts ) - { + for (auto shortcut : UISettings::values.shortcuts ) { qt_config->setValue(shortcut.first + "/KeySeq", shortcut.second.first); qt_config->setValue(shortcut.first + "/Context", shortcut.second.second); } @@ -182,6 +181,7 @@ void Config::SaveValues() { qt_config->setValue("singleWindowMode", UISettings::values.single_window_mode); qt_config->setValue("displayTitleBars", UISettings::values.display_titlebar); + qt_config->setValue("confirmClose", UISettings::values.confirm_before_closing); qt_config->setValue("firstStart", UISettings::values.first_start); qt_config->endGroup(); diff --git a/src/citra_qt/configure.ui b/src/citra_qt/configure.ui index e4ac9a7d8..3c1f2ebba 100644 --- a/src/citra_qt/configure.ui +++ b/src/citra_qt/configure.ui @@ -7,7 +7,7 @@ 0 0 441 - 401 + 501 @@ -17,7 +17,7 @@ - Dialog + Citra Configuration diff --git a/src/citra_qt/configure_debug.cpp b/src/citra_qt/configure_debug.cpp index f8ff804b2..ba66d0833 100644 --- a/src/citra_qt/configure_debug.cpp +++ b/src/citra_qt/configure_debug.cpp @@ -2,13 +2,12 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "core/core.h" -#include "core/gdbstub/gdbstub.h" // TODO: can't include gdbstub without core.h -#include "core/settings.h" - -#include "configure_debug.h" +#include "citra_qt/configure_debug.h" #include "ui_configure_debug.h" +#include "core/gdbstub/gdbstub.h" +#include "core/settings.h" + ConfigureDebug::ConfigureDebug(QWidget *parent) : QWidget(parent), ui(new Ui::ConfigureDebug) @@ -18,16 +17,16 @@ ConfigureDebug::ConfigureDebug(QWidget *parent) : } ConfigureDebug::~ConfigureDebug() { - delete ui; } void ConfigureDebug::setConfiguration() { - ui->toogleGDBStub->setChecked(Settings::values.use_gdbstub); - ui->GDBPortSpinBox->setValue(Settings::values.gdbstub_port); + ui->toogle_gdbstub->setChecked(Settings::values.use_gdbstub); + ui->gdbport_spinbox->setEnabled(Settings::values.use_gdbstub); + ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port); } void ConfigureDebug::applyConfiguration() { - GDBStub::ToggleServer(ui->toogleGDBStub->isChecked()); - Settings::values.use_gdbstub = ui->toogleGDBStub->isChecked(); - Settings::values.gdbstub_port = ui->GDBPortSpinBox->value(); + GDBStub::ToggleServer(ui->toogle_gdbstub->isChecked()); + Settings::values.use_gdbstub = ui->toogle_gdbstub->isChecked(); + Settings::values.gdbstub_port = ui->gdbport_spinbox->value(); } diff --git a/src/citra_qt/configure_debug.h b/src/citra_qt/configure_debug.h index 9b7080d92..ab58ebbdc 100644 --- a/src/citra_qt/configure_debug.h +++ b/src/citra_qt/configure_debug.h @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#ifndef CONFIGURE_DEBUG_H -#define CONFIGURE_DEBUG_H +#pragma once +#include #include namespace Ui { @@ -16,7 +16,7 @@ class ConfigureDebug : public QWidget Q_OBJECT public: - explicit ConfigureDebug(QWidget *parent = 0); + explicit ConfigureDebug(QWidget *parent = nullptr); ~ConfigureDebug(); void applyConfiguration(); @@ -25,7 +25,5 @@ private: void setConfiguration(); private: - Ui::ConfigureDebug *ui; + std::unique_ptr ui; }; - -#endif // CONFIGURE_DEBUG_H diff --git a/src/citra_qt/configure_debug.ui b/src/citra_qt/configure_debug.ui index 80acf6e31..3ba7f44da 100644 --- a/src/citra_qt/configure_debug.ui +++ b/src/citra_qt/configure_debug.ui @@ -13,54 +13,50 @@ Form - + - + GDB - + - + - - - - - Enable GDB Stub - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Port: - - - - - - - 65536 - - - - + + + Enable GDB Stub + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Port: + + + + + + + 65536 + + @@ -69,8 +65,38 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + - + + + toogle_gdbstub + toggled(bool) + gdbport_spinbox + setEnabled(bool) + + + 84 + 157 + + + 342 + 158 + + + + diff --git a/src/citra_qt/configure_dialog.cpp b/src/citra_qt/configure_dialog.cpp index ae442adcd..87c26c715 100644 --- a/src/citra_qt/configure_dialog.cpp +++ b/src/citra_qt/configure_dialog.cpp @@ -2,10 +2,10 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include "configure_dialog.h" +#include "citra_qt/config.h" +#include "citra_qt/configure_dialog.h" #include "ui_configure.h" -#include "config.h" #include "core/settings.h" @@ -18,15 +18,12 @@ ConfigureDialog::ConfigureDialog(QWidget *parent) : } ConfigureDialog::~ConfigureDialog() { - delete ui; } void ConfigureDialog::setConfiguration() { } void ConfigureDialog::applyConfiguration() { - Config config; ui->generalTab->applyConfiguration(); ui->debugTab->applyConfiguration(); - config.Save(); } diff --git a/src/citra_qt/configure_dialog.h b/src/citra_qt/configure_dialog.h index d66049340..89020eeb4 100644 --- a/src/citra_qt/configure_dialog.h +++ b/src/citra_qt/configure_dialog.h @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#ifndef CONFIGURE_DIALOG_H -#define CONFIGURE_DIALOG_H +#pragma once +#include #include namespace Ui { @@ -16,7 +16,7 @@ class ConfigureDialog : public QDialog Q_OBJECT public: - explicit ConfigureDialog(QWidget *parent = 0); + explicit ConfigureDialog(QWidget *parent = nullptr); ~ConfigureDialog(); void applyConfiguration(); @@ -25,7 +25,5 @@ private: void setConfiguration(); private: - Ui::ConfigureDialog *ui; + std::unique_ptr ui; }; - -#endif // CONFIGURE_DIALOG_H diff --git a/src/citra_qt/configure_general.cpp b/src/citra_qt/configure_general.cpp index 71d992ebe..350bd794d 100644 --- a/src/citra_qt/configure_general.cpp +++ b/src/citra_qt/configure_general.cpp @@ -3,8 +3,8 @@ // Refer to the license.txt file included. #include "citra_qt/configure_general.h" -#include "citra_qt/ui_configure_general.h" #include "citra_qt/ui_settings.h" +#include "ui_configure_general.h" #include "core/settings.h" @@ -18,23 +18,26 @@ ConfigureGeneral::ConfigureGeneral(QWidget *parent) : this->setConfiguration(); } -ConfigureGeneral::~ConfigureGeneral() -{ - delete ui; +ConfigureGeneral::~ConfigureGeneral() { } void ConfigureGeneral::setConfiguration() { - ui->toogleCheckExit->setChecked(UISettings::values.check_closure); - ui->toogleHWRenderer->setChecked(Settings::values.use_hw_renderer); - ui->toogleShaderJIT->setChecked(Settings::values.use_shader_jit); + ui->toogle_deepscan->setChecked(UISettings::values.gamedir_deepscan); + ui->toogle_check_exit->setChecked(UISettings::values.confirm_before_closing); + ui->region_combobox->setCurrentIndex(Settings::values.region_value); + ui->toogle_hw_renderer->setChecked(Settings::values.use_hw_renderer); + ui->toogle_shader_jit->setChecked(Settings::values.use_shader_jit); } void ConfigureGeneral::applyConfiguration() { - UISettings::values.check_closure = ui->toogleCheckExit->isChecked(); + UISettings::values.gamedir_deepscan = ui->toogle_deepscan->isChecked(); + UISettings::values.confirm_before_closing = ui->toogle_check_exit->isChecked(); + + Settings::values.region_value = ui->region_combobox->currentIndex(); VideoCore::g_hw_renderer_enabled = - Settings::values.use_hw_renderer = ui->toogleHWRenderer->isChecked(); + Settings::values.use_hw_renderer = ui->toogle_hw_renderer->isChecked(); VideoCore::g_shader_jit_enabled = - Settings::values.use_shader_jit = ui->toogleShaderJIT->isChecked(); + Settings::values.use_shader_jit = ui->toogle_shader_jit->isChecked(); } diff --git a/src/citra_qt/configure_general.h b/src/citra_qt/configure_general.h index 0f3b69332..a6c68e62d 100644 --- a/src/citra_qt/configure_general.h +++ b/src/citra_qt/configure_general.h @@ -2,9 +2,9 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#ifndef CONFIGURE_GENERAL_H -#define CONFIGURE_GENERAL_H +#pragma once +#include #include namespace Ui { @@ -16,7 +16,7 @@ class ConfigureGeneral : public QWidget Q_OBJECT public: - explicit ConfigureGeneral(QWidget *parent = 0); + explicit ConfigureGeneral(QWidget *parent = nullptr); ~ConfigureGeneral(); void applyConfiguration(); @@ -25,7 +25,5 @@ private: void setConfiguration(); private: - Ui::ConfigureGeneral *ui; + std::unique_ptr ui; }; - -#endif // CONFIGURE_GENERAL_H diff --git a/src/citra_qt/configure_general.ui b/src/citra_qt/configure_general.ui index f847d3c6c..47184c5c6 100644 --- a/src/citra_qt/configure_general.ui +++ b/src/citra_qt/configure_general.ui @@ -6,7 +6,7 @@ 0 0 - 284 + 300 377 @@ -25,7 +25,14 @@ - + + + Recursive scan for game folder + + + + + Confirm exit while emulation is running @@ -36,6 +43,69 @@ + + + + Emulation + + + + + + + + + + Region: + + + + + + + + JPN + + + + + USA + + + + + EUR + + + + + AUS + + + + + CHN + + + + + KOR + + + + + TWN + + + + + + + + + + + @@ -45,16 +115,16 @@ - + Enable hardware renderer - + - Enable Shader JIT + Enable shader JIT diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp index 92525d53c..41f95c63d 100644 --- a/src/citra_qt/hotkeys.cpp +++ b/src/citra_qt/hotkeys.cpp @@ -32,9 +32,10 @@ void SaveHotkeys() { for (auto hotkey : group.second) { - UISettings::values.shortcuts.push_back(UISettings::Shortcut(group.first + "/" + hotkey.first, - UISettings::ContextedShortcut(hotkey.second.keyseq.toString(), - hotkey.second.context))); + UISettings::values.shortcuts.emplace_back( + UISettings::Shortcut(group.first + "/" + hotkey.first, + UISettings::ContextualShortcut(hotkey.second.keyseq.toString(), + hotkey.second.context))); } } } diff --git a/src/citra_qt/hotkeys.h b/src/citra_qt/hotkeys.h index 79a685074..38aa5f012 100644 --- a/src/citra_qt/hotkeys.h +++ b/src/citra_qt/hotkeys.h @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#pragma once + #include "ui_hotkeys.h" class QDialog; diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 26904c71d..a81c6db3f 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -194,7 +194,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) show(); - game_list->PopulateAsync(UISettings::values.gamedir_path, UISettings::values.gamedir_deepscan); + game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); QStringList args = QApplication::arguments(); if (args.length() >= 2) { @@ -416,7 +416,7 @@ void GMainWindow::OnMenuLoadSymbolMap() { void GMainWindow::OnMenuSelectGameListRoot() { QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory")); if (!dir_path.isEmpty()) { - UISettings::values.gamedir_path = dir_path; + UISettings::values.gamedir = dir_path; game_list->PopulateAsync(dir_path, UISettings::values.gamedir_deepscan); } } @@ -488,14 +488,15 @@ void GMainWindow::ToggleWindowMode() { void GMainWindow::OnConfigure() { ConfigureDialog configureDialog(this); auto result = configureDialog.exec(); - if ( result == QDialog::Accepted) + if (result == QDialog::Accepted) { configureDialog.applyConfiguration(); + config->Save(); } } bool GMainWindow::ConfirmClose() { - if (emu_thread == nullptr || !confirm_before_closing) + if (emu_thread == nullptr || !UISettings::values.confirm_before_closing) return true; auto answer = QMessageBox::question(this, tr("Citra"), diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index bd620676b..477db5c5c 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -130,7 +130,6 @@ private: GPUCommandListWidget* graphicsCommandsWidget; QAction* actions_recent_files[max_recent_files_item]; - bool confirm_before_closing; }; #endif // _CITRA_QT_MAIN_HXX_ diff --git a/src/citra_qt/ui_settings.h b/src/citra_qt/ui_settings.h index 729866d56..62db4a73e 100644 --- a/src/citra_qt/ui_settings.h +++ b/src/citra_qt/ui_settings.h @@ -2,8 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#ifndef UISETTINGS_H -#define UISETTINGS_H +#pragma once #include #include @@ -13,8 +12,8 @@ namespace UISettings { - typedef std::pair ContextedShortcut; - typedef std::pair Shortcut; +using ContextualShortcut = std::pair ; +using Shortcut = std::pair; struct Values { QByteArray geometry; @@ -30,19 +29,19 @@ struct Values { bool single_window_mode; bool display_titlebar; - bool check_closure; + bool confirm_before_closing; bool first_start; QString roms_path; QString symbols_path; - QString gamedir_path; + QString gamedir; bool gamedir_deepscan; QStringList recent_files; // Shortcut name std::vector shortcuts; -} extern values; +}; -} +extern Values values; -#endif // UISETTINGS_H +} -- cgit v1.2.3