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
@ -125,8 +125,8 @@ void ConfigurationShared::InsertGlobalItem(QComboBox* combobox) {
|
|||||||
combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX);
|
combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigurationShared::InsertGlobalItem(QComboBox* combobox, const QString& global) {
|
void ConfigurationShared::InsertGlobalItem(QComboBox* combobox, int global_index) {
|
||||||
const QString use_global_text = ConfigurePerGame::tr("Use global configuration (%1)").arg(global);
|
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);
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,6 @@ void SetColoredTristate(QCheckBox* checkbox, const std::string& name, const Sett
|
|||||||
ConfigurationShared::CheckState& tracker);
|
ConfigurationShared::CheckState& tracker);
|
||||||
|
|
||||||
void InsertGlobalItem(QComboBox* combobox);
|
void InsertGlobalItem(QComboBox* combobox);
|
||||||
void InsertGlobalItem(QComboBox* combobox, const QString& global);
|
void InsertGlobalItem(QComboBox* combobox, int global_index);
|
||||||
|
|
||||||
} // namespace ConfigurationShared
|
} // namespace ConfigurationShared
|
||||||
|
@ -31,13 +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) {
|
||||||
if (!Settings::configuring_global) {
|
ConfigurationShared::SetHighlight(ui->api_layout, "api_layout",
|
||||||
ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", ui->api->currentIndex() != ConfigurationShared::USE_GLOBAL_INDEX);
|
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); });
|
||||||
|
|
||||||
@ -84,9 +85,12 @@ void ConfigureGraphics::SetConfiguration() {
|
|||||||
|
|
||||||
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->aspect_ratio_layout, "aspect_ratio_layout", !Settings::values.aspect_ratio.UsingGlobal());
|
ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout",
|
||||||
ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout", !Settings::values.bg_red.UsingGlobal());
|
!Settings::values.aspect_ratio.UsingGlobal());
|
||||||
// FIXME: ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", !Settings::values.renderer_backend.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(),
|
UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(),
|
||||||
@ -243,9 +247,11 @@ void ConfigureGraphics::SetupPerGameUI() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->aspect_ratio_combobox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, [this](int index) {
|
connect(ui->aspect_ratio_combobox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
|
||||||
ConfigurationShared::SetHighlight(ui->aspect_ratio_layout, "aspect_ratio_layout", index != 0);
|
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,
|
connect(ui->bg_combobox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this,
|
||||||
[this](int index) {
|
[this](int index) {
|
||||||
ui->bg_button->setEnabled(index == 1);
|
ui->bg_button->setEnabled(index == 1);
|
||||||
@ -260,6 +266,8 @@ void ConfigureGraphics::SetupPerGameUI() {
|
|||||||
Settings::values.use_asynchronous_gpu_emulation,
|
Settings::values.use_asynchronous_gpu_emulation,
|
||||||
ConfigurationShared::trackers.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->aspect_ratio_combobox,
|
||||||
ConfigurationShared::InsertGlobalItem(ui->api, ui->api->itemText(static_cast<int>(Settings::values.renderer_backend.GetValue(true))));
|
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,
|
Settings::values.force_30fps_mode,
|
||||||
ConfigurationShared::trackers.force_30fps_mode);
|
ConfigurationShared::trackers.force_30fps_mode);
|
||||||
ConfigurationShared::InsertGlobalItem(
|
ConfigurationShared::InsertGlobalItem(
|
||||||
ui->gpu_accuracy,
|
ui->gpu_accuracy, static_cast<int>(Settings::values.gpu_accuracy.GetValue(true)));
|
||||||
ui->gpu_accuracy->itemText(static_cast<int>(Settings::values.gpu_accuracy.GetValue(true))));
|
|
||||||
ConfigurationShared::InsertGlobalItem(
|
ConfigurationShared::InsertGlobalItem(
|
||||||
ui->anisotropic_filtering_combobox,
|
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,
|
connect(ui->gpu_accuracy, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this,
|
||||||
[this](int index) {
|
[this](int index) {
|
||||||
|
Loading…
Reference in New Issue
Block a user