configuration: Use a mapping of setting value to name
Makes comboboxes always correspond to the value of the setting they're modifying.
This commit is contained in:
parent
86ed82cdde
commit
c5a3642cb6
@ -15,12 +15,13 @@
|
|||||||
#include "yuzu/configuration/shared_widget.h"
|
#include "yuzu/configuration/shared_widget.h"
|
||||||
#include "yuzu/uisettings.h"
|
#include "yuzu/uisettings.h"
|
||||||
|
|
||||||
ConfigureAudio::ConfigureAudio(const Core::System& system_,
|
ConfigureAudio::ConfigureAudio(
|
||||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
const Core::System& system_,
|
||||||
const ConfigurationShared::TranslationMap& translations_,
|
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||||
QWidget* parent)
|
const ConfigurationShared::TranslationMap& translations_,
|
||||||
: Tab(group, parent),
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent)
|
||||||
ui(std::make_unique<Ui::ConfigureAudio>()), system{system_}, translations{translations_} {
|
: Tab(group, parent), ui(std::make_unique<Ui::ConfigureAudio>()), system{system_},
|
||||||
|
translations{translations_}, combobox_translations{combobox_translations_} {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
Setup();
|
Setup();
|
||||||
|
|
||||||
@ -48,18 +49,18 @@ void ConfigureAudio::Setup() {
|
|||||||
auto* widget = [&]() {
|
auto* widget = [&]() {
|
||||||
if (setting->Id() == Settings::values.volume.Id()) {
|
if (setting->Id() == Settings::values.volume.Id()) {
|
||||||
return new ConfigurationShared::Widget(
|
return new ConfigurationShared::Widget(
|
||||||
setting, translations, this, runtime_lock, apply_funcs,
|
setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
|
||||||
ConfigurationShared::RequestType::Slider, true, 1.0f, nullptr,
|
ConfigurationShared::RequestType::Slider, true, 1.0f, nullptr,
|
||||||
tr("%1%", "Volume percentage (e.g. 50%)"));
|
tr("%1%", "Volume percentage (e.g. 50%)"));
|
||||||
} else if (setting->Id() == Settings::values.audio_output_device_id.Id() ||
|
} else if (setting->Id() == Settings::values.audio_output_device_id.Id() ||
|
||||||
setting->Id() == Settings::values.audio_input_device_id.Id() ||
|
setting->Id() == Settings::values.audio_input_device_id.Id() ||
|
||||||
setting->Id() == Settings::values.sink_id.Id()) {
|
setting->Id() == Settings::values.sink_id.Id()) {
|
||||||
return new ConfigurationShared::Widget(
|
return new ConfigurationShared::Widget(
|
||||||
setting, translations, this, runtime_lock, apply_funcs,
|
setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
|
||||||
ConfigurationShared::RequestType::ComboBox, false);
|
ConfigurationShared::RequestType::ComboBox, false);
|
||||||
} else {
|
} else {
|
||||||
return new ConfigurationShared::Widget(setting, translations, this, runtime_lock,
|
return new ConfigurationShared::Widget(setting, translations, combobox_translations,
|
||||||
apply_funcs);
|
this, runtime_lock, apply_funcs);
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
@ -22,10 +22,12 @@ class ConfigureAudio;
|
|||||||
|
|
||||||
class ConfigureAudio : public ConfigurationShared::Tab {
|
class ConfigureAudio : public ConfigurationShared::Tab {
|
||||||
public:
|
public:
|
||||||
explicit ConfigureAudio(const Core::System& system_,
|
explicit ConfigureAudio(
|
||||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
const Core::System& system_,
|
||||||
const ConfigurationShared::TranslationMap& translations_,
|
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||||
QWidget* parent = nullptr);
|
const ConfigurationShared::TranslationMap& translations_,
|
||||||
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_,
|
||||||
|
QWidget* parent = nullptr);
|
||||||
~ConfigureAudio() override;
|
~ConfigureAudio() override;
|
||||||
|
|
||||||
void ApplyConfiguration() override;
|
void ApplyConfiguration() override;
|
||||||
@ -49,6 +51,7 @@ private:
|
|||||||
|
|
||||||
const Core::System& system;
|
const Core::System& system;
|
||||||
const ConfigurationShared::TranslationMap& translations;
|
const ConfigurationShared::TranslationMap& translations;
|
||||||
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations;
|
||||||
|
|
||||||
std::forward_list<std::function<void(bool)>> apply_funcs{};
|
std::forward_list<std::function<void(bool)>> apply_funcs{};
|
||||||
|
|
||||||
|
@ -34,21 +34,25 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_,
|
|||||||
: QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()},
|
: QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()},
|
||||||
registry(registry_), system{system_},
|
registry(registry_), system{system_},
|
||||||
translations{ConfigurationShared::InitializeTranslations(this)},
|
translations{ConfigurationShared::InitializeTranslations(this)},
|
||||||
audio_tab{std::make_unique<ConfigureAudio>(system_, nullptr, *translations, this)},
|
combobox_translations{ConfigurationShared::ComboboxEnumeration(this)},
|
||||||
|
audio_tab{std::make_unique<ConfigureAudio>(system_, nullptr, *translations,
|
||||||
|
*combobox_translations, this)},
|
||||||
cpu_tab{std::make_unique<ConfigureCpu>(system_, nullptr, this)},
|
cpu_tab{std::make_unique<ConfigureCpu>(system_, nullptr, this)},
|
||||||
debug_tab_tab{std::make_unique<ConfigureDebugTab>(system_, this)},
|
debug_tab_tab{std::make_unique<ConfigureDebugTab>(system_, this)},
|
||||||
filesystem_tab{std::make_unique<ConfigureFilesystem>(this)},
|
filesystem_tab{std::make_unique<ConfigureFilesystem>(this)},
|
||||||
general_tab{std::make_unique<ConfigureGeneral>(system_, nullptr, *translations, this)},
|
general_tab{std::make_unique<ConfigureGeneral>(system_, nullptr, *translations,
|
||||||
graphics_advanced_tab{
|
*combobox_translations, this)},
|
||||||
std::make_unique<ConfigureGraphicsAdvanced>(system_, nullptr, *translations, this)},
|
graphics_advanced_tab{std::make_unique<ConfigureGraphicsAdvanced>(
|
||||||
|
system_, nullptr, *translations, *combobox_translations, this)},
|
||||||
graphics_tab{std::make_unique<ConfigureGraphics>(
|
graphics_tab{std::make_unique<ConfigureGraphics>(
|
||||||
system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); },
|
system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); },
|
||||||
nullptr, *translations, this)},
|
nullptr, *translations, *combobox_translations, this)},
|
||||||
hotkeys_tab{std::make_unique<ConfigureHotkeys>(system_.HIDCore(), this)},
|
hotkeys_tab{std::make_unique<ConfigureHotkeys>(system_.HIDCore(), this)},
|
||||||
input_tab{std::make_unique<ConfigureInput>(system_, this)},
|
input_tab{std::make_unique<ConfigureInput>(system_, this)},
|
||||||
network_tab{std::make_unique<ConfigureNetwork>(system_, this)},
|
network_tab{std::make_unique<ConfigureNetwork>(system_, this)},
|
||||||
profile_tab{std::make_unique<ConfigureProfileManager>(system_, this)},
|
profile_tab{std::make_unique<ConfigureProfileManager>(system_, this)},
|
||||||
system_tab{std::make_unique<ConfigureSystem>(system_, nullptr, *translations, this)},
|
system_tab{std::make_unique<ConfigureSystem>(system_, nullptr, *translations,
|
||||||
|
*combobox_translations, this)},
|
||||||
ui_tab{std::make_unique<ConfigureUi>(system_, this)}, web_tab{std::make_unique<ConfigureWeb>(
|
ui_tab{std::make_unique<ConfigureUi>(system_, this)}, web_tab{std::make_unique<ConfigureWeb>(
|
||||||
this)} {
|
this)} {
|
||||||
Settings::SetConfiguringGlobal(true);
|
Settings::SetConfiguringGlobal(true);
|
||||||
|
@ -72,6 +72,7 @@ private:
|
|||||||
|
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
std::unique_ptr<ConfigurationShared::TranslationMap> translations;
|
std::unique_ptr<ConfigurationShared::TranslationMap> translations;
|
||||||
|
std::unique_ptr<ConfigurationShared::ComboboxTranslationMap> combobox_translations;
|
||||||
std::forward_list<ConfigurationShared::Tab*> tab_group;
|
std::forward_list<ConfigurationShared::Tab*> tab_group;
|
||||||
|
|
||||||
std::unique_ptr<ConfigureAudio> audio_tab;
|
std::unique_ptr<ConfigureAudio> audio_tab;
|
||||||
|
@ -15,9 +15,10 @@
|
|||||||
ConfigureGeneral::ConfigureGeneral(
|
ConfigureGeneral::ConfigureGeneral(
|
||||||
const Core::System& system_,
|
const Core::System& system_,
|
||||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||||
const ConfigurationShared::TranslationMap& translations_, QWidget* parent)
|
const ConfigurationShared::TranslationMap& translations_,
|
||||||
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent)
|
||||||
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureGeneral>()}, system{system_},
|
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureGeneral>()}, system{system_},
|
||||||
translations{translations_} {
|
translations{translations_}, combobox_translations{combobox_translations_} {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
SetConfiguration();
|
SetConfiguration();
|
||||||
@ -40,8 +41,8 @@ void ConfigureGeneral::SetConfiguration() {
|
|||||||
|
|
||||||
for (const auto setting :
|
for (const auto setting :
|
||||||
UISettings::values.linkage.by_category[Settings::Category::UiGeneral]) {
|
UISettings::values.linkage.by_category[Settings::Category::UiGeneral]) {
|
||||||
auto* widget =
|
auto* widget = new ConfigurationShared::Widget(setting, translations, combobox_translations,
|
||||||
new ConfigurationShared::Widget(setting, translations, this, runtime_lock, apply_funcs);
|
this, runtime_lock, apply_funcs);
|
||||||
|
|
||||||
if (!widget->Valid()) {
|
if (!widget->Valid()) {
|
||||||
delete widget;
|
delete widget;
|
||||||
|
@ -22,10 +22,12 @@ class ConfigureGeneral;
|
|||||||
|
|
||||||
class ConfigureGeneral : public ConfigurationShared::Tab {
|
class ConfigureGeneral : public ConfigurationShared::Tab {
|
||||||
public:
|
public:
|
||||||
explicit ConfigureGeneral(const Core::System& system_,
|
explicit ConfigureGeneral(
|
||||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
const Core::System& system_,
|
||||||
const ConfigurationShared::TranslationMap& translations_,
|
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||||
QWidget* parent = nullptr);
|
const ConfigurationShared::TranslationMap& translations_,
|
||||||
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_,
|
||||||
|
QWidget* parent = nullptr);
|
||||||
~ConfigureGeneral() override;
|
~ConfigureGeneral() override;
|
||||||
|
|
||||||
void SetResetCallback(std::function<void()> callback);
|
void SetResetCallback(std::function<void()> callback);
|
||||||
@ -45,4 +47,5 @@ private:
|
|||||||
|
|
||||||
const Core::System& system;
|
const Core::System& system;
|
||||||
const ConfigurationShared::TranslationMap& translations;
|
const ConfigurationShared::TranslationMap& translations;
|
||||||
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations;
|
||||||
};
|
};
|
||||||
|
@ -79,10 +79,12 @@ ConfigureGraphics::ConfigureGraphics(
|
|||||||
const Core::System& system_, std::vector<VkDeviceInfo::Record>& records_,
|
const Core::System& system_, std::vector<VkDeviceInfo::Record>& records_,
|
||||||
const std::function<void()>& expose_compute_option_,
|
const std::function<void()>& expose_compute_option_,
|
||||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||||
const ConfigurationShared::TranslationMap& translations_, QWidget* parent)
|
const ConfigurationShared::TranslationMap& translations_,
|
||||||
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent)
|
||||||
: ConfigurationShared::Tab(group, parent), ui{std::make_unique<Ui::ConfigureGraphics>()},
|
: ConfigurationShared::Tab(group, parent), ui{std::make_unique<Ui::ConfigureGraphics>()},
|
||||||
records{records_}, expose_compute_option{expose_compute_option_}, system{system_},
|
records{records_}, expose_compute_option{expose_compute_option_}, system{system_},
|
||||||
translations{translations_} {
|
translations{translations_}, combobox_translations{combobox_translations_},
|
||||||
|
shader_mapping{combobox_translations.at(typeid(Settings::ShaderBackend))} {
|
||||||
vulkan_device = Settings::values.vulkan_device.GetValue();
|
vulkan_device = Settings::values.vulkan_device.GetValue();
|
||||||
RetrieveVulkanDevices();
|
RetrieveVulkanDevices();
|
||||||
|
|
||||||
@ -235,22 +237,22 @@ void ConfigureGraphics::Setup() {
|
|||||||
setting->Id() == Settings::values.shader_backend.Id() ||
|
setting->Id() == Settings::values.shader_backend.Id() ||
|
||||||
setting->Id() == Settings::values.vsync_mode.Id()) {
|
setting->Id() == Settings::values.vsync_mode.Id()) {
|
||||||
return new ConfigurationShared::Widget(
|
return new ConfigurationShared::Widget(
|
||||||
setting, translations, this, runtime_lock, apply_funcs,
|
setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
|
||||||
ConfigurationShared::RequestType::ComboBox, false);
|
ConfigurationShared::RequestType::ComboBox, false);
|
||||||
} else if (setting->Id() == Settings::values.fsr_sharpening_slider.Id()) {
|
} else if (setting->Id() == Settings::values.fsr_sharpening_slider.Id()) {
|
||||||
return new ConfigurationShared::Widget(
|
return new ConfigurationShared::Widget(
|
||||||
setting, translations, this, runtime_lock, apply_funcs,
|
setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
|
||||||
ConfigurationShared::RequestType::ReverseSlider, true, 0.5f, nullptr,
|
ConfigurationShared::RequestType::ReverseSlider, true, 0.5f, nullptr,
|
||||||
tr("%1%", "FSR sharpening percentage (e.g. 50%)"));
|
tr("%1%", "FSR sharpening percentage (e.g. 50%)"));
|
||||||
} else if (setting->Id() == Settings::values.speed_limit.Id()) {
|
} else if (setting->Id() == Settings::values.speed_limit.Id()) {
|
||||||
return new ConfigurationShared::Widget(
|
return new ConfigurationShared::Widget(
|
||||||
setting, translations, this, runtime_lock, apply_funcs,
|
setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
|
||||||
ConfigurationShared::RequestType::SpinBox, true, 1.0f,
|
ConfigurationShared::RequestType::SpinBox, true, 1.0f,
|
||||||
&Settings::values.use_speed_limit,
|
&Settings::values.use_speed_limit,
|
||||||
tr("%", "Limit speed percentage (e.g. 50%)"));
|
tr("%", "Limit speed percentage (e.g. 50%)"));
|
||||||
} else {
|
} else {
|
||||||
return new ConfigurationShared::Widget(setting, translations, this, runtime_lock,
|
return new ConfigurationShared::Widget(setting, translations, combobox_translations,
|
||||||
apply_funcs);
|
this, runtime_lock, apply_funcs);
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
|
|
||||||
@ -360,6 +362,15 @@ const QString ConfigureGraphics::TranslateVSyncMode(VkPresentModeKHR mode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ConfigureGraphics::FindIndex(std::type_index enumeration, int value) const {
|
||||||
|
for (u32 i = 0; i < combobox_translations.at(enumeration).size(); i++) {
|
||||||
|
if (combobox_translations.at(enumeration)[i].first == static_cast<u32>(value)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigureGraphics::ApplyConfiguration() {
|
void ConfigureGraphics::ApplyConfiguration() {
|
||||||
const bool powered_on = system.IsPoweredOn();
|
const bool powered_on = system.IsPoweredOn();
|
||||||
for (const auto& func : apply_funcs) {
|
for (const auto& func : apply_funcs) {
|
||||||
@ -374,13 +385,17 @@ void ConfigureGraphics::ApplyConfiguration() {
|
|||||||
|
|
||||||
Settings::values.shader_backend.SetGlobal(true);
|
Settings::values.shader_backend.SetGlobal(true);
|
||||||
Settings::values.vulkan_device.SetGlobal(true);
|
Settings::values.vulkan_device.SetGlobal(true);
|
||||||
if (!Settings::IsConfiguringGlobal() && api_restore_global_button->isEnabled()) {
|
if (Settings::IsConfiguringGlobal() ||
|
||||||
auto backend = static_cast<Settings::RendererBackend>(api_combobox->currentIndex());
|
(!Settings::IsConfiguringGlobal() && api_restore_global_button->isEnabled())) {
|
||||||
|
auto backend = static_cast<Settings::RendererBackend>(
|
||||||
|
combobox_translations
|
||||||
|
.at(typeid(Settings::RendererBackend))[api_combobox->currentIndex()]
|
||||||
|
.first);
|
||||||
switch (backend) {
|
switch (backend) {
|
||||||
case Settings::RendererBackend::OpenGL:
|
case Settings::RendererBackend::OpenGL:
|
||||||
Settings::values.shader_backend.SetGlobal(false);
|
Settings::values.shader_backend.SetGlobal(false);
|
||||||
Settings::values.shader_backend.SetValue(
|
Settings::values.shader_backend.SetValue(static_cast<Settings::ShaderBackend>(
|
||||||
static_cast<Settings::ShaderBackend>(shader_backend_combobox->currentIndex()));
|
shader_mapping[shader_backend_combobox->currentIndex()].first));
|
||||||
break;
|
break;
|
||||||
case Settings::RendererBackend::Vulkan:
|
case Settings::RendererBackend::Vulkan:
|
||||||
Settings::values.vulkan_device.SetGlobal(false);
|
Settings::values.vulkan_device.SetGlobal(false);
|
||||||
@ -430,7 +445,8 @@ void ConfigureGraphics::UpdateAPILayout() {
|
|||||||
|
|
||||||
switch (GetCurrentGraphicsBackend()) {
|
switch (GetCurrentGraphicsBackend()) {
|
||||||
case Settings::RendererBackend::OpenGL:
|
case Settings::RendererBackend::OpenGL:
|
||||||
shader_backend_combobox->setCurrentIndex(static_cast<u32>(shader_backend));
|
shader_backend_combobox->setCurrentIndex(
|
||||||
|
FindIndex(typeid(Settings::ShaderBackend), static_cast<int>(shader_backend)));
|
||||||
vulkan_device_widget->setVisible(false);
|
vulkan_device_widget->setVisible(false);
|
||||||
shader_backend_widget->setVisible(true);
|
shader_backend_widget->setVisible(true);
|
||||||
break;
|
break;
|
||||||
@ -467,5 +483,8 @@ Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const {
|
|||||||
if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) {
|
if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) {
|
||||||
return Settings::values.renderer_backend.GetValue(true);
|
return Settings::values.renderer_backend.GetValue(true);
|
||||||
}
|
}
|
||||||
return static_cast<Settings::RendererBackend>(api_combobox->currentIndex());
|
return static_cast<Settings::RendererBackend>(
|
||||||
|
combobox_translations.at(typeid(Settings::RendererBackend))
|
||||||
|
.at(api_combobox->currentIndex())
|
||||||
|
.first);
|
||||||
}
|
}
|
||||||
|
@ -36,12 +36,13 @@ class ConfigureGraphics;
|
|||||||
|
|
||||||
class ConfigureGraphics : public ConfigurationShared::Tab {
|
class ConfigureGraphics : public ConfigurationShared::Tab {
|
||||||
public:
|
public:
|
||||||
explicit ConfigureGraphics(const Core::System& system_,
|
explicit ConfigureGraphics(
|
||||||
std::vector<VkDeviceInfo::Record>& records,
|
const Core::System& system_, std::vector<VkDeviceInfo::Record>& records,
|
||||||
const std::function<void()>& expose_compute_option_,
|
const std::function<void()>& expose_compute_option_,
|
||||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||||
const ConfigurationShared::TranslationMap& translations_,
|
const ConfigurationShared::TranslationMap& translations_,
|
||||||
QWidget* parent = nullptr);
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_,
|
||||||
|
QWidget* parent = nullptr);
|
||||||
~ConfigureGraphics() override;
|
~ConfigureGraphics() override;
|
||||||
|
|
||||||
void ApplyConfiguration() override;
|
void ApplyConfiguration() override;
|
||||||
@ -68,6 +69,8 @@ private:
|
|||||||
|
|
||||||
Settings::RendererBackend GetCurrentGraphicsBackend() const;
|
Settings::RendererBackend GetCurrentGraphicsBackend() const;
|
||||||
|
|
||||||
|
int FindIndex(std::type_index enumeration, int value) const;
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureGraphics> ui;
|
std::unique_ptr<Ui::ConfigureGraphics> ui;
|
||||||
QColor bg_color;
|
QColor bg_color;
|
||||||
|
|
||||||
@ -85,6 +88,8 @@ private:
|
|||||||
|
|
||||||
const Core::System& system;
|
const Core::System& system;
|
||||||
const ConfigurationShared::TranslationMap& translations;
|
const ConfigurationShared::TranslationMap& translations;
|
||||||
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations;
|
||||||
|
const std::vector<std::pair<u32, QString>>& shader_mapping;
|
||||||
|
|
||||||
QPushButton* api_restore_global_button;
|
QPushButton* api_restore_global_button;
|
||||||
QComboBox* vulkan_device_combobox;
|
QComboBox* vulkan_device_combobox;
|
||||||
|
@ -13,9 +13,10 @@
|
|||||||
ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(
|
ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(
|
||||||
const Core::System& system_,
|
const Core::System& system_,
|
||||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||||
const ConfigurationShared::TranslationMap& translations_, QWidget* parent)
|
const ConfigurationShared::TranslationMap& translations_,
|
||||||
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent)
|
||||||
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureGraphicsAdvanced>()}, system{system_},
|
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureGraphicsAdvanced>()}, system{system_},
|
||||||
translations{translations_} {
|
translations{translations_}, combobox_translations{combobox_translations_} {
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
@ -33,8 +34,8 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
|
|||||||
|
|
||||||
for (auto setting :
|
for (auto setting :
|
||||||
Settings::values.linkage.by_category[Settings::Category::RendererAdvanced]) {
|
Settings::values.linkage.by_category[Settings::Category::RendererAdvanced]) {
|
||||||
ConfigurationShared::Widget* widget =
|
ConfigurationShared::Widget* widget = new ConfigurationShared::Widget(
|
||||||
new ConfigurationShared::Widget(setting, translations, this, runtime_lock, apply_funcs);
|
setting, translations, combobox_translations, this, runtime_lock, apply_funcs);
|
||||||
|
|
||||||
if (!widget->Valid()) {
|
if (!widget->Valid()) {
|
||||||
delete widget;
|
delete widget;
|
||||||
|
@ -20,7 +20,9 @@ public:
|
|||||||
explicit ConfigureGraphicsAdvanced(
|
explicit ConfigureGraphicsAdvanced(
|
||||||
const Core::System& system_,
|
const Core::System& system_,
|
||||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||||
const ConfigurationShared::TranslationMap& translations_, QWidget* parent = nullptr);
|
const ConfigurationShared::TranslationMap& translations_,
|
||||||
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_,
|
||||||
|
QWidget* parent = nullptr);
|
||||||
~ConfigureGraphicsAdvanced() override;
|
~ConfigureGraphicsAdvanced() override;
|
||||||
|
|
||||||
void ApplyConfiguration() override;
|
void ApplyConfiguration() override;
|
||||||
@ -36,6 +38,7 @@ private:
|
|||||||
|
|
||||||
const Core::System& system;
|
const Core::System& system;
|
||||||
const ConfigurationShared::TranslationMap& translations;
|
const ConfigurationShared::TranslationMap& translations;
|
||||||
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations;
|
||||||
std::forward_list<std::function<void(bool)>> apply_funcs;
|
std::forward_list<std::function<void(bool)>> apply_funcs;
|
||||||
|
|
||||||
QWidget* checkbox_enable_compute_pipelines{};
|
QWidget* checkbox_enable_compute_pipelines{};
|
||||||
|
@ -43,6 +43,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
|
|||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
ui(std::make_unique<Ui::ConfigurePerGame>()), title_id{title_id_}, system{system_},
|
ui(std::make_unique<Ui::ConfigurePerGame>()), title_id{title_id_}, system{system_},
|
||||||
translations{ConfigurationShared::InitializeTranslations(this)},
|
translations{ConfigurationShared::InitializeTranslations(this)},
|
||||||
|
combobox_translations{ConfigurationShared::ComboboxEnumeration(this)},
|
||||||
tab_group{std::make_shared<std::forward_list<ConfigurationShared::Tab*>>()} {
|
tab_group{std::make_shared<std::forward_list<ConfigurationShared::Tab*>>()} {
|
||||||
const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name));
|
const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name));
|
||||||
const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename())
|
const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename())
|
||||||
@ -50,15 +51,17 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
|
|||||||
game_config = std::make_unique<Config>(config_file_name, Config::ConfigType::PerGameConfig);
|
game_config = std::make_unique<Config>(config_file_name, Config::ConfigType::PerGameConfig);
|
||||||
|
|
||||||
addons_tab = std::make_unique<ConfigurePerGameAddons>(system_, this);
|
addons_tab = std::make_unique<ConfigurePerGameAddons>(system_, this);
|
||||||
audio_tab = std::make_unique<ConfigureAudio>(system_, tab_group, *translations, this);
|
audio_tab = std::make_unique<ConfigureAudio>(system_, tab_group, *translations,
|
||||||
|
*combobox_translations, this);
|
||||||
cpu_tab = std::make_unique<ConfigureCpu>(system_, tab_group, this);
|
cpu_tab = std::make_unique<ConfigureCpu>(system_, tab_group, this);
|
||||||
graphics_advanced_tab =
|
graphics_advanced_tab = std::make_unique<ConfigureGraphicsAdvanced>(
|
||||||
std::make_unique<ConfigureGraphicsAdvanced>(system_, tab_group, *translations, this);
|
system_, tab_group, *translations, *combobox_translations, this);
|
||||||
graphics_tab = std::make_unique<ConfigureGraphics>(
|
graphics_tab = std::make_unique<ConfigureGraphics>(
|
||||||
system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); },
|
system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); },
|
||||||
tab_group, *translations, this);
|
tab_group, *translations, *combobox_translations, this);
|
||||||
input_tab = std::make_unique<ConfigureInputPerGame>(system_, game_config.get(), this);
|
input_tab = std::make_unique<ConfigureInputPerGame>(system_, game_config.get(), this);
|
||||||
system_tab = std::make_unique<ConfigureSystem>(system_, tab_group, *translations, this);
|
system_tab = std::make_unique<ConfigureSystem>(system_, tab_group, *translations,
|
||||||
|
*combobox_translations, this);
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ private:
|
|||||||
|
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
std::unique_ptr<ConfigurationShared::TranslationMap> translations;
|
std::unique_ptr<ConfigurationShared::TranslationMap> translations;
|
||||||
|
std::unique_ptr<ConfigurationShared::ComboboxTranslationMap> combobox_translations;
|
||||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> tab_group;
|
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> tab_group;
|
||||||
|
|
||||||
std::unique_ptr<ConfigurePerGameAddons> addons_tab;
|
std::unique_ptr<ConfigurePerGameAddons> addons_tab;
|
||||||
|
@ -44,9 +44,10 @@ static bool IsValidLocale(u32 region_index, u32 language_index) {
|
|||||||
|
|
||||||
ConfigureSystem::ConfigureSystem(
|
ConfigureSystem::ConfigureSystem(
|
||||||
Core::System& system_, std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
Core::System& system_, std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||||
ConfigurationShared::TranslationMap& translations_, QWidget* parent)
|
const ConfigurationShared::TranslationMap& translations_,
|
||||||
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent)
|
||||||
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_},
|
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_},
|
||||||
translations{translations_} {
|
translations{translations_}, combobox_translations{combobox_translations_} {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
Setup();
|
Setup();
|
||||||
@ -121,18 +122,17 @@ void ConfigureSystem::Setup() {
|
|||||||
ConfigurationShared::Widget* widget = [=]() {
|
ConfigurationShared::Widget* widget = [=]() {
|
||||||
if (setting->Id() == Settings::values.custom_rtc.Id()) {
|
if (setting->Id() == Settings::values.custom_rtc.Id()) {
|
||||||
return new ConfigurationShared::Widget(
|
return new ConfigurationShared::Widget(
|
||||||
setting, translations, this, runtime_lock, apply_funcs,
|
setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
|
||||||
ConfigurationShared::RequestType::DateTimeEdit, true, 1.0f,
|
ConfigurationShared::RequestType::DateTimeEdit, true, 1.0f,
|
||||||
&Settings::values.custom_rtc_enabled);
|
&Settings::values.custom_rtc_enabled);
|
||||||
} else if (setting->Id() == Settings::values.rng_seed.Id()) {
|
} else if (setting->Id() == Settings::values.rng_seed.Id()) {
|
||||||
return new ConfigurationShared::Widget(
|
return new ConfigurationShared::Widget(
|
||||||
setting, translations, this, runtime_lock, apply_funcs,
|
setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
|
||||||
ConfigurationShared::RequestType::HexEdit, true, 1.0f,
|
ConfigurationShared::RequestType::HexEdit, true, 1.0f,
|
||||||
&Settings::values.rng_seed_enabled);
|
&Settings::values.rng_seed_enabled);
|
||||||
} else {
|
} else {
|
||||||
return new ConfigurationShared::Widget(setting, translations, this, runtime_lock,
|
return new ConfigurationShared::Widget(setting, translations, combobox_translations,
|
||||||
|
this, runtime_lock, apply_funcs);
|
||||||
apply_funcs);
|
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
@ -22,10 +22,11 @@ class ConfigureSystem;
|
|||||||
|
|
||||||
class ConfigureSystem : public ConfigurationShared::Tab {
|
class ConfigureSystem : public ConfigurationShared::Tab {
|
||||||
public:
|
public:
|
||||||
explicit ConfigureSystem(Core::System& system_,
|
explicit ConfigureSystem(
|
||||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
Core::System& system_, std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||||
ConfigurationShared::TranslationMap& translations,
|
const ConfigurationShared::TranslationMap& translations,
|
||||||
QWidget* parent = nullptr);
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations,
|
||||||
|
QWidget* parent = nullptr);
|
||||||
~ConfigureSystem() override;
|
~ConfigureSystem() override;
|
||||||
|
|
||||||
void ApplyConfiguration() override;
|
void ApplyConfiguration() override;
|
||||||
@ -46,7 +47,8 @@ private:
|
|||||||
ConfigurationShared::CheckState use_unsafe_extended_memory_layout;
|
ConfigurationShared::CheckState use_unsafe_extended_memory_layout;
|
||||||
|
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
ConfigurationShared::TranslationMap& translations;
|
const ConfigurationShared::TranslationMap& translations;
|
||||||
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations;
|
||||||
|
|
||||||
QCheckBox* rng_seed_checkbox;
|
QCheckBox* rng_seed_checkbox;
|
||||||
QLineEdit* rng_seed_edit;
|
QLineEdit* rng_seed_edit;
|
||||||
|
@ -152,134 +152,204 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) {
|
|||||||
return translations;
|
return translations;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::forward_list<QString> ComboboxEnumeration(std::type_index type, QWidget* parent) {
|
std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) {
|
||||||
|
std::unique_ptr<ComboboxTranslationMap> translations =
|
||||||
|
std::make_unique<ComboboxTranslationMap>();
|
||||||
const auto& tr = [&](const char* text) { return parent->tr(text); };
|
const auto& tr = [&](const char* text) { return parent->tr(text); };
|
||||||
|
|
||||||
// Intentionally skipping VSyncMode to let the UI fill that one out
|
// Intentionally skipping VSyncMode to let the UI fill that one out
|
||||||
|
|
||||||
if (type == typeid(Settings::AstcDecodeMode)) {
|
translations->insert(
|
||||||
return {
|
{typeid(Settings::AstcDecodeMode),
|
||||||
tr("CPU"),
|
{
|
||||||
tr("GPU"),
|
{static_cast<u32>(Settings::AstcDecodeMode::CPU), tr("CPU")},
|
||||||
tr("CPU Asynchronous"),
|
{static_cast<u32>(Settings::AstcDecodeMode::GPU), tr("GPU")},
|
||||||
};
|
{static_cast<u32>(Settings::AstcDecodeMode::CPUAsynchronous), tr("CPU Asynchronous")},
|
||||||
} else if (type == typeid(Settings::RendererBackend)) {
|
}});
|
||||||
return {
|
translations->insert({typeid(Settings::RendererBackend),
|
||||||
tr("OpenGL"),
|
{
|
||||||
tr("Vulkan"),
|
#ifdef HAS_OPENGL
|
||||||
tr("Null"),
|
{static_cast<u32>(Settings::RendererBackend::OpenGL), tr("OpenGL")},
|
||||||
};
|
#endif
|
||||||
} else if (type == typeid(Settings::ShaderBackend)) {
|
{static_cast<u32>(Settings::RendererBackend::Vulkan), tr("Vulkan")},
|
||||||
return {
|
{static_cast<u32>(Settings::RendererBackend::Null), tr("Null")},
|
||||||
tr("GLSL"),
|
}});
|
||||||
tr("GLASM (Assembly Shaders, NVIDIA Only)"),
|
translations->insert({typeid(Settings::ShaderBackend),
|
||||||
tr("SPIR-V (Experimental, Mesa Only)"),
|
{
|
||||||
};
|
{static_cast<u32>(Settings::ShaderBackend::GLSL), tr("GLSL")},
|
||||||
} else if (type == typeid(Settings::GPUAccuracy)) {
|
{static_cast<u32>(Settings::ShaderBackend::GLASM),
|
||||||
return {
|
tr("GLASM (Assembly Shaders, NVIDIA Only)")},
|
||||||
tr("Normal"),
|
{static_cast<u32>(Settings::ShaderBackend::SPIRV),
|
||||||
tr("High"),
|
tr("SPIR-V (Experimental, Mesa Only)")},
|
||||||
tr("Extreme"),
|
}});
|
||||||
};
|
translations->insert({typeid(Settings::GPUAccuracy),
|
||||||
} else if (type == typeid(Settings::CPUAccuracy)) {
|
{
|
||||||
return {
|
{static_cast<u32>(Settings::GPUAccuracy::Normal), tr("Normal")},
|
||||||
tr("Auto"),
|
{static_cast<u32>(Settings::GPUAccuracy::High), tr("High")},
|
||||||
tr("Accurate"),
|
{static_cast<u32>(Settings::GPUAccuracy::Extreme), tr("Extreme")},
|
||||||
tr("Unsafe"),
|
}});
|
||||||
tr("Paranoid (disables most optimizations)"),
|
translations->insert({typeid(Settings::CPUAccuracy),
|
||||||
};
|
{
|
||||||
} else if (type == typeid(Settings::FullscreenMode)) {
|
{static_cast<u32>(Settings::CPUAccuracy::Auto), tr("Auto")},
|
||||||
return {
|
{static_cast<u32>(Settings::CPUAccuracy::Accurate), tr("Accurate")},
|
||||||
tr("Borderless Windowed"),
|
{static_cast<u32>(Settings::CPUAccuracy::Unsafe), tr("Unsafe")},
|
||||||
tr("Exclusive Fullscreen"),
|
{static_cast<u32>(Settings::CPUAccuracy::Paranoid),
|
||||||
};
|
tr("Paranoid (disables most optimizations)")},
|
||||||
} else if (type == typeid(Settings::NvdecEmulation)) {
|
}});
|
||||||
return {
|
translations->insert(
|
||||||
tr("No Video Output"),
|
{typeid(Settings::FullscreenMode),
|
||||||
tr("CPU Video Decoding"),
|
{
|
||||||
tr("GPU Video Decoding (Default)"),
|
{static_cast<u32>(Settings::FullscreenMode::Borderless), tr("Borderless Windowed")},
|
||||||
};
|
{static_cast<u32>(Settings::FullscreenMode::Exclusive), tr("Exclusive Fullscreen")},
|
||||||
} else if (type == typeid(Settings::ResolutionSetup)) {
|
}});
|
||||||
return {
|
translations->insert(
|
||||||
tr("0.5X (360p/540p) [EXPERIMENTAL]"),
|
{typeid(Settings::NvdecEmulation),
|
||||||
tr("0.75X (540p/810p) [EXPERIMENTAL]"),
|
{
|
||||||
tr("1X (720p/1080p)"),
|
{static_cast<u32>(Settings::NvdecEmulation::Off), tr("No Video Output")},
|
||||||
tr("1.5X (1080p/1620p) [EXPERIMENTAL]"),
|
{static_cast<u32>(Settings::NvdecEmulation::CPU), tr("CPU Video Decoding")},
|
||||||
tr("2X (1440p/2160p)"),
|
{static_cast<u32>(Settings::NvdecEmulation::GPU), tr("GPU Video Decoding (Default)")},
|
||||||
tr("3X (2160p/3240p)"),
|
}});
|
||||||
tr("4X (2880p/4320p)"),
|
translations->insert(
|
||||||
tr("5X (3600p/5400p)"),
|
{typeid(Settings::ResolutionSetup),
|
||||||
tr("6X (4320p/6480p)"),
|
{
|
||||||
tr("7X (5040p/7560p)"),
|
{static_cast<u32>(Settings::ResolutionSetup::Res1_2X),
|
||||||
tr("8X (5760p/8640p)"),
|
tr("0.5X (360p/540p) [EXPERIMENTAL]")},
|
||||||
};
|
{static_cast<u32>(Settings::ResolutionSetup::Res3_4X),
|
||||||
} else if (type == typeid(Settings::ScalingFilter)) {
|
tr("0.75X (540p/810p) [EXPERIMENTAL]")},
|
||||||
return {
|
{static_cast<u32>(Settings::ResolutionSetup::Res1X), tr("1X (720p/1080p)")},
|
||||||
tr("Nearest Neighbor"), tr("Bilinear"), tr("Bicubic"),
|
{static_cast<u32>(Settings::ResolutionSetup::Res3_2X),
|
||||||
tr("Gaussian"), tr("ScaleForce"), tr("AMD FidelityFX™️ Super Resolution"),
|
tr("1.5X (1080p/1620p) [EXPERIMENTAL]")},
|
||||||
};
|
{static_cast<u32>(Settings::ResolutionSetup::Res2X), tr("2X (1440p/2160p)")},
|
||||||
} else if (type == typeid(Settings::AntiAliasing)) {
|
{static_cast<u32>(Settings::ResolutionSetup::Res3X), tr("3X (2160p/3240p)")},
|
||||||
return {
|
{static_cast<u32>(Settings::ResolutionSetup::Res4X), tr("4X (2880p/4320p)")},
|
||||||
tr("None"),
|
{static_cast<u32>(Settings::ResolutionSetup::Res5X), tr("5X (3600p/5400p)")},
|
||||||
tr("FXAA"),
|
{static_cast<u32>(Settings::ResolutionSetup::Res6X), tr("6X (4320p/6480p)")},
|
||||||
tr("SMAA"),
|
{static_cast<u32>(Settings::ResolutionSetup::Res7X), tr("7X (5040p/7560p)")},
|
||||||
};
|
{static_cast<u32>(Settings::ResolutionSetup::Res8X), tr("8X (5760p/8640p)")},
|
||||||
} else if (type == typeid(Settings::AspectRatio)) {
|
}});
|
||||||
return {
|
translations->insert(
|
||||||
tr("Default (16:9)"), tr("Force 4:3"), tr("Force 21:9"),
|
{typeid(Settings::ScalingFilter),
|
||||||
tr("Force 16:10"), tr("Stretch to Window"),
|
{
|
||||||
};
|
{static_cast<u32>(Settings::ScalingFilter::NearestNeighbor), tr("Nearest Neighbor")},
|
||||||
} else if (type == typeid(Settings::AnisotropyMode)) {
|
{static_cast<u32>(Settings::ScalingFilter::Bilinear), tr("Bilinear")},
|
||||||
return {
|
{static_cast<u32>(Settings::ScalingFilter::Bicubic), tr("Bicubic")},
|
||||||
tr("Automatic"), tr("Default"), tr("2x"), tr("4x"), tr("8x"), tr("16x"),
|
{static_cast<u32>(Settings::ScalingFilter::Gaussian), tr("Gaussian")},
|
||||||
};
|
{static_cast<u32>(Settings::ScalingFilter::ScaleForce), tr("ScaleForce")},
|
||||||
} else if (type == typeid(Settings::Language)) {
|
{static_cast<u32>(Settings::ScalingFilter::Fsr),
|
||||||
return {
|
tr("AMD FidelityFX™️ Super Resolution")},
|
||||||
tr("Japanese (日本語)"),
|
}});
|
||||||
tr("American English"),
|
translations->insert({typeid(Settings::AntiAliasing),
|
||||||
tr("French (français)"),
|
{
|
||||||
tr("German (Deutsch)"),
|
{static_cast<u32>(Settings::AntiAliasing::None), tr("None")},
|
||||||
tr("Italian (italiano)"),
|
{static_cast<u32>(Settings::AntiAliasing::Fxaa), tr("FXAA")},
|
||||||
tr("Spanish (español)"),
|
{static_cast<u32>(Settings::AntiAliasing::Smaa), tr("SMAA")},
|
||||||
tr("Chinese"),
|
}});
|
||||||
tr("Korean (한국어)"),
|
translations->insert(
|
||||||
tr("Dutch (Nederlands)"),
|
{typeid(Settings::AspectRatio),
|
||||||
tr("Portuguese (português)"),
|
{
|
||||||
tr("Russian (Русский)"),
|
{static_cast<u32>(Settings::AspectRatio::R16_9), tr("Default (16:9)")},
|
||||||
tr("Taiwanese"),
|
{static_cast<u32>(Settings::AspectRatio::R4_3), tr("Force 4:3")},
|
||||||
tr("British English"),
|
{static_cast<u32>(Settings::AspectRatio::R21_9), tr("Force 21:9")},
|
||||||
tr("Canadian French"),
|
{static_cast<u32>(Settings::AspectRatio::R16_10), tr("Force 16:10")},
|
||||||
tr("Latin American Spanish"),
|
{static_cast<u32>(Settings::AspectRatio::Stretch), tr("Stretch to Window")},
|
||||||
tr("Simplified Chinese"),
|
}});
|
||||||
tr("Traditional Chinese (正體中文)"),
|
translations->insert(
|
||||||
tr("Brazilian Portuguese (português do Brasil)"),
|
{typeid(Settings::AnisotropyMode),
|
||||||
};
|
{
|
||||||
} else if (type == typeid(Settings::Region)) {
|
{static_cast<u32>(Settings::AnisotropyMode::Automatic), tr("Automatic")},
|
||||||
return {
|
{static_cast<u32>(Settings::AnisotropyMode::Default), tr("Default")},
|
||||||
tr("Japan"), tr("USA"), tr("Europe"), tr("Australia"),
|
{static_cast<u32>(Settings::AnisotropyMode::X2), tr("2x")},
|
||||||
tr("China"), tr("Korea"), tr("Taiwan"),
|
{static_cast<u32>(Settings::AnisotropyMode::X4), tr("4x")},
|
||||||
};
|
{static_cast<u32>(Settings::AnisotropyMode::X8), tr("8x")},
|
||||||
} else if (type == typeid(Settings::TimeZone)) {
|
{static_cast<u32>(Settings::AnisotropyMode::X16), tr("16x")},
|
||||||
return {
|
}});
|
||||||
tr("Auto"), tr("Default"), tr("CET"), tr("CST6CDT"), tr("Cuba"),
|
translations->insert(
|
||||||
tr("EET"), tr("Egypt"), tr("Eire"), tr("EST"), tr("EST5EDT"),
|
{typeid(Settings::Language),
|
||||||
tr("GB"), tr("GB-Eire"), tr("GMT"), tr("GMT+0"), tr("GMT-0"),
|
{
|
||||||
tr("GMT0"), tr("Greenwich"), tr("Hongkong"), tr("HST"), tr("Iceland"),
|
{static_cast<u32>(Settings::Language::Japanese), tr("Japanese (日本語)")},
|
||||||
tr("Iran"), tr("Israel"), tr("Jamaica"), tr("Kwajalein"), tr("Libya"),
|
{static_cast<u32>(Settings::Language::EnglishAmerican), tr("American English")},
|
||||||
tr("MET"), tr("MST"), tr("MST7MDT"), tr("Navajo"), tr("NZ"),
|
{static_cast<u32>(Settings::Language::French), tr("French (français)")},
|
||||||
tr("NZ-CHAT"), tr("Poland"), tr("Portugal"), tr("PRC"), tr("PST8PDT"),
|
{static_cast<u32>(Settings::Language::German), tr("German (Deutsch)")},
|
||||||
tr("ROC"), tr("ROK"), tr("Singapore"), tr("Turkey"), tr("UCT"),
|
{static_cast<u32>(Settings::Language::Italian), tr("Italian (italiano)")},
|
||||||
tr("W-SU"), tr("WET"), tr("Zulu"),
|
{static_cast<u32>(Settings::Language::Spanish), tr("Spanish (español)")},
|
||||||
};
|
{static_cast<u32>(Settings::Language::Chinese), tr("Chinese")},
|
||||||
} else if (type == typeid(Settings::AudioMode)) {
|
{static_cast<u32>(Settings::Language::Korean), tr("Korean (한국어)")},
|
||||||
return {
|
{static_cast<u32>(Settings::Language::Dutch), tr("Dutch (Nederlands)")},
|
||||||
tr("Mono"),
|
{static_cast<u32>(Settings::Language::Portuguese), tr("Portuguese (português)")},
|
||||||
tr("Stereo"),
|
{static_cast<u32>(Settings::Language::Russian), tr("Russian (Русский)")},
|
||||||
tr("Surround"),
|
{static_cast<u32>(Settings::Language::Taiwanese), tr("Taiwanese")},
|
||||||
};
|
{static_cast<u32>(Settings::Language::EnglishBritish), tr("British English")},
|
||||||
}
|
{static_cast<u32>(Settings::Language::FrenchCanadian), tr("Canadian French")},
|
||||||
|
{static_cast<u32>(Settings::Language::SpanishLatin), tr("Latin American Spanish")},
|
||||||
|
{static_cast<u32>(Settings::Language::ChineseSimplified), tr("Simplified Chinese")},
|
||||||
|
{static_cast<u32>(Settings::Language::ChineseTraditional),
|
||||||
|
tr("Traditional Chinese (正體中文)")},
|
||||||
|
{static_cast<u32>(Settings::Language::PortugueseBrazilian),
|
||||||
|
tr("Brazilian Portuguese (português do Brasil)")},
|
||||||
|
}});
|
||||||
|
translations->insert({typeid(Settings::Region),
|
||||||
|
{
|
||||||
|
{static_cast<u32>(Settings::Region::Japan), tr("Japan")},
|
||||||
|
{static_cast<u32>(Settings::Region::USA), tr("USA")},
|
||||||
|
{static_cast<u32>(Settings::Region::Europe), tr("Europe")},
|
||||||
|
{static_cast<u32>(Settings::Region::Australia), tr("Australia")},
|
||||||
|
{static_cast<u32>(Settings::Region::China), tr("China")},
|
||||||
|
{static_cast<u32>(Settings::Region::Korea), tr("Korea")},
|
||||||
|
{static_cast<u32>(Settings::Region::Taiwan), tr("Taiwan")},
|
||||||
|
}});
|
||||||
|
translations->insert({typeid(Settings::TimeZone),
|
||||||
|
{
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Auto), tr("Auto")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Default), tr("Default")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::CET), tr("CET")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::CST6CDT), tr("CST6CDT")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Cuba), tr("Cuba")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::EET), tr("EET")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Egypt), tr("Egypt")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Eire), tr("Eire")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::EST), tr("EST")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::EST5EDT), tr("EST5EDT")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::GB), tr("GB")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::GBEire), tr("GB-Eire")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::GMT), tr("GMT")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::GMTPlusZero), tr("GMT+0")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::GMTMinusZero), tr("GMT-0")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::GMTZero), tr("GMT0")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Greenwich), tr("Greenwich")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Hongkong), tr("Hongkong")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::HST), tr("HST")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Iceland), tr("Iceland")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Iran), tr("Iran")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Israel), tr("Israel")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Jamaica), tr("Jamaica")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Kwajalein), tr("Kwajalein")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Libya), tr("Libya")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::MET), tr("MET")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::MST), tr("MST")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::MST7MDT), tr("MST7MDT")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Navajo), tr("Navajo")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::NZ), tr("NZ")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::NZCHAT), tr("NZ-CHAT")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Poland), tr("Poland")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Portugal), tr("Portugal")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::PRC), tr("PRC")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::PST8PDT), tr("PST8PDT")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::ROC), tr("ROC")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::ROK), tr("ROK")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Singapore), tr("Singapore")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Turkey), tr("Turkey")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::UCT), tr("UCT")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::W_SU), tr("W-SU")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::WET), tr("WET")},
|
||||||
|
{static_cast<u32>(Settings::TimeZone::Zulu), tr("Zulu")},
|
||||||
|
}});
|
||||||
|
translations->insert({typeid(Settings::AudioMode),
|
||||||
|
{
|
||||||
|
{static_cast<u32>(Settings::AudioMode::Mono), tr("Mono")},
|
||||||
|
{static_cast<u32>(Settings::AudioMode::Stereo), tr("Stereo")},
|
||||||
|
{static_cast<u32>(Settings::AudioMode::Surround), tr("Surround")},
|
||||||
|
}});
|
||||||
|
|
||||||
return {};
|
return translations;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ConfigurationShared
|
} // namespace ConfigurationShared
|
||||||
|
@ -1,21 +1,23 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <forward_list>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <typeindex>
|
#include <typeindex>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
namespace ConfigurationShared {
|
namespace ConfigurationShared {
|
||||||
using TranslationMap = std::map<u32, std::pair<QString, QString>>;
|
using TranslationMap = std::map<u32, std::pair<QString, QString>>;
|
||||||
|
using ComboboxTranslations = std::vector<std::pair<u32, QString>>;
|
||||||
|
using ComboboxTranslationMap = std::map<std::type_index, ComboboxTranslations>;
|
||||||
|
|
||||||
std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent);
|
std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent);
|
||||||
|
|
||||||
std::forward_list<QString> ComboboxEnumeration(std::type_index type, QWidget* parent);
|
std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent);
|
||||||
|
|
||||||
} // namespace ConfigurationShared
|
} // namespace ConfigurationShared
|
||||||
|
@ -113,40 +113,51 @@ void Widget::CreateCombobox(const QString& label, std::function<void()>& load_fu
|
|||||||
QLabel* qt_label = new QLabel(label, this);
|
QLabel* qt_label = new QLabel(label, this);
|
||||||
combobox = new QComboBox(this);
|
combobox = new QComboBox(this);
|
||||||
|
|
||||||
std::forward_list<QString> combobox_enumerations = ComboboxEnumeration(type, this);
|
|
||||||
for (const auto& item : combobox_enumerations) {
|
|
||||||
combobox->addItem(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
layout->addWidget(qt_label);
|
layout->addWidget(qt_label);
|
||||||
layout->addWidget(combobox);
|
layout->addWidget(combobox);
|
||||||
|
|
||||||
layout->setSpacing(6);
|
layout->setSpacing(6);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
if (!managed) {
|
const ComboboxTranslations* enumeration{nullptr};
|
||||||
|
if (combobox_enumerations.contains(type)) {
|
||||||
|
enumeration = &combobox_enumerations.at(type);
|
||||||
|
for (const auto& [id, name] : *enumeration) {
|
||||||
|
combobox->addItem(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!managed || enumeration == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove audio engine specialization
|
const auto find_index = [=](u32 value) -> int {
|
||||||
if (setting.TypeId() != typeid(Settings::AudioEngine)) {
|
for (u32 i = 0; i < enumeration->size(); i++) {
|
||||||
combobox->setCurrentIndex(std::stoi(setting.ToString()));
|
if (enumeration->at(i).first == value) {
|
||||||
} else {
|
return i;
|
||||||
combobox->setCurrentIndex(
|
}
|
||||||
static_cast<u32>(Settings::ToEnum<Settings::AudioEngine>(setting.ToString())));
|
}
|
||||||
}
|
return -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
const u32 setting_value = std::stoi(setting.ToString());
|
||||||
|
combobox->setCurrentIndex(find_index(setting_value));
|
||||||
|
|
||||||
if (Settings::IsConfiguringGlobal()) {
|
if (Settings::IsConfiguringGlobal()) {
|
||||||
load_func = [=]() { setting.LoadString(std::to_string(combobox->currentIndex())); };
|
load_func = [=]() {
|
||||||
|
int current = combobox->currentIndex();
|
||||||
|
setting.LoadString(std::to_string(enumeration->at(current).first));
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
restore_button = CreateRestoreGlobalButton(setting.UsingGlobal(), this);
|
restore_button = CreateRestoreGlobalButton(setting.UsingGlobal(), this);
|
||||||
layout->addWidget(restore_button);
|
layout->addWidget(restore_button);
|
||||||
|
|
||||||
QObject::connect(restore_button, &QAbstractButton::clicked, [&](bool) {
|
QObject::connect(restore_button, &QAbstractButton::clicked, [=](bool) {
|
||||||
restore_button->setEnabled(false);
|
restore_button->setEnabled(false);
|
||||||
restore_button->setVisible(false);
|
restore_button->setVisible(false);
|
||||||
|
|
||||||
combobox->setCurrentIndex(std::stoi(setting.ToStringGlobal()));
|
const u32 global_value = std::stoi(setting.ToStringGlobal());
|
||||||
|
combobox->setCurrentIndex(find_index(global_value));
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(combobox, QOverload<int>::of(&QComboBox::activated), [=](int) {
|
QObject::connect(combobox, QOverload<int>::of(&QComboBox::activated), [=](int) {
|
||||||
@ -158,7 +169,8 @@ void Widget::CreateCombobox(const QString& label, std::function<void()>& load_fu
|
|||||||
bool using_global = !restore_button->isEnabled();
|
bool using_global = !restore_button->isEnabled();
|
||||||
setting.SetGlobal(using_global);
|
setting.SetGlobal(using_global);
|
||||||
if (!using_global) {
|
if (!using_global) {
|
||||||
setting.LoadString(std::to_string(combobox->currentIndex()));
|
int current = combobox->currentIndex();
|
||||||
|
setting.LoadString(std::to_string(enumeration->at(current).first));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -523,17 +535,13 @@ bool Widget::Valid() {
|
|||||||
Widget::~Widget() = default;
|
Widget::~Widget() = default;
|
||||||
|
|
||||||
Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translations_,
|
Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translations_,
|
||||||
QWidget* parent_, std::forward_list<std::function<void(bool)>>& apply_funcs_)
|
const ComboboxTranslationMap& combobox_translations_, QWidget* parent_,
|
||||||
: QWidget(parent_), parent{parent_}, translations{translations_}, setting{*setting_},
|
bool runtime_lock_, std::forward_list<std::function<void(bool)>>& apply_funcs_,
|
||||||
apply_funcs{apply_funcs_} {}
|
RequestType request, bool managed, float multiplier,
|
||||||
|
Settings::BasicSetting* other_setting, const QString& string)
|
||||||
Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translations_,
|
: QWidget(parent_), parent{parent_}, translations{translations_},
|
||||||
QWidget* parent_, bool runtime_lock_,
|
combobox_enumerations{combobox_translations_}, setting{*setting_}, apply_funcs{apply_funcs_},
|
||||||
std::forward_list<std::function<void(bool)>>& apply_funcs_, RequestType request,
|
runtime_lock{runtime_lock_} {
|
||||||
bool managed, float multiplier, Settings::BasicSetting* other_setting,
|
|
||||||
const QString& string)
|
|
||||||
: QWidget(parent_), parent{parent_}, translations{translations_}, setting{*setting_},
|
|
||||||
apply_funcs{apply_funcs_}, runtime_lock{runtime_lock_} {
|
|
||||||
if (!Settings::IsConfiguringGlobal() && !setting.Switchable()) {
|
if (!Settings::IsConfiguringGlobal() && !setting.Switchable()) {
|
||||||
LOG_DEBUG(Frontend, "\"{}\" is not switchable, skipping...", setting.GetLabel());
|
LOG_DEBUG(Frontend, "\"{}\" is not switchable, skipping...", setting.GetLabel());
|
||||||
return;
|
return;
|
||||||
@ -632,5 +640,4 @@ Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translati
|
|||||||
|
|
||||||
this->setToolTip(tooltip);
|
this->setToolTip(tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ConfigurationShared
|
} // namespace ConfigurationShared
|
||||||
|
@ -35,13 +35,12 @@ class Widget : public QWidget {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Widget(Settings::BasicSetting* setting, const TranslationMap& translations, QWidget* parent,
|
Widget(Settings::BasicSetting* setting, const TranslationMap& translations,
|
||||||
bool runtime_lock, std::forward_list<std::function<void(bool)>>& apply_funcs_,
|
const ComboboxTranslationMap& combobox_translations, QWidget* parent, bool runtime_lock,
|
||||||
|
std::forward_list<std::function<void(bool)>>& apply_funcs_,
|
||||||
RequestType request = RequestType::Default, bool managed = true, float multiplier = 1.0f,
|
RequestType request = RequestType::Default, bool managed = true, float multiplier = 1.0f,
|
||||||
Settings::BasicSetting* other_setting = nullptr,
|
Settings::BasicSetting* other_setting = nullptr,
|
||||||
const QString& string = QStringLiteral(""));
|
const QString& string = QStringLiteral(""));
|
||||||
Widget(Settings::BasicSetting* setting_, const TranslationMap& translations_, QWidget* parent_,
|
|
||||||
std::forward_list<std::function<void(bool)>>& apply_funcs_);
|
|
||||||
virtual ~Widget();
|
virtual ~Widget();
|
||||||
|
|
||||||
bool Valid();
|
bool Valid();
|
||||||
@ -77,6 +76,7 @@ private:
|
|||||||
|
|
||||||
QWidget* parent;
|
QWidget* parent;
|
||||||
const TranslationMap& translations;
|
const TranslationMap& translations;
|
||||||
|
const ComboboxTranslationMap& combobox_enumerations;
|
||||||
Settings::BasicSetting& setting;
|
Settings::BasicSetting& setting;
|
||||||
std::forward_list<std::function<void(bool)>>& apply_funcs;
|
std::forward_list<std::function<void(bool)>>& apply_funcs;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user