yuzu-emu
/
yuzu-android
Archived
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");
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(),
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();

View File

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

View File

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

View File

@ -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 <memory>
#include <QWidget>
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::ConfigureDebug> ui;
};
#endif // CONFIGURE_DEBUG_H

View File

@ -13,21 +13,19 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<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">
<widget class="QCheckBox" name="toogle_gdbstub">
<property name="text">
<string>Enable GDB Stub</string>
</property>
@ -54,7 +52,7 @@
</widget>
</item>
<item>
<widget class="QSpinBox" name="GDBPortSpinBox">
<widget class="QSpinBox" name="gdbport_spinbox">
<property name="maximum">
<number>65536</number>
</property>
@ -63,14 +61,42 @@
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</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>
</widget>
<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>

View File

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

View File

@ -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 <memory>
#include <QDialog>
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::ConfigureDialog> ui;
};
#endif // CONFIGURE_DIALOG_H

View File

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

View File

@ -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 <memory>
#include <QWidget>
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::ConfigureGeneral> ui;
};
#endif // CONFIGURE_GENERAL_H

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>284</width>
<width>300</width>
<height>377</height>
</rect>
</property>
@ -25,7 +25,14 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<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">
<string>Confirm exit while emulation is running</string>
</property>
@ -36,6 +43,69 @@
</layout>
</widget>
</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>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
@ -45,16 +115,16 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="toogleHWRenderer">
<widget class="QCheckBox" name="toogle_hw_renderer">
<property name="text">
<string>Enable hardware renderer</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toogleShaderJIT">
<widget class="QCheckBox" name="toogle_shader_jit">
<property name="text">
<string>Enable Shader JIT</string>
<string>Enable shader JIT</string>
</property>
</widget>
</item>

View File

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

View File

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

View File

@ -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);
}
}
@ -491,11 +491,12 @@ void GMainWindow::OnConfigure() {
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"),

View File

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

View File

@ -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 <QByteArray>
#include <QStringList>
@ -13,8 +12,8 @@
namespace UISettings {
typedef std::pair<QString, int> ContextedShortcut;
typedef std::pair<QString, ContextedShortcut> Shortcut;
using ContextualShortcut = std::pair<QString, int> ;
using Shortcut = std::pair<QString, ContextualShortcut>;
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 <Shortcut, context>
std::vector<Shortcut> shortcuts;
} extern values;
};
extern Values values;
}
#endif // UISETTINGS_H