yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Add Configure widget

This commit is contained in:
LittleWhite 2016-01-24 18:34:05 +01:00
parent 446d7c7e55
commit 426c4a2a5b
18 changed files with 533 additions and 142 deletions

View File

@ -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
)

109
src/citra_qt/configure.ui Normal file
View File

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigureDialog</class>
<widget class="QDialog" name="ConfigureDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>441</width>
<height>401</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>370</width>
<height>219</height>
</size>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="minimumSize">
<size>
<width>371</width>
<height>221</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="ConfigureGeneral" name="generalTab">
<attribute name="title">
<string>General</string>
</attribute>
</widget>
<widget class="QWidget" name="inputTab">
<attribute name="title">
<string>Input</string>
</attribute>
</widget>
<widget class="ConfigureDebug" name="debugTab">
<attribute name="title">
<string>Debug</string>
</attribute>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ConfigureGeneral</class>
<extends>QWidget</extends>
<header>configure_general.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ConfigureDebug</class>
<extends>QWidget</extends>
<header>configure_debug.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>ConfigureDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>220</x>
<y>380</y>
</hint>
<hint type="destinationlabel">
<x>220</x>
<y>200</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>ConfigureDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>220</x>
<y>380</y>
</hint>
<hint type="destinationlabel">
<x>220</x>
<y>200</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -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();
}

View File

@ -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 <QWidget>
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

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigureDebug</class>
<widget class="QWidget" name="ConfigureDebug">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>GDB</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="toogleGDBStub">
<property name="text">
<string>Enable GDB Stub</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="GDBPortSpinBox">
<property name="maximum">
<number>65536</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -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();
}

View File

@ -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 <QDialog>
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

View File

@ -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();
}

View File

@ -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 <QWidget>
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

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigureGeneral</class>
<widget class="QWidget" name="ConfigureGeneral">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>284</width>
<height>377</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>General</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="toogleCheckExit">
<property name="text">
<string>Confirm exit while emulation is running</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Performance</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="toogleHWRenderer">
<property name="text">
<string>Enable hardware renderer</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toogleShaderJIT">
<property name="text">
<string>Enable Shader JIT</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Hotkeys</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="GHotkeysDialog" name="widget" native="true"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>GHotkeysDialog</class>
<extends>QWidget</extends>
<header>hotkeys.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -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);

View File

@ -42,7 +42,7 @@ void SaveHotkeys(QSettings& settings);
*/
void LoadHotkeys(QSettings& settings);
class GHotkeysDialog : public QDialog
class GHotkeysDialog : public QWidget
{
Q_OBJECT

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>hotkeys</class>
<widget class="QDialog" name="hotkeys">
<widget class="QWidget" name="hotkeys">
<property name="geometry">
<rect>
<x>0</x>
@ -39,51 +39,8 @@
</column>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>hotkeys</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>hotkeys</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>

View File

@ -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<u32>(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() {

View File

@ -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:

View File

@ -45,7 +45,7 @@
<x>0</x>
<y>0</y>
<width>1081</width>
<height>22</height>
<height>19</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
@ -73,9 +73,6 @@
<addaction name="action_Pause"/>
<addaction name="action_Stop"/>
<addaction name="separator"/>
<addaction name="action_Use_Hardware_Renderer"/>
<addaction name="action_Use_Shader_JIT"/>
<addaction name="action_Use_Gdbstub"/>
<addaction name="action_Configure"/>
</widget>
<widget class="QMenu" name="menu_View">
@ -84,7 +81,6 @@
</property>
<addaction name="action_Single_Window_Mode"/>
<addaction name="actionDisplay_widget_title_bars"/>
<addaction name="action_Hotkeys"/>
</widget>
<widget class="QMenu" name="menu_Help">
<property name="title">
@ -150,35 +146,6 @@
<string>Single Window Mode</string>
</property>
</action>
<action name="action_Hotkeys">
<property name="text">
<string>Configure &amp;Hotkeys ...</string>
</property>
</action>
<action name="action_Use_Hardware_Renderer">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Use Hardware Renderer</string>
</property>
</action>
<action name="action_Use_Shader_JIT">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Use Shader JIT</string>
</property>
</action>
<action name="action_Use_Gdbstub">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Use Gdbstub</string>
</property>
</action>
<action name="action_Configure">
<property name="text">
<string>Configure ...</string>
@ -219,22 +186,6 @@
</hint>
</hints>
</connection>
<connection>
<sender>action_Configure</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>OnConfigure()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>540</x>
<y>364</y>
</hint>
</hints>
</connection>
<connection>
<sender>actionDisplay_widget_title_bars</sender>
<signal>triggered(bool)</signal>

View File

@ -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 = {};
}

View File

@ -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