Merge pull request #4334 from lat9nq/clear-per-game-settings

configure_per_game: Clearer per-game settings
master
bunnei 2020-07-24 19:19:27 +07:00 committed by GitHub
commit 2ed8f3f549
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 1116 additions and 869 deletions

@ -4,17 +4,20 @@
#include <QCheckBox> #include <QCheckBox>
#include <QComboBox> #include <QComboBox>
#include <QObject>
#include <QString>
#include "core/settings.h" #include "core/settings.h"
#include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_per_game.h" #include "yuzu/configuration/configure_per_game.h"
void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<bool>* setting, void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<bool>* setting,
const QCheckBox* checkbox) { const QCheckBox* checkbox,
if (checkbox->checkState() == Qt::PartiallyChecked) { const CheckState& tracker) {
if (tracker == CheckState::Global) {
setting->SetGlobal(true); setting->SetGlobal(true);
} else { } else {
setting->SetGlobal(false); setting->SetGlobal(false);
setting->SetValue(checkbox->checkState() == Qt::Checked); setting->SetValue(checkbox->checkState());
} }
} }
@ -69,8 +72,69 @@ void ConfigurationShared::SetPerGameSetting(
ConfigurationShared::USE_GLOBAL_OFFSET); ConfigurationShared::USE_GLOBAL_OFFSET);
} }
void ConfigurationShared::InsertGlobalItem(QComboBox* combobox) { void ConfigurationShared::SetHighlight(QWidget* widget, const std::string& name, bool highlighted) {
const QString use_global_text = ConfigurePerGame::tr("Use global configuration"); if (highlighted) {
widget->setStyleSheet(QStringLiteral("QWidget#%1 { background-color:rgba(0,203,255,0.5) }")
.arg(QString::fromStdString(name)));
} else {
widget->setStyleSheet(QStringLiteral("QWidget#%1 { background-color:rgba(0,0,0,0) }")
.arg(QString::fromStdString(name)));
}
widget->show();
}
void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name,
const Settings::Setting<bool>& setting,
CheckState& tracker) {
if (setting.UsingGlobal()) {
tracker = CheckState::Global;
} else {
tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off;
}
SetHighlight(checkbox, name, tracker != CheckState::Global);
QObject::connect(checkbox, &QCheckBox::clicked, checkbox,
[checkbox, name, setting, &tracker]() {
tracker = static_cast<CheckState>((static_cast<int>(tracker) + 1) %
static_cast<int>(CheckState::Count));
if (tracker == CheckState::Global) {
checkbox->setChecked(setting.GetValue(true));
}
SetHighlight(checkbox, name, tracker != CheckState::Global);
});
}
void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name,
bool global, bool state, bool global_state,
CheckState& tracker) {
if (global) {
tracker = CheckState::Global;
} else {
tracker = (state == global_state) ? CheckState::On : CheckState::Off;
}
SetHighlight(checkbox, name, tracker != CheckState::Global);
QObject::connect(checkbox, &QCheckBox::clicked, checkbox,
[checkbox, name, global_state, &tracker]() {
tracker = static_cast<CheckState>((static_cast<int>(tracker) + 1) %
static_cast<int>(CheckState::Count));
if (tracker == CheckState::Global) {
checkbox->setChecked(global_state);
}
SetHighlight(checkbox, name, tracker != CheckState::Global);
});
}
void ConfigurationShared::SetColoredComboBox(QComboBox* combobox, QWidget* target,
const std::string& target_name, int global) {
InsertGlobalItem(combobox, global);
QObject::connect(combobox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), target,
[target, target_name](int index) {
ConfigurationShared::SetHighlight(target, target_name, index != 0);
});
}
void ConfigurationShared::InsertGlobalItem(QComboBox* combobox, int global_index) {
const QString use_global_text =
ConfigurePerGame::tr("Use global configuration (%1)").arg(combobox->itemText(global_index));
combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text); combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text);
combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX); combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX);
} }

@ -15,9 +15,17 @@ constexpr int USE_GLOBAL_INDEX = 0;
constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1; constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1;
constexpr int USE_GLOBAL_OFFSET = 2; constexpr int USE_GLOBAL_OFFSET = 2;
enum class CheckState {
Off,
On,
Global,
Count,
};
// Global-aware apply and set functions // Global-aware apply and set functions
void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox); void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox,
const CheckState& tracker);
void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox); void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox);
void ApplyPerGameSetting(Settings::Setting<Settings::RendererBackend>* setting, void ApplyPerGameSetting(Settings::Setting<Settings::RendererBackend>* setting,
const QComboBox* combobox); const QComboBox* combobox);
@ -31,6 +39,14 @@ void SetPerGameSetting(QComboBox* combobox,
void SetPerGameSetting(QComboBox* combobox, void SetPerGameSetting(QComboBox* combobox,
const Settings::Setting<Settings::GPUAccuracy>* setting); const Settings::Setting<Settings::GPUAccuracy>* setting);
void InsertGlobalItem(QComboBox* combobox); void SetHighlight(QWidget* widget, const std::string& name, bool highlighted);
void SetColoredTristate(QCheckBox* checkbox, const std::string& name,
const Settings::Setting<bool>& setting, CheckState& tracker);
void SetColoredTristate(QCheckBox* checkbox, const std::string& name, bool global, bool state,
bool global_state, CheckState& tracker);
void SetColoredComboBox(QComboBox* combobox, QWidget* target, const std::string& target_name,
int global);
void InsertGlobalItem(QComboBox* combobox, int global_index);
} // namespace ConfigurationShared } // namespace ConfigurationShared

@ -49,12 +49,9 @@ void ConfigureAudio::SetConfiguration() {
ui->volume_slider->setValue(Settings::values.volume.GetValue() * ui->volume_slider->maximum()); ui->volume_slider->setValue(Settings::values.volume.GetValue() * ui->volume_slider->maximum());
if (Settings::configuring_global) { ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching.GetValue());
ui->toggle_audio_stretching->setChecked(
Settings::values.enable_audio_stretching.GetValue()); if (!Settings::configuring_global) {
} else {
ConfigurationShared::SetPerGameSetting(ui->toggle_audio_stretching,
&Settings::values.enable_audio_stretching);
if (Settings::values.volume.UsingGlobal()) { if (Settings::values.volume.UsingGlobal()) {
ui->volume_combo_box->setCurrentIndex(0); ui->volume_combo_box->setCurrentIndex(0);
ui->volume_slider->setEnabled(false); ui->volume_slider->setEnabled(false);
@ -62,6 +59,8 @@ void ConfigureAudio::SetConfiguration() {
ui->volume_combo_box->setCurrentIndex(1); ui->volume_combo_box->setCurrentIndex(1);
ui->volume_slider->setEnabled(true); ui->volume_slider->setEnabled(true);
} }
ConfigurationShared::SetHighlight(ui->volume_layout, "volume_layout",
!Settings::values.volume.UsingGlobal());
} }
SetVolumeIndicatorText(ui->volume_slider->sliderPosition()); SetVolumeIndicatorText(ui->volume_slider->sliderPosition());
} }
@ -120,7 +119,8 @@ void ConfigureAudio::ApplyConfiguration() {
} }
} else { } else {
ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching, ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching,
ui->toggle_audio_stretching); ui->toggle_audio_stretching,
enable_audio_stretching);
if (ui->volume_combo_box->currentIndex() == 0) { if (ui->volume_combo_box->currentIndex() == 0) {
Settings::values.volume.SetGlobal(true); Settings::values.volume.SetGlobal(true);
} else { } else {
@ -173,9 +173,14 @@ void ConfigureAudio::SetupPerGameUI() {
return; return;
} }
ui->toggle_audio_stretching->setTristate(true); ConfigurationShared::SetColoredTristate(ui->toggle_audio_stretching, "toggle_audio_stretching",
Settings::values.enable_audio_stretching,
enable_audio_stretching);
connect(ui->volume_combo_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), connect(ui->volume_combo_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
this, [this](int index) { ui->volume_slider->setEnabled(index == 1); }); this, [this](int index) {
ui->volume_slider->setEnabled(index == 1);
ConfigurationShared::SetHighlight(ui->volume_layout, "volume_layout", index == 1);
});
ui->output_sink_combo_box->setVisible(false); ui->output_sink_combo_box->setVisible(false);
ui->output_sink_label->setVisible(false); ui->output_sink_label->setVisible(false);

@ -7,6 +7,10 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
namespace ConfigurationShared {
enum class CheckState;
}
namespace Ui { namespace Ui {
class ConfigureAudio; class ConfigureAudio;
} }
@ -37,4 +41,6 @@ private:
void SetupPerGameUI(); void SetupPerGameUI();
std::unique_ptr<Ui::ConfigureAudio> ui; std::unique_ptr<Ui::ConfigureAudio> ui;
ConfigurationShared::CheckState enable_audio_stretching;
}; };

@ -56,80 +56,91 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <widget class="QWidget" name="volume_layout" native="true">
<property name="topMargin"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<number>0</number> <property name="leftMargin">
</property> <number>0</number>
<item> </property>
<widget class="QComboBox" name="volume_combo_box"> <property name="topMargin">
<item> <number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="volume_combo_box">
<item>
<property name="text">
<string>Use global volume</string>
</property>
</item>
<item>
<property name="text">
<string>Set volume:</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="volume_label">
<property name="text"> <property name="text">
<string>Use global volume</string> <string>Volume:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="volume_slider">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="volume_indicator">
<property name="minimumSize">
<size>
<width>32</width>
<height>0</height>
</size>
</property> </property>
</item>
<item>
<property name="text"> <property name="text">
<string>Set volume:</string> <string>0 %</string>
</property> </property>
</item> <property name="alignment">
</widget> <set>Qt::AlignCenter</set>
</item> </property>
<item> </widget>
<widget class="QLabel" name="volume_label"> </item>
<property name="text"> </layout>
<string>Volume:</string> </widget>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="volume_slider">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="volume_indicator">
<property name="minimumSize">
<size>
<width>32</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>0 %</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>

@ -19,9 +19,10 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
SetConfiguration(); SetConfiguration();
connect(ui->toggle_frame_limit, &QCheckBox::stateChanged, ui->frame_limit, [this]() { if (Settings::configuring_global) {
ui->frame_limit->setEnabled(ui->toggle_frame_limit->checkState() == Qt::Checked); connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit,
}); [this]() { ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked()); });
}
} }
ConfigureGeneral::~ConfigureGeneral() = default; ConfigureGeneral::~ConfigureGeneral() = default;
@ -40,17 +41,12 @@ void ConfigureGeneral::SetConfiguration() {
ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue()); ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue());
ui->frame_limit->setValue(Settings::values.frame_limit.GetValue()); ui->frame_limit->setValue(Settings::values.frame_limit.GetValue());
if (!Settings::configuring_global) { if (Settings::configuring_global) {
if (Settings::values.use_multi_core.UsingGlobal()) { ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue());
ui->use_multi_core->setCheckState(Qt::PartiallyChecked); } else {
} ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue() &&
if (Settings::values.use_frame_limit.UsingGlobal()) { use_frame_limit != ConfigurationShared::CheckState::Global);
ui->toggle_frame_limit->setCheckState(Qt::PartiallyChecked);
}
} }
ui->frame_limit->setEnabled(ui->toggle_frame_limit->checkState() == Qt::Checked &&
ui->toggle_frame_limit->isEnabled());
} }
void ConfigureGeneral::ApplyConfiguration() { void ConfigureGeneral::ApplyConfiguration() {
@ -71,9 +67,9 @@ void ConfigureGeneral::ApplyConfiguration() {
} }
} else { } else {
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core,
ui->use_multi_core); ui->use_multi_core, use_multi_core);
bool global_frame_limit = ui->toggle_frame_limit->checkState() == Qt::PartiallyChecked; bool global_frame_limit = use_frame_limit == ConfigurationShared::CheckState::Global;
Settings::values.use_frame_limit.SetGlobal(global_frame_limit); Settings::values.use_frame_limit.SetGlobal(global_frame_limit);
Settings::values.frame_limit.SetGlobal(global_frame_limit); Settings::values.frame_limit.SetGlobal(global_frame_limit);
if (!global_frame_limit) { if (!global_frame_limit) {
@ -109,6 +105,13 @@ void ConfigureGeneral::SetupPerGameUI() {
ui->toggle_background_pause->setVisible(false); ui->toggle_background_pause->setVisible(false);
ui->toggle_hide_mouse->setVisible(false); ui->toggle_hide_mouse->setVisible(false);
ui->toggle_frame_limit->setTristate(true); ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, "toggle_frame_limit",
ui->use_multi_core->setTristate(true); Settings::values.use_frame_limit, use_frame_limit);
ConfigurationShared::SetColoredTristate(ui->use_multi_core, "use_multi_core",
Settings::values.use_multi_core, use_multi_core);
connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() {
ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked() &&
(use_frame_limit != ConfigurationShared::CheckState::Global));
});
} }

@ -7,6 +7,10 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
namespace ConfigurationShared {
enum class CheckState;
}
class HotkeyRegistry; class HotkeyRegistry;
namespace Ui { namespace Ui {
@ -31,4 +35,7 @@ private:
void SetupPerGameUI(); void SetupPerGameUI();
std::unique_ptr<Ui::ConfigureGeneral> ui; std::unique_ptr<Ui::ConfigureGeneral> ui;
ConfigurationShared::CheckState use_frame_limit;
ConfigurationShared::CheckState use_multi_core;
}; };

@ -31,8 +31,14 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
SetConfiguration(); SetConfiguration();
connect(ui->api, qOverload<int>(&QComboBox::currentIndexChanged), this, connect(ui->api, qOverload<int>(&QComboBox::currentIndexChanged), this, [this] {
[this] { UpdateDeviceComboBox(); }); UpdateDeviceComboBox();
if (!Settings::configuring_global) {
ConfigurationShared::SetHighlight(ui->api_layout, "api_layout",
ui->api->currentIndex() !=
ConfigurationShared::USE_GLOBAL_INDEX);
}
});
connect(ui->device, qOverload<int>(&QComboBox::activated), this, connect(ui->device, qOverload<int>(&QComboBox::activated), this,
[this](int device) { UpdateDeviceSelection(device); }); [this](int device) { UpdateDeviceSelection(device); });
@ -65,25 +71,26 @@ void ConfigureGraphics::SetConfiguration() {
ui->api->setEnabled(runtime_lock); ui->api->setEnabled(runtime_lock);
ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock); ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock);
ui->use_disk_shader_cache->setEnabled(runtime_lock); ui->use_disk_shader_cache->setEnabled(runtime_lock);
ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue());
ui->use_asynchronous_gpu_emulation->setChecked(
Settings::values.use_asynchronous_gpu_emulation.GetValue());
if (Settings::configuring_global) { if (Settings::configuring_global) {
ui->api->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend.GetValue())); ui->api->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend.GetValue()));
ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue());
ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue());
ui->use_asynchronous_gpu_emulation->setChecked(
Settings::values.use_asynchronous_gpu_emulation.GetValue());
} else { } else {
ConfigurationShared::SetPerGameSetting(ui->use_disk_shader_cache,
&Settings::values.use_disk_shader_cache);
ConfigurationShared::SetPerGameSetting(ui->use_asynchronous_gpu_emulation,
&Settings::values.use_asynchronous_gpu_emulation);
ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend); ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend);
ConfigurationShared::SetHighlight(ui->api_layout, "api_layout",
!Settings::values.renderer_backend.UsingGlobal());
ConfigurationShared::SetPerGameSetting(ui->aspect_ratio_combobox, ConfigurationShared::SetPerGameSetting(ui->aspect_ratio_combobox,
&Settings::values.aspect_ratio); &Settings::values.aspect_ratio);
ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1); ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1);
ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal()); ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal());
ConfigurationShared::SetHighlight(ui->ar_label, "ar_label",
!Settings::values.aspect_ratio.UsingGlobal());
ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout",
!Settings::values.bg_red.UsingGlobal());
} }
UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(), UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(),
@ -135,9 +142,10 @@ void ConfigureGraphics::ApplyConfiguration() {
ui->aspect_ratio_combobox); ui->aspect_ratio_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache, ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache,
ui->use_disk_shader_cache); ui->use_disk_shader_cache, use_disk_shader_cache);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation, ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation,
ui->use_asynchronous_gpu_emulation); ui->use_asynchronous_gpu_emulation,
use_asynchronous_gpu_emulation);
if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
Settings::values.bg_red.SetGlobal(true); Settings::values.bg_red.SetGlobal(true);
@ -241,10 +249,20 @@ void ConfigureGraphics::SetupPerGameUI() {
} }
connect(ui->bg_combobox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, connect(ui->bg_combobox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this,
[this](int index) { ui->bg_button->setEnabled(index == 1); }); [this](int index) {
ui->bg_button->setEnabled(index == 1);
ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout", index == 1);
});
ui->use_disk_shader_cache->setTristate(true); ConfigurationShared::SetColoredTristate(ui->use_disk_shader_cache, "use_disk_shader_cache",
ui->use_asynchronous_gpu_emulation->setTristate(true); Settings::values.use_disk_shader_cache,
ConfigurationShared::InsertGlobalItem(ui->aspect_ratio_combobox); use_disk_shader_cache);
ConfigurationShared::InsertGlobalItem(ui->api); ConfigurationShared::SetColoredTristate(
ui->use_asynchronous_gpu_emulation, "use_asynchronous_gpu_emulation",
Settings::values.use_asynchronous_gpu_emulation, use_asynchronous_gpu_emulation);
ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, "ar_label",
Settings::values.aspect_ratio.GetValue(true));
ConfigurationShared::InsertGlobalItem(
ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true)));
} }

@ -10,6 +10,10 @@
#include <QWidget> #include <QWidget>
#include "core/settings.h" #include "core/settings.h"
namespace ConfigurationShared {
enum class CheckState;
}
namespace Ui { namespace Ui {
class ConfigureGraphics; class ConfigureGraphics;
} }
@ -42,6 +46,9 @@ private:
std::unique_ptr<Ui::ConfigureGraphics> ui; std::unique_ptr<Ui::ConfigureGraphics> ui;
QColor bg_color; QColor bg_color;
ConfigurationShared::CheckState use_disk_shader_cache;
ConfigurationShared::CheckState use_asynchronous_gpu_emulation;
std::vector<QString> vulkan_devices; std::vector<QString> vulkan_devices;
u32 vulkan_device{}; u32 vulkan_device{};
}; };

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>437</width>
<height>321</height> <height>321</height>
</rect> </rect>
</property> </property>
@ -23,43 +23,56 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <widget class="QWidget" name="api_layout" native="true">
<item> <layout class="QGridLayout" name="gridLayout">
<widget class="QLabel" name="label_2"> <property name="leftMargin">
<property name="text"> <number>0</number>
<string>API:</string> </property>
</property> <property name="topMargin">
</widget> <number>0</number>
</item> </property>
<item> <property name="rightMargin">
<widget class="QComboBox" name="api"> <number>0</number>
<item> </property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="api_label">
<property name="text"> <property name="text">
<string notr="true">OpenGL</string> <string>API:</string>
</property> </property>
</item> </widget>
<item> </item>
<item row="0" column="1">
<widget class="QComboBox" name="api">
<item>
<property name="text">
<string notr="true">OpenGL</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">Vulkan</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="device_label">
<property name="text"> <property name="text">
<string notr="true">Vulkan</string> <string>Device:</string>
</property> </property>
</item> </widget>
</widget> </item>
</item> <item row="1" column="1">
</layout> <widget class="QComboBox" name="device"/>
</item> </item>
<item> </layout>
<layout class="QHBoxLayout" name="horizontalLayout_5"> </widget>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Device:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="device"/>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -85,96 +98,133 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <widget class="QWidget" name="aspect_ratio_layout" native="true">
<item> <layout class="QHBoxLayout" name="horizontalLayout_6">
<widget class="QLabel" name="ar_label"> <property name="leftMargin">
<property name="text"> <number>0</number>
<string>Aspect Ratio:</string> </property>
</property> <property name="topMargin">
</widget> <number>0</number>
</item> </property>
<item> <property name="rightMargin">
<widget class="QComboBox" name="aspect_ratio_combobox"> <number>0</number>
<item> </property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="ar_label">
<property name="text"> <property name="text">
<string>Default (16:9)</string> <string>Aspect Ratio:</string>
</property> </property>
</item> </widget>
<item> </item>
<property name="text"> <item>
<string>Force 4:3</string> <widget class="QComboBox" name="aspect_ratio_combobox">
</property> <item>
</item> <property name="text">
<item> <string>Default (16:9)</string>
<property name="text"> </property>
<string>Force 21:9</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Force 4:3</string>
<property name="text"> </property>
<string>Stretch to Window</string> </item>
</property> <item>
</item> <property name="text">
</widget> <string>Force 21:9</string>
</item> </property>
</layout> </item>
<item>
<property name="text">
<string>Stretch to Window</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <widget class="QWidget" name="bg_layout" native="true">
<item> <property name="sizePolicy">
<widget class="QComboBox" name="bg_combobox"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<property name="currentText"> <horstretch>0</horstretch>
<string>Use global background color</string> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="currentIndex"> </property>
<number>0</number> <layout class="QHBoxLayout" name="horizontalLayout_3">
</property> <property name="spacing">
<property name="maxVisibleItems"> <number>6</number>
<number>10</number> </property>
</property> <property name="leftMargin">
<item> <number>0</number>
<property name="text"> </property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="bg_combobox">
<property name="currentText">
<string>Use global background color</string> <string>Use global background color</string>
</property> </property>
</item> <property name="currentIndex">
<item> <number>0</number>
<property name="text">
<string>Set background color:</string>
</property> </property>
</item> <property name="maxVisibleItems">
</widget> <number>10</number>
</item> </property>
<item> <item>
<widget class="QLabel" name="bg_label"> <property name="text">
<property name="text"> <string>Use global background color</string>
<string>Background Color:</string> </property>
</property> </item>
</widget> <item>
</item> <property name="text">
<item> <string>Set background color:</string>
<spacer name="horizontalSpacer"> </property>
<property name="orientation"> </item>
<enum>Qt::Horizontal</enum> </widget>
</property> </item>
<property name="sizeHint" stdset="0"> <item>
<size> <widget class="QLabel" name="bg_label">
<width>40</width> <property name="text">
<height>20</height> <string>Background Color:</string>
</size> </property>
</property> </widget>
</spacer> </item>
</item> <item>
<item> <spacer name="horizontalSpacer">
<widget class="QPushButton" name="bg_button"> <property name="orientation">
<property name="maximumSize"> <enum>Qt::Horizontal</enum>
<size> </property>
<width>40</width> <property name="sizeHint" stdset="0">
<height>16777215</height> <size>
</size> <width>40</width>
</property> <height>20</height>
</widget> </size>
</item> </property>
</layout> </spacer>
</item>
<item>
<widget class="QPushButton" name="bg_button">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>

@ -28,32 +28,25 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
ui->force_30fps_mode->setEnabled(runtime_lock); ui->force_30fps_mode->setEnabled(runtime_lock);
ui->anisotropic_filtering_combobox->setEnabled(runtime_lock); ui->anisotropic_filtering_combobox->setEnabled(runtime_lock);
ui->use_vsync->setChecked(Settings::values.use_vsync.GetValue());
ui->use_assembly_shaders->setChecked(Settings::values.use_assembly_shaders.GetValue());
ui->use_asynchronous_shaders->setChecked(Settings::values.use_asynchronous_shaders.GetValue());
ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue());
ui->force_30fps_mode->setChecked(Settings::values.force_30fps_mode.GetValue());
if (Settings::configuring_global) { if (Settings::configuring_global) {
ui->gpu_accuracy->setCurrentIndex( ui->gpu_accuracy->setCurrentIndex(
static_cast<int>(Settings::values.gpu_accuracy.GetValue())); static_cast<int>(Settings::values.gpu_accuracy.GetValue()));
ui->use_vsync->setChecked(Settings::values.use_vsync.GetValue());
ui->use_assembly_shaders->setChecked(Settings::values.use_assembly_shaders.GetValue());
ui->use_asynchronous_shaders->setChecked(
Settings::values.use_asynchronous_shaders.GetValue());
ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue());
ui->force_30fps_mode->setChecked(Settings::values.force_30fps_mode.GetValue());
ui->anisotropic_filtering_combobox->setCurrentIndex( ui->anisotropic_filtering_combobox->setCurrentIndex(
Settings::values.max_anisotropy.GetValue()); Settings::values.max_anisotropy.GetValue());
} else { } else {
ConfigurationShared::SetPerGameSetting(ui->gpu_accuracy, &Settings::values.gpu_accuracy); ConfigurationShared::SetPerGameSetting(ui->gpu_accuracy, &Settings::values.gpu_accuracy);
ConfigurationShared::SetPerGameSetting(ui->use_vsync, &Settings::values.use_vsync);
ConfigurationShared::SetPerGameSetting(ui->use_assembly_shaders,
&Settings::values.use_assembly_shaders);
ConfigurationShared::SetPerGameSetting(ui->use_asynchronous_shaders,
&Settings::values.use_asynchronous_shaders);
ConfigurationShared::SetPerGameSetting(ui->use_asynchronous_shaders,
&Settings::values.use_asynchronous_shaders);
ConfigurationShared::SetPerGameSetting(ui->use_fast_gpu_time,
&Settings::values.use_fast_gpu_time);
ConfigurationShared::SetPerGameSetting(ui->force_30fps_mode,
&Settings::values.force_30fps_mode);
ConfigurationShared::SetPerGameSetting(ui->anisotropic_filtering_combobox, ConfigurationShared::SetPerGameSetting(ui->anisotropic_filtering_combobox,
&Settings::values.max_anisotropy); &Settings::values.max_anisotropy);
ConfigurationShared::SetHighlight(ui->label_gpu_accuracy, "label_gpu_accuracy",
!Settings::values.gpu_accuracy.UsingGlobal());
ConfigurationShared::SetHighlight(ui->af_label, "af_label",
!Settings::values.max_anisotropy.UsingGlobal());
} }
} }
@ -95,17 +88,17 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() {
} else { } else {
ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy,
ui->anisotropic_filtering_combobox); ui->anisotropic_filtering_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync,
use_vsync);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_assembly_shaders, ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_assembly_shaders,
ui->use_assembly_shaders); ui->use_assembly_shaders, use_assembly_shaders);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders,
ui->use_asynchronous_shaders); ui->use_asynchronous_shaders,
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, use_asynchronous_shaders);
ui->use_asynchronous_shaders);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time, ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time,
ui->use_fast_gpu_time); ui->use_fast_gpu_time, use_fast_gpu_time);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.force_30fps_mode, ConfigurationShared::ApplyPerGameSetting(&Settings::values.force_30fps_mode,
ui->force_30fps_mode); ui->force_30fps_mode, force_30fps_mode);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy,
ui->anisotropic_filtering_combobox); ui->anisotropic_filtering_combobox);
@ -146,11 +139,22 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() {
return; return;
} }
ConfigurationShared::InsertGlobalItem(ui->gpu_accuracy); ConfigurationShared::SetColoredTristate(ui->use_vsync, "use_vsync", Settings::values.use_vsync,
ui->use_vsync->setTristate(true); use_vsync);
ui->use_assembly_shaders->setTristate(true); ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_assembly_shaders",
ui->use_asynchronous_shaders->setTristate(true); Settings::values.use_assembly_shaders,
ui->use_fast_gpu_time->setTristate(true); use_assembly_shaders);
ui->force_30fps_mode->setTristate(true); ConfigurationShared::SetColoredTristate(
ConfigurationShared::InsertGlobalItem(ui->anisotropic_filtering_combobox); ui->use_asynchronous_shaders, "use_asynchronous_shaders",
Settings::values.use_asynchronous_shaders, use_asynchronous_shaders);
ConfigurationShared::SetColoredTristate(ui->use_fast_gpu_time, "use_fast_gpu_time",
Settings::values.use_fast_gpu_time, use_fast_gpu_time);
ConfigurationShared::SetColoredTristate(ui->force_30fps_mode, "force_30fps_mode",
Settings::values.force_30fps_mode, force_30fps_mode);
ConfigurationShared::SetColoredComboBox(
ui->gpu_accuracy, ui->label_gpu_accuracy, "label_gpu_accuracy",
static_cast<int>(Settings::values.gpu_accuracy.GetValue(true)));
ConfigurationShared::SetColoredComboBox(
ui->anisotropic_filtering_combobox, ui->af_label, "af_label",
static_cast<int>(Settings::values.max_anisotropy.GetValue(true)));
} }

@ -7,6 +7,10 @@
#include <memory> #include <memory>
#include <QWidget> #include <QWidget>
namespace ConfigurationShared {
enum class CheckState;
}
namespace Ui { namespace Ui {
class ConfigureGraphicsAdvanced; class ConfigureGraphicsAdvanced;
} }
@ -29,4 +33,10 @@ private:
void SetupPerGameUI(); void SetupPerGameUI();
std::unique_ptr<Ui::ConfigureGraphicsAdvanced> ui; std::unique_ptr<Ui::ConfigureGraphicsAdvanced> ui;
ConfigurationShared::CheckState use_vsync;
ConfigurationShared::CheckState use_assembly_shaders;
ConfigurationShared::CheckState use_asynchronous_shaders;
ConfigurationShared::CheckState use_fast_gpu_time;
ConfigurationShared::CheckState force_30fps_mode;
}; };

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>404</width>
<height>321</height> <height>321</height>
</rect> </rect>
</property> </property>
@ -23,34 +23,48 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <widget class="QWidget" name="gpu_accuracy_layout" native="true">
<item> <layout class="QHBoxLayout" name="horizontalLayout_2">
<widget class="QLabel" name="label_gpu_accuracy"> <property name="leftMargin">
<property name="text"> <number>0</number>
<string>Accuracy Level:</string> </property>
</property> <property name="topMargin">
</widget> <number>0</number>
</item> </property>
<item> <property name="rightMargin">
<widget class="QComboBox" name="gpu_accuracy"> <number>0</number>
<item> </property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_gpu_accuracy">
<property name="text"> <property name="text">
<string notr="true">Normal</string> <string>Accuracy Level:</string>
</property> </property>
</item> </widget>
<item> </item>
<property name="text"> <item>
<string notr="true">High</string> <widget class="QComboBox" name="gpu_accuracy">
</property> <item>
</item> <property name="text">
<item> <string notr="true">Normal</string>
<property name="text"> </property>
<string notr="true">Extreme(very slow)</string> </item>
</property> <item>
</item> <property name="text">
</widget> <string notr="true">High</string>
</item> </property>
</layout> </item>
<item>
<property name="text">
<string notr="true">Extreme(very slow)</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="use_vsync"> <widget class="QCheckBox" name="use_vsync">
@ -97,44 +111,58 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_1"> <widget class="QWidget" name="af_layout" native="true">
<item> <layout class="QHBoxLayout" name="horizontalLayout_1">
<widget class="QLabel" name="af_label"> <property name="leftMargin">
<property name="text"> <number>0</number>
<string>Anisotropic Filtering:</string> </property>
</property> <property name="topMargin">
</widget> <number>0</number>
</item> </property>
<item> <property name="rightMargin">
<widget class="QComboBox" name="anisotropic_filtering_combobox"> <number>0</number>
<item> </property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="af_label">
<property name="text"> <property name="text">
<string>Default</string> <string>Anisotropic Filtering:</string>
</property> </property>
</item> </widget>
<item> </item>
<property name="text"> <item>
<string>2x</string> <widget class="QComboBox" name="anisotropic_filtering_combobox">
</property> <item>
</item> <property name="text">
<item> <string>Default</string>
<property name="text"> </property>
<string>4x</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>2x</string>
<property name="text"> </property>
<string>8x</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>4x</string>
<property name="text"> </property>
<string>16x</string> </item>
</property> <item>
</item> <property name="text">
</widget> <string>8x</string>
</item> </property>
</layout> </item>
<item>
<property name="text">
<string>16x</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>

@ -67,21 +67,21 @@ void ConfigureSystem::SetConfiguration() {
const auto rtc_time = Settings::values.custom_rtc.GetValue().value_or( const auto rtc_time = Settings::values.custom_rtc.GetValue().value_or(
std::chrono::seconds(QDateTime::currentSecsSinceEpoch())); std::chrono::seconds(QDateTime::currentSecsSinceEpoch()));
ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value());
ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value() &&
Settings::values.rng_seed.UsingGlobal());
ui->rng_seed_edit->setText(rng_seed);
ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.GetValue().has_value());
ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value() &&
Settings::values.rng_seed.UsingGlobal());
ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count()));
if (Settings::configuring_global) { if (Settings::configuring_global) {
ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue()); ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue());
ui->combo_region->setCurrentIndex(Settings::values.region_index.GetValue()); ui->combo_region->setCurrentIndex(Settings::values.region_index.GetValue());
ui->combo_time_zone->setCurrentIndex(Settings::values.time_zone_index.GetValue()); ui->combo_time_zone->setCurrentIndex(Settings::values.time_zone_index.GetValue());
ui->combo_sound->setCurrentIndex(Settings::values.sound_index.GetValue()); ui->combo_sound->setCurrentIndex(Settings::values.sound_index.GetValue());
ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value());
ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value() &&
Settings::values.rng_seed.UsingGlobal());
ui->rng_seed_edit->setText(rng_seed);
ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.GetValue().has_value());
ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value() &&
Settings::values.rng_seed.UsingGlobal());
ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count()));
} else { } else {
ConfigurationShared::SetPerGameSetting(ui->combo_language, ConfigurationShared::SetPerGameSetting(ui->combo_language,
&Settings::values.language_index); &Settings::values.language_index);
@ -90,27 +90,14 @@ void ConfigureSystem::SetConfiguration() {
&Settings::values.time_zone_index); &Settings::values.time_zone_index);
ConfigurationShared::SetPerGameSetting(ui->combo_sound, &Settings::values.sound_index); ConfigurationShared::SetPerGameSetting(ui->combo_sound, &Settings::values.sound_index);
if (Settings::values.rng_seed.UsingGlobal()) { ConfigurationShared::SetHighlight(ui->label_language, "label_language",
ui->rng_seed_checkbox->setCheckState(Qt::PartiallyChecked); !Settings::values.language_index.UsingGlobal());
} else { ConfigurationShared::SetHighlight(ui->label_region, "label_region",
ui->rng_seed_checkbox->setCheckState( !Settings::values.region_index.UsingGlobal());
Settings::values.rng_seed.GetValue().has_value() ? Qt::Checked : Qt::Unchecked); ConfigurationShared::SetHighlight(ui->label_timezone, "label_timezone",
ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value()); !Settings::values.time_zone_index.UsingGlobal());
if (Settings::values.rng_seed.GetValue().has_value()) { ConfigurationShared::SetHighlight(ui->label_sound, "label_sound",
ui->rng_seed_edit->setText(rng_seed); !Settings::values.sound_index.UsingGlobal());
}
}
if (Settings::values.custom_rtc.UsingGlobal()) {
ui->custom_rtc_checkbox->setCheckState(Qt::PartiallyChecked);
} else {
ui->custom_rtc_checkbox->setCheckState(
Settings::values.custom_rtc.GetValue().has_value() ? Qt::Checked : Qt::Unchecked);
ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value());
if (Settings::values.custom_rtc.GetValue().has_value()) {
ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count()));
}
}
} }
} }
@ -161,37 +148,44 @@ void ConfigureSystem::ApplyConfiguration() {
ui->combo_time_zone); ui->combo_time_zone);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound); ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound);
switch (ui->rng_seed_checkbox->checkState()) { switch (use_rng_seed) {
case Qt::Checked: case ConfigurationShared::CheckState::On:
case ConfigurationShared::CheckState::Off:
Settings::values.rng_seed.SetGlobal(false); Settings::values.rng_seed.SetGlobal(false);
Settings::values.rng_seed.SetValue(ui->rng_seed_edit->text().toULongLong(nullptr, 16)); if (ui->rng_seed_checkbox->isChecked()) {
Settings::values.rng_seed.SetValue(
ui->rng_seed_edit->text().toULongLong(nullptr, 16));
} else {
Settings::values.rng_seed.SetValue(std::nullopt);
}
break; break;
case Qt::Unchecked: case ConfigurationShared::CheckState::Global:
Settings::values.rng_seed.SetGlobal(false);
Settings::values.rng_seed.SetValue(std::nullopt);
break;
case Qt::PartiallyChecked:
Settings::values.rng_seed.SetGlobal(false); Settings::values.rng_seed.SetGlobal(false);
Settings::values.rng_seed.SetValue(std::nullopt); Settings::values.rng_seed.SetValue(std::nullopt);
Settings::values.rng_seed.SetGlobal(true); Settings::values.rng_seed.SetGlobal(true);
break; break;
case ConfigurationShared::CheckState::Count:
break;
} }
switch (ui->custom_rtc_checkbox->checkState()) { switch (use_custom_rtc) {
case Qt::Checked: case ConfigurationShared::CheckState::On:
case ConfigurationShared::CheckState::Off:
Settings::values.custom_rtc.SetGlobal(false); Settings::values.custom_rtc.SetGlobal(false);
Settings::values.custom_rtc.SetValue( if (ui->custom_rtc_checkbox->isChecked()) {
std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch())); Settings::values.custom_rtc.SetValue(
std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch()));
} else {
Settings::values.custom_rtc.SetValue(std::nullopt);
}
break; break;
case Qt::Unchecked: case ConfigurationShared::CheckState::Global:
Settings::values.custom_rtc.SetGlobal(false);
Settings::values.custom_rtc.SetValue(std::nullopt);
break;
case Qt::PartiallyChecked:
Settings::values.custom_rtc.SetGlobal(false); Settings::values.custom_rtc.SetGlobal(false);
Settings::values.custom_rtc.SetValue(std::nullopt); Settings::values.custom_rtc.SetValue(std::nullopt);
Settings::values.custom_rtc.SetGlobal(true); Settings::values.custom_rtc.SetGlobal(true);
break; break;
case ConfigurationShared::CheckState::Count:
break;
} }
} }
@ -229,10 +223,23 @@ void ConfigureSystem::SetupPerGameUI() {
return; return;
} }
ConfigurationShared::InsertGlobalItem(ui->combo_language); ConfigurationShared::SetColoredComboBox(ui->combo_language, ui->label_language,
ConfigurationShared::InsertGlobalItem(ui->combo_region); "label_language",
ConfigurationShared::InsertGlobalItem(ui->combo_time_zone); Settings::values.language_index.GetValue(true));
ConfigurationShared::InsertGlobalItem(ui->combo_sound); ConfigurationShared::SetColoredComboBox(ui->combo_region, ui->label_region, "label_region",
ui->rng_seed_checkbox->setTristate(true); Settings::values.region_index.GetValue(true));
ui->custom_rtc_checkbox->setTristate(true); ConfigurationShared::SetColoredComboBox(ui->combo_time_zone, ui->label_timezone,
"label_timezone",
Settings::values.time_zone_index.GetValue(true));
ConfigurationShared::SetColoredComboBox(ui->combo_sound, ui->label_sound, "label_sound",
Settings::values.sound_index.GetValue(true));
ConfigurationShared::SetColoredTristate(
ui->rng_seed_checkbox, "rng_seed_checkbox", Settings::values.rng_seed.UsingGlobal(),
Settings::values.rng_seed.GetValue().has_value(),
Settings::values.rng_seed.GetValue(true).has_value(), use_rng_seed);
ConfigurationShared::SetColoredTristate(
ui->custom_rtc_checkbox, "custom_rtc_checkbox", Settings::values.custom_rtc.UsingGlobal(),
Settings::values.custom_rtc.GetValue().has_value(),
Settings::values.custom_rtc.GetValue(true).has_value(), use_custom_rtc);
} }

@ -9,6 +9,10 @@
#include <QList> #include <QList>
#include <QWidget> #include <QWidget>
namespace ConfigurationShared {
enum class CheckState;
}
namespace Ui { namespace Ui {
class ConfigureSystem; class ConfigureSystem;
} }
@ -41,4 +45,7 @@ private:
int region_index = 0; int region_index = 0;
int time_zone_index = 0; int time_zone_index = 0;
int sound_index = 0; int sound_index = 0;
ConfigurationShared::CheckState use_rng_seed;
ConfigurationShared::CheckState use_custom_rtc;
}; };

@ -21,490 +21,494 @@
<property name="title"> <property name="title">
<string>System Settings</string> <string>System Settings</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item row="3" column="0"> <item>
<widget class="QLabel" name="label_sound"> <layout class="QGridLayout" name="gridLayout_2">
<property name="text"> <item row="1" column="0">
<string>Sound output mode</string> <widget class="QLabel" name="label_region">
</property> <property name="text">
</widget> <string>Region:</string>
</item> </property>
<item row="4" column="0"> </widget>
<widget class="QLabel" name="label_console_id"> </item>
<property name="text"> <item row="2" column="1">
<string>Console ID:</string> <widget class="QComboBox" name="combo_time_zone">
</property> <item>
</widget> <property name="text">
</item> <string>Auto</string>
<item row="0" column="1"> </property>
<widget class="QComboBox" name="combo_language"> </item>
<property name="toolTip"> <item>
<string>Note: this can be overridden when region setting is auto-select</string> <property name="text">
</property> <string>Default</string>
<item> </property>
<property name="text"> </item>
<string>Japanese (日本語)</string> <item>
</property> <property name="text">
</item> <string>CET</string>
<item> </property>
<property name="text"> </item>
<string>English</string> <item>
</property> <property name="text">
</item> <string>CST6CDT</string>
<item> </property>
<property name="text"> </item>
<string>French (français)</string> <item>
</property> <property name="text">
</item> <string>Cuba</string>
<item> </property>
<property name="text"> </item>
<string>German (Deutsch)</string> <item>
</property> <property name="text">
</item> <string>EET</string>
<item> </property>
<property name="text"> </item>
<string>Italian (italiano)</string> <item>
</property> <property name="text">
</item> <string>Egypt</string>
<item> </property>
<property name="text"> </item>
<string>Spanish (español)</string> <item>
</property> <property name="text">
</item> <string>Eire</string>
<item> </property>
<property name="text"> </item>
<string>Chinese</string> <item>
</property> <property name="text">
</item> <string>EST</string>
<item> </property>
<property name="text"> </item>
<string>Korean (한국어)</string> <item>
</property> <property name="text">
</item> <string>EST5EDT</string>
<item> </property>
<property name="text"> </item>
<string>Dutch (Nederlands)</string> <item>
</property> <property name="text">
</item> <string>GB</string>
<item> </property>
<property name="text"> </item>
<string>Portuguese (português)</string> <item>
</property> <property name="text">
</item> <string>GB-Eire</string>
<item> </property>
<property name="text"> </item>
<string>Russian (Русский)</string> <item>
</property> <property name="text">
</item> <string>GMT</string>
<item> </property>
<property name="text"> </item>
<string>Taiwanese</string> <item>
</property> <property name="text">
</item> <string>GMT+0</string>
<item> </property>
<property name="text"> </item>
<string>British English</string> <item>
</property> <property name="text">
</item> <string>GMT-0</string>
<item> </property>
<property name="text"> </item>
<string>Canadian French</string> <item>
</property> <property name="text">
</item> <string>GMT0</string>
<item> </property>
<property name="text"> </item>
<string>Latin American Spanish</string> <item>
</property> <property name="text">
</item> <string>Greenwich</string>
<item> </property>
<property name="text"> </item>
<string>Simplified Chinese</string> <item>
</property> <property name="text">
</item> <string>Hongkong</string>
<item> </property>
<property name="text"> </item>
<string>Traditional Chinese (正體中文)</string> <item>
</property> <property name="text">
</item> <string>HST</string>
</widget> </property>
</item> </item>
<item row="1" column="0"> <item>
<widget class="QLabel" name="label_region"> <property name="text">
<property name="text"> <string>Iceland</string>
<string>Region:</string> </property>
</property> </item>
</widget> <item>
</item> <property name="text">
<item row="1" column="1"> <string>Iran</string>
<widget class="QComboBox" name="combo_region"> </property>
<item> </item>
<property name="text"> <item>
<string>Japan</string> <property name="text">
</property> <string>Israel</string>
</item> </property>
<item> </item>
<property name="text"> <item>
<string>USA</string> <property name="text">
</property> <string>Jamaica</string>
</item> </property>
<item> </item>
<property name="text"> <item>
<string>Europe</string> <property name="text">
</property> <string>Japan</string>
</item> </property>
<item> </item>
<property name="text"> <item>
<string>Australia</string> <property name="text">
</property> <string>Kwajalein</string>
</item> </property>
<item> </item>
<property name="text"> <item>
<string>China</string> <property name="text">
</property> <string>Libya</string>
</item> </property>
<item> </item>
<property name="text"> <item>
<string>Korea</string> <property name="text">
</property> <string>MET</string>
</item> </property>
<item> </item>
<property name="text"> <item>
<string>Taiwan</string> <property name="text">
</property> <string>MST</string>
</item> </property>
</widget> </item>
</item> <item>
<item row="2" column="0"> <property name="text">
<widget class="QLabel" name="label_timezone"> <string>MST7MDT</string>
<property name="text"> </property>
<string>Time Zone:</string> </item>
</property> <item>
</widget> <property name="text">
</item> <string>Navajo</string>
<item row="2" column="1"> </property>
<widget class="QComboBox" name="combo_time_zone"> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Auto</string> <string>NZ</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Default</string> <string>NZ-CHAT</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>CET</string> <string>Poland</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>CST6CDT</string> <string>Portugal</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Cuba</string> <string>PRC</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>EET</string> <string>PST8PDT</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Egypt</string> <string>ROC</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Eire</string> <string>ROK</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>EST</string> <string>Singapore</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>EST5EDT</string> <string>Turkey</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>GB</string> <string>UCT</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>GB-Eire</string> <string>Universal</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>GMT</string> <string>UTC</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>GMT+0</string> <string>W-SU</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>GMT-0</string> <string>WET</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>GMT0</string> <string>Zulu</string>
</property> </property>
</item> </item>
<item> </widget>
<property name="text"> </item>
<string>Greenwich</string> <item row="1" column="1">
</property> <widget class="QComboBox" name="combo_region">
</item> <item>
<item> <property name="text">
<property name="text"> <string>Japan</string>
<string>Hongkong</string> </property>
</property> </item>
</item> <item>
<item> <property name="text">
<property name="text"> <string>USA</string>
<string>HST</string> </property>
</property> </item>
</item> <item>
<item> <property name="text">
<property name="text"> <string>Europe</string>
<string>Iceland</string> </property>
</property> </item>
</item> <item>
<item> <property name="text">
<property name="text"> <string>Australia</string>
<string>Iran</string> </property>
</property> </item>
</item> <item>
<item> <property name="text">
<property name="text"> <string>China</string>
<string>Israel</string> </property>
</property> </item>
</item> <item>
<item> <property name="text">
<property name="text"> <string>Korea</string>
<string>Jamaica</string> </property>
</property> </item>
</item> <item>
<item> <property name="text">
<property name="text"> <string>Taiwan</string>
<string>Japan</string> </property>
</property> </item>
</item> </widget>
<item> </item>
<property name="text"> <item row="2" column="0">
<string>Kwajalein</string> <widget class="QLabel" name="label_timezone">
</property> <property name="text">
</item> <string>Time Zone:</string>
<item> </property>
<property name="text"> </widget>
<string>Libya</string> </item>
</property> <item row="0" column="1">
</item> <widget class="QComboBox" name="combo_language">
<item> <property name="toolTip">
<property name="text"> <string>Note: this can be overridden when region setting is auto-select</string>
<string>MET</string> </property>
</property> <item>
</item> <property name="text">
<item> <string>Japanese (日本語)</string>
<property name="text"> </property>
<string>MST</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>English</string>
<property name="text"> </property>
<string>MST7MDT</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>French (français)</string>
<property name="text"> </property>
<string>Navajo</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>German (Deutsch)</string>
<property name="text"> </property>
<string>NZ</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Italian (italiano)</string>
<property name="text"> </property>
<string>NZ-CHAT</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Spanish (español)</string>
<property name="text"> </property>
<string>Poland</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Chinese</string>
<property name="text"> </property>
<string>Portugal</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Korean (한국어)</string>
<property name="text"> </property>
<string>PRC</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Dutch (Nederlands)</string>
<property name="text"> </property>
<string>PST8PDT</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Portuguese (português)</string>
<property name="text"> </property>
<string>ROC</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Russian (Русский)</string>
<property name="text"> </property>
<string>ROK</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Taiwanese</string>
<property name="text"> </property>
<string>Singapore</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>British English</string>
<property name="text"> </property>
<string>Turkey</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Canadian French</string>
<property name="text"> </property>
<string>UCT</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Latin American Spanish</string>
<property name="text"> </property>
<string>Universal</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Simplified Chinese</string>
<property name="text"> </property>
<string>UTC</string> </item>
</property> <item>
</item> <property name="text">
<item> <string>Traditional Chinese (正體中文)</string>
<property name="text"> </property>
<string>W-SU</string> </item>
</property> </widget>
</item> </item>
<item> <item row="5" column="0">
<property name="text"> <widget class="QCheckBox" name="custom_rtc_checkbox">
<string>WET</string> <property name="text">
</property> <string>Custom RTC</string>
</item> </property>
<item> </widget>
<property name="text"> </item>
<string>Zulu</string> <item row="0" column="0">
</property> <widget class="QLabel" name="label_language">
</item> <property name="text">
</widget> <string>Language</string>
</item> </property>
<item row="6" column="0"> </widget>
<widget class="QCheckBox" name="rng_seed_checkbox"> </item>
<property name="text"> <item row="6" column="0">
<string>RNG Seed</string> <widget class="QCheckBox" name="rng_seed_checkbox">
</property> <property name="text">
</widget> <string>RNG Seed</string>
</item> </property>
<item row="3" column="1"> </widget>
<widget class="QComboBox" name="combo_sound"> </item>
<item> <item row="3" column="1">
<property name="text"> <widget class="QComboBox" name="combo_sound">
<string>Mono</string> <item>
</property> <property name="text">
</item> <string>Mono</string>
<item> </property>
<property name="text"> </item>
<string>Stereo</string> <item>
</property> <property name="text">
</item> <string>Stereo</string>
<item> </property>
<property name="text"> </item>
<string>Surround</string> <item>
</property> <property name="text">
</item> <string>Surround</string>
</widget> </property>
</item> </item>
<item row="0" column="0"> </widget>
<widget class="QLabel" name="label_language"> </item>
<property name="text"> <item row="4" column="0">
<string>Language</string> <widget class="QLabel" name="label_console_id">
</property> <property name="text">
</widget> <string>Console ID:</string>
</item> </property>
<item row="4" column="1"> </widget>
<widget class="QPushButton" name="button_regenerate_console_id"> </item>
<property name="sizePolicy"> <item row="3" column="0">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <widget class="QLabel" name="label_sound">
<horstretch>0</horstretch> <property name="text">
<verstretch>0</verstretch> <string>Sound output mode</string>
</sizepolicy> </property>
</property> </widget>
<property name="layoutDirection"> </item>
<enum>Qt::RightToLeft</enum> <item row="5" column="1">
</property> <widget class="QDateTimeEdit" name="custom_rtc_edit">
<property name="text"> <property name="minimumDate">
<string>Regenerate</string> <date>
</property> <year>1970</year>
</widget> <month>1</month>
</item> <day>1</day>
<item row="5" column="0"> </date>
<widget class="QCheckBox" name="custom_rtc_checkbox"> </property>
<property name="text"> <property name="displayFormat">
<string>Custom RTC</string> <string>d MMM yyyy h:mm:ss AP</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="6" column="1">
<widget class="QDateTimeEdit" name="custom_rtc_edit"> <widget class="QLineEdit" name="rng_seed_edit">
<property name="minimumDate"> <property name="sizePolicy">
<date> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<year>1970</year> <horstretch>0</horstretch>
<month>1</month> <verstretch>0</verstretch>
<day>1</day> </sizepolicy>
</date> </property>
</property> <property name="font">
<property name="displayFormat"> <font>
<string>d MMM yyyy h:mm:ss AP</string> <family>Lucida Console</family>
</property> </font>
</widget> </property>
</item> <property name="inputMask">
<item row="6" column="1"> <string notr="true">HHHHHHHH</string>
<widget class="QLineEdit" name="rng_seed_edit"> </property>
<property name="sizePolicy"> <property name="maxLength">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <number>8</number>
<horstretch>0</horstretch> </property>
<verstretch>0</verstretch> </widget>
</sizepolicy> </item>
</property> <item row="4" column="1">
<property name="font"> <widget class="QPushButton" name="button_regenerate_console_id">
<font> <property name="sizePolicy">
<family>Lucida Console</family> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
</font> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
<property name="inputMask"> </sizepolicy>
<string notr="true">HHHHHHHH</string> </property>
</property> <property name="layoutDirection">
<property name="maxLength"> <enum>Qt::RightToLeft</enum>
<number>8</number> </property>
</property> <property name="text">
</widget> <string>Regenerate</string>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>