1
0
Fork 0

Add more stuff to configure.

This commit is contained in:
LittleWhite 2016-01-24 21:54:04 +01:00
parent e33b938505
commit 3eb737a5f5
15 changed files with 211 additions and 120 deletions

View File

@ -82,23 +82,22 @@ void Config::ReadValues() {
qt_config->beginGroup("Paths"); qt_config->beginGroup("Paths");
UISettings::values.roms_path = qt_config->value("romsPath").toString(); UISettings::values.roms_path = qt_config->value("romsPath").toString();
UISettings::values.symbols_path = qt_config->value("symbolsPath").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.gamedir_deepscan = qt_config->value("gameListDeepScan", false).toBool();
UISettings::values.recent_files = qt_config->value("recentFiles").toStringList(); UISettings::values.recent_files = qt_config->value("recentFiles").toStringList();
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("Shortcuts"); qt_config->beginGroup("Shortcuts");
QStringList groups = qt_config->childGroups(); QStringList groups = qt_config->childGroups();
for (auto group : groups) for (auto group : groups) {
{
qt_config->beginGroup(group); qt_config->beginGroup(group);
QStringList hotkeys = qt_config->childGroups(); QStringList hotkeys = qt_config->childGroups();
for (auto hotkey : hotkeys) for (auto hotkey : hotkeys) {
{
qt_config->beginGroup(hotkey); qt_config->beginGroup(hotkey);
UISettings::values.shortcuts.push_back(UISettings::Shortcut(group + "/" + hotkey, UISettings::values.shortcuts.emplace_back(
UISettings::ContextedShortcut(qt_config->value("KeySeq").toString(), UISettings::Shortcut(group + "/" + hotkey,
UISettings::ContextualShortcut(qt_config->value("KeySeq").toString(),
qt_config->value("Context").toInt()))); qt_config->value("Context").toInt())));
qt_config->endGroup(); qt_config->endGroup();
} }
@ -109,6 +108,7 @@ void Config::ReadValues() {
UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool(); UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool();
UISettings::values.display_titlebar = qt_config->value("displayTitleBars", 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(); UISettings::values.first_start = qt_config->value("firstStart", true).toBool();
qt_config->endGroup(); qt_config->endGroup();
@ -167,14 +167,13 @@ void Config::SaveValues() {
qt_config->beginGroup("Paths"); qt_config->beginGroup("Paths");
qt_config->setValue("romsPath", UISettings::values.roms_path); qt_config->setValue("romsPath", UISettings::values.roms_path);
qt_config->setValue("symbolsPath", UISettings::values.symbols_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("gameListDeepScan", UISettings::values.gamedir_deepscan);
qt_config->setValue("recentFiles", UISettings::values.recent_files); qt_config->setValue("recentFiles", UISettings::values.recent_files);
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("Shortcuts"); 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 + "/KeySeq", shortcut.second.first);
qt_config->setValue(shortcut.first + "/Context", shortcut.second.second); 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("singleWindowMode", UISettings::values.single_window_mode);
qt_config->setValue("displayTitleBars", UISettings::values.display_titlebar); 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->setValue("firstStart", UISettings::values.first_start);
qt_config->endGroup(); qt_config->endGroup();

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>441</width> <width>441</width>
<height>401</height> <height>501</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
@ -17,7 +17,7 @@
</size> </size>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Citra Configuration</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>

View File

@ -2,13 +2,12 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "core/core.h" #include "citra_qt/configure_debug.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" #include "ui_configure_debug.h"
#include "core/gdbstub/gdbstub.h"
#include "core/settings.h"
ConfigureDebug::ConfigureDebug(QWidget *parent) : ConfigureDebug::ConfigureDebug(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::ConfigureDebug) ui(new Ui::ConfigureDebug)
@ -18,16 +17,16 @@ ConfigureDebug::ConfigureDebug(QWidget *parent) :
} }
ConfigureDebug::~ConfigureDebug() { ConfigureDebug::~ConfigureDebug() {
delete ui;
} }
void ConfigureDebug::setConfiguration() { void ConfigureDebug::setConfiguration() {
ui->toogleGDBStub->setChecked(Settings::values.use_gdbstub); ui->toogle_gdbstub->setChecked(Settings::values.use_gdbstub);
ui->GDBPortSpinBox->setValue(Settings::values.gdbstub_port); ui->gdbport_spinbox->setEnabled(Settings::values.use_gdbstub);
ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port);
} }
void ConfigureDebug::applyConfiguration() { void ConfigureDebug::applyConfiguration() {
GDBStub::ToggleServer(ui->toogleGDBStub->isChecked()); GDBStub::ToggleServer(ui->toogle_gdbstub->isChecked());
Settings::values.use_gdbstub = ui->toogleGDBStub->isChecked(); Settings::values.use_gdbstub = ui->toogle_gdbstub->isChecked();
Settings::values.gdbstub_port = ui->GDBPortSpinBox->value(); Settings::values.gdbstub_port = ui->gdbport_spinbox->value();
} }

View File

@ -2,9 +2,9 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef CONFIGURE_DEBUG_H #pragma once
#define CONFIGURE_DEBUG_H
#include <memory>
#include <QWidget> #include <QWidget>
namespace Ui { namespace Ui {
@ -16,7 +16,7 @@ class ConfigureDebug : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureDebug(QWidget *parent = 0); explicit ConfigureDebug(QWidget *parent = nullptr);
~ConfigureDebug(); ~ConfigureDebug();
void applyConfiguration(); void applyConfiguration();
@ -25,7 +25,5 @@ private:
void setConfiguration(); void setConfiguration();
private: private:
Ui::ConfigureDebug *ui; std::unique_ptr<Ui::ConfigureDebug> ui;
}; };
#endif // CONFIGURE_DEBUG_H

View File

@ -13,21 +13,19 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
<string>GDB</string> <string>GDB</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QCheckBox" name="toogleGDBStub"> <widget class="QCheckBox" name="toogle_gdbstub">
<property name="text"> <property name="text">
<string>Enable GDB Stub</string> <string>Enable GDB Stub</string>
</property> </property>
@ -54,7 +52,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QSpinBox" name="GDBPortSpinBox"> <widget class="QSpinBox" name="gdbport_spinbox">
<property name="maximum"> <property name="maximum">
<number>65536</number> <number>65536</number>
</property> </property>
@ -63,14 +61,42 @@
</layout> </layout>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections>
<connection>
<sender>toogle_gdbstub</sender>
<signal>toggled(bool)</signal>
<receiver>gdbport_spinbox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>84</x>
<y>157</y>
</hint>
<hint type="destinationlabel">
<x>342</x>
<y>158</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>

View File

@ -2,10 +2,10 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // 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 "ui_configure.h"
#include "config.h"
#include "core/settings.h" #include "core/settings.h"
@ -18,15 +18,12 @@ ConfigureDialog::ConfigureDialog(QWidget *parent) :
} }
ConfigureDialog::~ConfigureDialog() { ConfigureDialog::~ConfigureDialog() {
delete ui;
} }
void ConfigureDialog::setConfiguration() { void ConfigureDialog::setConfiguration() {
} }
void ConfigureDialog::applyConfiguration() { void ConfigureDialog::applyConfiguration() {
Config config;
ui->generalTab->applyConfiguration(); ui->generalTab->applyConfiguration();
ui->debugTab->applyConfiguration(); ui->debugTab->applyConfiguration();
config.Save();
} }

View File

@ -2,9 +2,9 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef CONFIGURE_DIALOG_H #pragma once
#define CONFIGURE_DIALOG_H
#include <memory>
#include <QDialog> #include <QDialog>
namespace Ui { namespace Ui {
@ -16,7 +16,7 @@ class ConfigureDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureDialog(QWidget *parent = 0); explicit ConfigureDialog(QWidget *parent = nullptr);
~ConfigureDialog(); ~ConfigureDialog();
void applyConfiguration(); void applyConfiguration();
@ -25,7 +25,5 @@ private:
void setConfiguration(); void setConfiguration();
private: private:
Ui::ConfigureDialog *ui; std::unique_ptr<Ui::ConfigureDialog> ui;
}; };
#endif // CONFIGURE_DIALOG_H

View File

@ -3,8 +3,8 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "citra_qt/configure_general.h" #include "citra_qt/configure_general.h"
#include "citra_qt/ui_configure_general.h"
#include "citra_qt/ui_settings.h" #include "citra_qt/ui_settings.h"
#include "ui_configure_general.h"
#include "core/settings.h" #include "core/settings.h"
@ -18,23 +18,26 @@ ConfigureGeneral::ConfigureGeneral(QWidget *parent) :
this->setConfiguration(); this->setConfiguration();
} }
ConfigureGeneral::~ConfigureGeneral() ConfigureGeneral::~ConfigureGeneral() {
{
delete ui;
} }
void ConfigureGeneral::setConfiguration() { void ConfigureGeneral::setConfiguration() {
ui->toogleCheckExit->setChecked(UISettings::values.check_closure); ui->toogle_deepscan->setChecked(UISettings::values.gamedir_deepscan);
ui->toogleHWRenderer->setChecked(Settings::values.use_hw_renderer); ui->toogle_check_exit->setChecked(UISettings::values.confirm_before_closing);
ui->toogleShaderJIT->setChecked(Settings::values.use_shader_jit); 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() { 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 = 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 = VideoCore::g_shader_jit_enabled =
Settings::values.use_shader_jit = ui->toogleShaderJIT->isChecked(); Settings::values.use_shader_jit = ui->toogle_shader_jit->isChecked();
} }

View File

@ -2,9 +2,9 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef CONFIGURE_GENERAL_H #pragma once
#define CONFIGURE_GENERAL_H
#include <memory>
#include <QWidget> #include <QWidget>
namespace Ui { namespace Ui {
@ -16,7 +16,7 @@ class ConfigureGeneral : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit ConfigureGeneral(QWidget *parent = 0); explicit ConfigureGeneral(QWidget *parent = nullptr);
~ConfigureGeneral(); ~ConfigureGeneral();
void applyConfiguration(); void applyConfiguration();
@ -25,7 +25,5 @@ private:
void setConfiguration(); void setConfiguration();
private: private:
Ui::ConfigureGeneral *ui; std::unique_ptr<Ui::ConfigureGeneral> ui;
}; };
#endif // CONFIGURE_GENERAL_H

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>284</width> <width>300</width>
<height>377</height> <height>377</height>
</rect> </rect>
</property> </property>
@ -25,7 +25,14 @@
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QCheckBox" name="toogleCheckExit"> <widget class="QCheckBox" name="toogle_deepscan">
<property name="text">
<string>Recursive scan for game folder</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toogle_check_exit">
<property name="text"> <property name="text">
<string>Confirm exit while emulation is running</string> <string>Confirm exit while emulation is running</string>
</property> </property>
@ -36,6 +43,69 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Emulation</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Region:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="region_combobox">
<item>
<property name="text">
<string notr="true">JPN</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">USA</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">EUR</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">AUS</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">CHN</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">KOR</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">TWN</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="title"> <property name="title">
@ -45,16 +115,16 @@
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<widget class="QCheckBox" name="toogleHWRenderer"> <widget class="QCheckBox" name="toogle_hw_renderer">
<property name="text"> <property name="text">
<string>Enable hardware renderer</string> <string>Enable hardware renderer</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="toogleShaderJIT"> <widget class="QCheckBox" name="toogle_shader_jit">
<property name="text"> <property name="text">
<string>Enable Shader JIT</string> <string>Enable shader JIT</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -32,8 +32,9 @@ void SaveHotkeys()
{ {
for (auto hotkey : group.second) for (auto hotkey : group.second)
{ {
UISettings::values.shortcuts.push_back(UISettings::Shortcut(group.first + "/" + hotkey.first, UISettings::values.shortcuts.emplace_back(
UISettings::ContextedShortcut(hotkey.second.keyseq.toString(), UISettings::Shortcut(group.first + "/" + hotkey.first,
UISettings::ContextualShortcut(hotkey.second.keyseq.toString(),
hotkey.second.context))); hotkey.second.context)));
} }
} }

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once
#include "ui_hotkeys.h" #include "ui_hotkeys.h"
class QDialog; class QDialog;

View File

@ -194,7 +194,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr)
show(); 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(); QStringList args = QApplication::arguments();
if (args.length() >= 2) { if (args.length() >= 2) {
@ -416,7 +416,7 @@ void GMainWindow::OnMenuLoadSymbolMap() {
void GMainWindow::OnMenuSelectGameListRoot() { void GMainWindow::OnMenuSelectGameListRoot() {
QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory")); QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory"));
if (!dir_path.isEmpty()) { if (!dir_path.isEmpty()) {
UISettings::values.gamedir_path = dir_path; UISettings::values.gamedir = dir_path;
game_list->PopulateAsync(dir_path, UISettings::values.gamedir_deepscan); game_list->PopulateAsync(dir_path, UISettings::values.gamedir_deepscan);
} }
} }
@ -491,11 +491,12 @@ void GMainWindow::OnConfigure() {
if (result == QDialog::Accepted) if (result == QDialog::Accepted)
{ {
configureDialog.applyConfiguration(); configureDialog.applyConfiguration();
config->Save();
} }
} }
bool GMainWindow::ConfirmClose() { bool GMainWindow::ConfirmClose() {
if (emu_thread == nullptr || !confirm_before_closing) if (emu_thread == nullptr || !UISettings::values.confirm_before_closing)
return true; return true;
auto answer = QMessageBox::question(this, tr("Citra"), auto answer = QMessageBox::question(this, tr("Citra"),

View File

@ -130,7 +130,6 @@ private:
GPUCommandListWidget* graphicsCommandsWidget; GPUCommandListWidget* graphicsCommandsWidget;
QAction* actions_recent_files[max_recent_files_item]; QAction* actions_recent_files[max_recent_files_item];
bool confirm_before_closing;
}; };
#endif // _CITRA_QT_MAIN_HXX_ #endif // _CITRA_QT_MAIN_HXX_

View File

@ -2,8 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#ifndef UISETTINGS_H #pragma once
#define UISETTINGS_H
#include <QByteArray> #include <QByteArray>
#include <QStringList> #include <QStringList>
@ -13,8 +12,8 @@
namespace UISettings { namespace UISettings {
typedef std::pair<QString, int> ContextedShortcut; using ContextualShortcut = std::pair<QString, int> ;
typedef std::pair<QString, ContextedShortcut> Shortcut; using Shortcut = std::pair<QString, ContextualShortcut>;
struct Values { struct Values {
QByteArray geometry; QByteArray geometry;
@ -30,19 +29,19 @@ struct Values {
bool single_window_mode; bool single_window_mode;
bool display_titlebar; bool display_titlebar;
bool check_closure; bool confirm_before_closing;
bool first_start; bool first_start;
QString roms_path; QString roms_path;
QString symbols_path; QString symbols_path;
QString gamedir_path; QString gamedir;
bool gamedir_deepscan; bool gamedir_deepscan;
QStringList recent_files; QStringList recent_files;
// Shortcut name <Shortcut, context> // Shortcut name <Shortcut, context>
std::vector<Shortcut> shortcuts; std::vector<Shortcut> shortcuts;
} extern values; };
extern Values values;
} }
#endif // UISETTINGS_H