mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
configuration_shared: Use an int instead of a QString
I noticed some of the code could be reduced to just passing the function an int, since I was doing the same thing over and over. Also clang-formats configure_graphics
This commit is contained in:
parent
38152ab0b9
commit
2627241541
4 changed files with 28 additions and 22 deletions
|
@ -125,8 +125,8 @@ void ConfigurationShared::InsertGlobalItem(QComboBox* combobox) {
|
|||
combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX);
|
||||
}
|
||||
|
||||
void ConfigurationShared::InsertGlobalItem(QComboBox* combobox, const QString& global) {
|
||||
const QString use_global_text = ConfigurePerGame::tr("Use global configuration (%1)").arg(global);
|
||||
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->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX);
|
||||
}
|
||||
|
|
|
@ -61,6 +61,6 @@ void SetColoredTristate(QCheckBox* checkbox, const std::string& name, const Sett
|
|||
ConfigurationShared::CheckState& tracker);
|
||||
|
||||
void InsertGlobalItem(QComboBox* combobox);
|
||||
void InsertGlobalItem(QComboBox* combobox, const QString& global);
|
||||
void InsertGlobalItem(QComboBox* combobox, int global_index);
|
||||
|
||||
} // namespace ConfigurationShared
|
||||
|
|
|
@ -31,11 +31,12 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
|||
|
||||
SetConfiguration();
|
||||
|
||||
connect(ui->api, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
[this] {
|
||||
connect(ui->api, qOverload<int>(&QComboBox::currentIndexChanged), this, [this] {
|
||||
UpdateDeviceComboBox();
|
||||
if (!Settings::configuring_global) {
|
||||
ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", ui->api->currentIndex() != ConfigurationShared::USE_GLOBAL_INDEX);
|
||||
ConfigurationShared::SetHighlight(ui->api_layout, "api_layout",
|
||||
ui->api->currentIndex() !=
|
||||
ConfigurationShared::USE_GLOBAL_INDEX);
|
||||
}
|
||||
});
|
||||
connect(ui->device, qOverload<int>(&QComboBox::activated), this,
|
||||
|
@ -84,9 +85,12 @@ void ConfigureGraphics::SetConfiguration() {
|
|||
|
||||
ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1);
|
||||
ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal());
|
||||
ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout", !Settings::values.aspect_ratio.UsingGlobal());
|
||||
ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout", !Settings::values.bg_red.UsingGlobal());
|
||||
// FIXME: ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", !Settings::values.renderer_backend.UsingGlobal());
|
||||
ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout",
|
||||
!Settings::values.aspect_ratio.UsingGlobal());
|
||||
ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout",
|
||||
!Settings::values.bg_red.UsingGlobal());
|
||||
// FIXME: ConfigurationShared::SetHighlight(ui->api_layout, "api_layout",
|
||||
// !Settings::values.renderer_backend.UsingGlobal());
|
||||
}
|
||||
|
||||
UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(),
|
||||
|
@ -243,8 +247,10 @@ void ConfigureGraphics::SetupPerGameUI() {
|
|||
return;
|
||||
}
|
||||
|
||||
connect(ui->aspect_ratio_combobox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, [this](int index) {
|
||||
ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout", index != 0);
|
||||
connect(ui->aspect_ratio_combobox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
|
||||
this, [this](int index) {
|
||||
ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout",
|
||||
index != 0);
|
||||
});
|
||||
connect(ui->bg_combobox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this,
|
||||
[this](int index) {
|
||||
|
@ -260,6 +266,8 @@ void ConfigureGraphics::SetupPerGameUI() {
|
|||
Settings::values.use_asynchronous_gpu_emulation,
|
||||
ConfigurationShared::trackers.use_asynchronous_gpu_emulation);
|
||||
|
||||
ConfigurationShared::InsertGlobalItem(ui->aspect_ratio_combobox, ui->aspect_ratio_combobox->itemText(Settings::values.aspect_ratio.GetValue(true)));
|
||||
ConfigurationShared::InsertGlobalItem(ui->api, ui->api->itemText(static_cast<int>(Settings::values.renderer_backend.GetValue(true))));
|
||||
ConfigurationShared::InsertGlobalItem(ui->aspect_ratio_combobox,
|
||||
Settings::values.aspect_ratio.GetValue(true));
|
||||
ConfigurationShared::InsertGlobalItem(
|
||||
ui->api, static_cast<int>(Settings::values.renderer_backend.GetValue(true)));
|
||||
}
|
||||
|
|
|
@ -157,12 +157,10 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() {
|
|||
Settings::values.force_30fps_mode,
|
||||
ConfigurationShared::trackers.force_30fps_mode);
|
||||
ConfigurationShared::InsertGlobalItem(
|
||||
ui->gpu_accuracy,
|
||||
ui->gpu_accuracy->itemText(static_cast<int>(Settings::values.gpu_accuracy.GetValue(true))));
|
||||
ui->gpu_accuracy, static_cast<int>(Settings::values.gpu_accuracy.GetValue(true)));
|
||||
ConfigurationShared::InsertGlobalItem(
|
||||
ui->anisotropic_filtering_combobox,
|
||||
ui->anisotropic_filtering_combobox->itemText(
|
||||
static_cast<int>(Settings::values.max_anisotropy.GetValue(true))));
|
||||
static_cast<int>(Settings::values.max_anisotropy.GetValue(true)));
|
||||
|
||||
connect(ui->gpu_accuracy, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this,
|
||||
[this](int index) {
|
||||
|
|
Loading…
Reference in a new issue