diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 9b3eb2cd6..6660d9879 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -17,12 +17,16 @@ set(SRCS debugger/profiler.cpp debugger/ramview.cpp debugger/registers.cpp - game_list.cpp util/spinbox.cpp util/util.cpp bootmanager.cpp + configure_debug.cpp + configure_dialog.cpp + configure_general.cpp + game_list.cpp hotkeys.cpp main.cpp + ui_settings.cpp citra-qt.rc Info.plist ) @@ -44,12 +48,16 @@ set(HEADERS debugger/profiler.h debugger/ramview.h debugger/registers.h - game_list.h util/spinbox.h util/util.h bootmanager.h + configure_debug.h + configure_dialog.h + configure_general.h + game_list.h hotkeys.h main.h + ui_settings.h version.h ) @@ -59,6 +67,9 @@ set(UIS debugger/disassembler.ui debugger/profiler.ui debugger/registers.ui + configure.ui + configure_debug.ui + configure_general.ui hotkeys.ui main.ui ) diff --git a/src/citra_qt/configure.ui b/src/citra_qt/configure.ui new file mode 100644 index 000000000..e4ac9a7d8 --- /dev/null +++ b/src/citra_qt/configure.ui @@ -0,0 +1,109 @@ + + + ConfigureDialog + + + + 0 + 0 + 441 + 401 + + + + + 370 + 219 + + + + Dialog + + + + + + + 371 + 221 + + + + 0 + + + + General + + + + + Input + + + + + Debug + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + ConfigureGeneral + QWidget +
configure_general.h
+ 1 +
+ + ConfigureDebug + QWidget +
configure_debug.h
+ 1 +
+
+ + + + buttonBox + accepted() + ConfigureDialog + accept() + + + 220 + 380 + + + 220 + 200 + + + + + buttonBox + rejected() + ConfigureDialog + reject() + + + 220 + 380 + + + 220 + 200 + + + + +
diff --git a/src/citra_qt/configure_debug.cpp b/src/citra_qt/configure_debug.cpp new file mode 100644 index 000000000..f8ff804b2 --- /dev/null +++ b/src/citra_qt/configure_debug.cpp @@ -0,0 +1,33 @@ +// Copyright 2016 Citra Emulator Project +// 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 "ui_configure_debug.h" + +ConfigureDebug::ConfigureDebug(QWidget *parent) : + QWidget(parent), + ui(new Ui::ConfigureDebug) +{ + ui->setupUi(this); + this->setConfiguration(); +} + +ConfigureDebug::~ConfigureDebug() { + delete ui; +} + +void ConfigureDebug::setConfiguration() { + ui->toogleGDBStub->setChecked(Settings::values.use_gdbstub); + ui->GDBPortSpinBox->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(); +} diff --git a/src/citra_qt/configure_debug.h b/src/citra_qt/configure_debug.h new file mode 100644 index 000000000..9b7080d92 --- /dev/null +++ b/src/citra_qt/configure_debug.h @@ -0,0 +1,31 @@ +// Copyright 2016 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#ifndef CONFIGURE_DEBUG_H +#define CONFIGURE_DEBUG_H + +#include + +namespace Ui { +class ConfigureDebug; +} + +class ConfigureDebug : public QWidget +{ + Q_OBJECT + +public: + explicit ConfigureDebug(QWidget *parent = 0); + ~ConfigureDebug(); + + void applyConfiguration(); + +private: + void setConfiguration(); + +private: + Ui::ConfigureDebug *ui; +}; + +#endif // CONFIGURE_DEBUG_H diff --git a/src/citra_qt/configure_debug.ui b/src/citra_qt/configure_debug.ui new file mode 100644 index 000000000..80acf6e31 --- /dev/null +++ b/src/citra_qt/configure_debug.ui @@ -0,0 +1,76 @@ + + + ConfigureDebug + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + GDB + + + + + + + + + + Enable GDB Stub + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Port: + + + + + + + 65536 + + + + + + + + + + + + + + + + + diff --git a/src/citra_qt/configure_dialog.cpp b/src/citra_qt/configure_dialog.cpp new file mode 100644 index 000000000..ae442adcd --- /dev/null +++ b/src/citra_qt/configure_dialog.cpp @@ -0,0 +1,32 @@ +// Copyright 2016 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "configure_dialog.h" +#include "ui_configure.h" + +#include "config.h" + +#include "core/settings.h" + +ConfigureDialog::ConfigureDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::ConfigureDialog) +{ + ui->setupUi(this); + this->setConfiguration(); +} + +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 new file mode 100644 index 000000000..d66049340 --- /dev/null +++ b/src/citra_qt/configure_dialog.h @@ -0,0 +1,31 @@ +// Copyright 2016 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#ifndef CONFIGURE_DIALOG_H +#define CONFIGURE_DIALOG_H + +#include + +namespace Ui { +class ConfigureDialog; +} + +class ConfigureDialog : public QDialog +{ + Q_OBJECT + +public: + explicit ConfigureDialog(QWidget *parent = 0); + ~ConfigureDialog(); + + void applyConfiguration(); + +private: + void setConfiguration(); + +private: + Ui::ConfigureDialog *ui; +}; + +#endif // CONFIGURE_DIALOG_H diff --git a/src/citra_qt/configure_general.cpp b/src/citra_qt/configure_general.cpp new file mode 100644 index 000000000..71d992ebe --- /dev/null +++ b/src/citra_qt/configure_general.cpp @@ -0,0 +1,40 @@ +// Copyright 2016 Citra Emulator Project +// Licensed under GPLv2 or any later version +// 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 "core/settings.h" + +#include "video_core/video_core.h" + +ConfigureGeneral::ConfigureGeneral(QWidget *parent) : + QWidget(parent), + ui(new Ui::ConfigureGeneral) +{ + ui->setupUi(this); + this->setConfiguration(); +} + +ConfigureGeneral::~ConfigureGeneral() +{ + delete ui; +} + +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); +} + +void ConfigureGeneral::applyConfiguration() { + UISettings::values.check_closure = ui->toogleCheckExit->isChecked(); + + VideoCore::g_hw_renderer_enabled = + Settings::values.use_hw_renderer = ui->toogleHWRenderer->isChecked(); + + VideoCore::g_shader_jit_enabled = + Settings::values.use_shader_jit = ui->toogleShaderJIT->isChecked(); +} diff --git a/src/citra_qt/configure_general.h b/src/citra_qt/configure_general.h new file mode 100644 index 000000000..0f3b69332 --- /dev/null +++ b/src/citra_qt/configure_general.h @@ -0,0 +1,31 @@ +// Copyright 2016 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#ifndef CONFIGURE_GENERAL_H +#define CONFIGURE_GENERAL_H + +#include + +namespace Ui { +class ConfigureGeneral; +} + +class ConfigureGeneral : public QWidget +{ + Q_OBJECT + +public: + explicit ConfigureGeneral(QWidget *parent = 0); + ~ConfigureGeneral(); + + void applyConfiguration(); + +private: + void setConfiguration(); + +private: + Ui::ConfigureGeneral *ui; +}; + +#endif // CONFIGURE_GENERAL_H diff --git a/src/citra_qt/configure_general.ui b/src/citra_qt/configure_general.ui new file mode 100644 index 000000000..f847d3c6c --- /dev/null +++ b/src/citra_qt/configure_general.ui @@ -0,0 +1,96 @@ + + + ConfigureGeneral + + + + 0 + 0 + 284 + 377 + + + + Form + + + + + + + + General + + + + + + + + Confirm exit while emulation is running + + + + + + + + + + + + Performance + + + + + + + + Enable hardware renderer + + + + + + + Enable Shader JIT + + + + + + + + + + + + Hotkeys + + + + + + + + + + + + + + + + + + + GHotkeysDialog + QWidget +
hotkeys.h
+ 1 +
+
+ + +
diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp index ed6b12fc4..929ba6f0e 100644 --- a/src/citra_qt/hotkeys.cpp +++ b/src/citra_qt/hotkeys.cpp @@ -94,7 +94,7 @@ QShortcut* GetHotkey(const QString& group, const QString& action, QWidget* widge } -GHotkeysDialog::GHotkeysDialog(QWidget* parent): QDialog(parent) +GHotkeysDialog::GHotkeysDialog(QWidget* parent): QWidget(parent) { ui.setupUi(this); diff --git a/src/citra_qt/hotkeys.h b/src/citra_qt/hotkeys.h index 2fe635882..50e6cbc21 100644 --- a/src/citra_qt/hotkeys.h +++ b/src/citra_qt/hotkeys.h @@ -42,7 +42,7 @@ void SaveHotkeys(QSettings& settings); */ void LoadHotkeys(QSettings& settings); -class GHotkeysDialog : public QDialog +class GHotkeysDialog : public QWidget { Q_OBJECT diff --git a/src/citra_qt/hotkeys.ui b/src/citra_qt/hotkeys.ui index 38a9a14d1..050fe064e 100644 --- a/src/citra_qt/hotkeys.ui +++ b/src/citra_qt/hotkeys.ui @@ -1,7 +1,7 @@ hotkeys - + 0 @@ -39,51 +39,8 @@ - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset - - - - - - buttonBox - accepted() - hotkeys - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - hotkeys - reject() - - - 316 - 260 - - - 286 - 274 - - - - + diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 32cceaf7e..573036a2a 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -13,6 +13,7 @@ #include "citra_qt/bootmanager.h" #include "citra_qt/config.h" +#include "citra_qt/configure_dialog.h" #include "citra_qt/game_list.h" #include "citra_qt/hotkeys.h" #include "citra_qt/main.h" @@ -145,17 +146,9 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) game_list->LoadInterfaceLayout(settings); - ui.action_Use_Gdbstub->setChecked(Settings::values.use_gdbstub); - SetGdbstubEnabled(ui.action_Use_Gdbstub->isChecked()); - + GDBStub::ToggleServer(Settings::values.use_gdbstub); GDBStub::SetServerPort(static_cast(Settings::values.gdbstub_port)); - ui.action_Use_Hardware_Renderer->setChecked(Settings::values.use_hw_renderer); - SetHardwareRendererEnabled(ui.action_Use_Hardware_Renderer->isChecked()); - - ui.action_Use_Shader_JIT->setChecked(Settings::values.use_shader_jit); - SetShaderJITEnabled(ui.action_Use_Shader_JIT->isChecked()); - ui.action_Single_Window_Mode->setChecked(settings.value("singleWindowMode", true).toBool()); ToggleWindowMode(); @@ -176,17 +169,14 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) // Setup connections connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString))); + connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(OnConfigure())); connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile())); connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap())); connect(ui.action_Select_Game_List_Root, SIGNAL(triggered()), this, SLOT(OnMenuSelectGameListRoot())); connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame())); connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame())); connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame())); - connect(ui.action_Use_Hardware_Renderer, SIGNAL(triggered(bool)), this, SLOT(SetHardwareRendererEnabled(bool))); - connect(ui.action_Use_Shader_JIT, SIGNAL(triggered(bool)), this, SLOT(SetShaderJITEnabled(bool))); - connect(ui.action_Use_Gdbstub, SIGNAL(triggered(bool)), this, SLOT(SetGdbstubEnabled(bool))); connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode())); - connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog())); connect(this, SIGNAL(EmulationStarting(EmuThread*)), disasmWidget, SLOT(OnEmulationStarting(EmuThread*))); connect(this, SIGNAL(EmulationStopping()), disasmWidget, SLOT(OnEmulationStopping())); @@ -496,31 +486,6 @@ void GMainWindow::OnStopGame() { ShutdownGame(); } -void GMainWindow::OnOpenHotkeysDialog() { - GHotkeysDialog dialog(this); - dialog.exec(); -} - -void GMainWindow::SetHardwareRendererEnabled(bool enabled) { - VideoCore::g_hw_renderer_enabled = enabled; - - Config config; - Settings::values.use_hw_renderer = enabled; - config.Save(); -} - -void GMainWindow::SetGdbstubEnabled(bool enabled) { - GDBStub::ToggleServer(enabled); -} - -void GMainWindow::SetShaderJITEnabled(bool enabled) { - VideoCore::g_shader_jit_enabled = enabled; - - Config config; - Settings::values.use_shader_jit = enabled; - config.Save(); -} - void GMainWindow::ToggleWindowMode() { if (ui.action_Single_Window_Mode->isChecked()) { // Render in the main window... @@ -547,7 +512,12 @@ void GMainWindow::ToggleWindowMode() { } void GMainWindow::OnConfigure() { - //GControllerConfigDialog* dialog = new GControllerConfigDialog(controller_ports, this); + ConfigureDialog configureDialog(this); + auto result = configureDialog.exec(); + if ( result == QDialog::Accepted) + { + configureDialog.applyConfiguration(); + } } bool GMainWindow::ConfirmClose() { diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 6e4e56689..7fe425b40 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -104,12 +104,8 @@ private slots: /// Called whenever a user selects the "File->Select Game List Root" menu item void OnMenuSelectGameListRoot(); void OnMenuRecentFile(); - void OnOpenHotkeysDialog(); void OnConfigure(); void OnDisplayTitleBars(bool); - void SetHardwareRendererEnabled(bool); - void SetGdbstubEnabled(bool); - void SetShaderJITEnabled(bool); void ToggleWindowMode(); private: diff --git a/src/citra_qt/main.ui b/src/citra_qt/main.ui index 1e8a07cfb..441e0b81e 100644 --- a/src/citra_qt/main.ui +++ b/src/citra_qt/main.ui @@ -45,7 +45,7 @@ 0 0 1081 - 22 + 19 @@ -73,9 +73,6 @@ - - - @@ -84,7 +81,6 @@ - @@ -150,35 +146,6 @@ Single Window Mode - - - Configure &Hotkeys ... - - - - - true - - - Use Hardware Renderer - - - - - true - - - Use Shader JIT - - - - - true - - - Use Gdbstub - - Configure ... @@ -219,22 +186,6 @@ - - action_Configure - triggered() - MainWindow - OnConfigure() - - - -1 - -1 - - - 540 - 364 - - - actionDisplay_widget_title_bars triggered(bool) diff --git a/src/citra_qt/ui_settings.cpp b/src/citra_qt/ui_settings.cpp new file mode 100644 index 000000000..5f2215899 --- /dev/null +++ b/src/citra_qt/ui_settings.cpp @@ -0,0 +1,11 @@ +// Copyright 2016 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "ui_settings.h" + +namespace UISettings { + +Values values = {}; + +} diff --git a/src/citra_qt/ui_settings.h b/src/citra_qt/ui_settings.h new file mode 100644 index 000000000..f0afbf2d3 --- /dev/null +++ b/src/citra_qt/ui_settings.h @@ -0,0 +1,16 @@ +// Copyright 2016 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#ifndef UISETTINGS_H +#define UISETTINGS_H + +namespace UISettings { + +struct Values { + bool check_closure; +} extern values; + +} + +#endif // UISETTINGS_H