configuration: Use IDs to sort holds
This commit is contained in:
parent
f7948b7b64
commit
9e3c94bb3d
|
@ -37,7 +37,7 @@ void ConfigureGeneral::SetConfiguration() {
|
|||
const bool runtime_lock = !system.IsPoweredOn();
|
||||
QLayout& layout = *ui->general_widget->layout();
|
||||
|
||||
std::map<std::string, QWidget*> hold{};
|
||||
std::map<u32, QWidget*> hold{};
|
||||
|
||||
for (const auto setting :
|
||||
UISettings::values.linkage.by_category[Settings::Category::UiGeneral]) {
|
||||
|
@ -49,10 +49,10 @@ void ConfigureGeneral::SetConfiguration() {
|
|||
continue;
|
||||
}
|
||||
|
||||
hold.insert({setting->GetLabel(), widget});
|
||||
hold.emplace(setting->Id(), widget);
|
||||
}
|
||||
|
||||
for (const auto& [label, widget] : hold) {
|
||||
for (const auto& [id, widget] : hold) {
|
||||
layout.addWidget(widget);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,12 +226,10 @@ void ConfigureGraphics::Setup() {
|
|||
|
||||
QLayout& graphics_layout = *ui->graphics_widget->layout();
|
||||
|
||||
std::map<bool, std::map<std::string, QWidget*>> hold_graphics;
|
||||
std::map<u32, QWidget*> hold_graphics;
|
||||
std::forward_list<QWidget*> hold_api;
|
||||
|
||||
for (const auto setting : Settings::values.linkage.by_category[Settings::Category::Renderer]) {
|
||||
const auto& setting_label = setting->GetLabel();
|
||||
|
||||
ConfigurationShared::Widget* widget = [&]() {
|
||||
if (setting->Id() == Settings::values.vulkan_device.Id() ||
|
||||
setting->Id() == Settings::values.shader_backend.Id() ||
|
||||
|
@ -284,16 +282,14 @@ void ConfigureGraphics::Setup() {
|
|||
shader_backend_widget = widget;
|
||||
} else if (setting->Id() == Settings::values.vsync_mode.Id()) {
|
||||
vsync_mode_combobox = widget->combobox;
|
||||
hold_graphics[setting->IsEnum()][setting_label] = widget;
|
||||
hold_graphics.emplace(setting->Id(), widget);
|
||||
} else {
|
||||
hold_graphics[setting->IsEnum()][setting_label] = widget;
|
||||
hold_graphics.emplace(setting->Id(), widget);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& [_, settings] : hold_graphics) {
|
||||
for (const auto& [label, widget] : settings) {
|
||||
graphics_layout.addWidget(widget);
|
||||
}
|
||||
for (const auto& [id, widget] : hold_graphics) {
|
||||
graphics_layout.addWidget(widget);
|
||||
}
|
||||
|
||||
for (auto widget : hold_api) {
|
||||
|
|
|
@ -31,7 +31,7 @@ ConfigureGraphicsAdvanced::~ConfigureGraphicsAdvanced() = default;
|
|||
void ConfigureGraphicsAdvanced::SetConfiguration() {
|
||||
const bool runtime_lock = !system.IsPoweredOn();
|
||||
auto& layout = *ui->populate_target->layout();
|
||||
std::map<std::string, QWidget*> hold{}; // A map will sort the data for us
|
||||
std::map<u32, QWidget*> hold{}; // A map will sort the data for us
|
||||
|
||||
for (auto setting :
|
||||
Settings::values.linkage.by_category[Settings::Category::RendererAdvanced]) {
|
||||
|
@ -43,17 +43,13 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!setting->IsEnum()) {
|
||||
hold.emplace(setting->GetLabel(), widget);
|
||||
} else {
|
||||
layout.addWidget(widget);
|
||||
}
|
||||
hold.emplace(setting->Id(), widget);
|
||||
|
||||
if (setting->Id() == Settings::values.enable_compute_pipelines.Id()) {
|
||||
checkbox_enable_compute_pipelines = widget;
|
||||
}
|
||||
}
|
||||
for (const auto& [label, widget] : hold) {
|
||||
for (const auto& [id, widget] : hold) {
|
||||
layout.addWidget(widget);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,8 +109,8 @@ void ConfigureSystem::Setup() {
|
|||
auto& core_layout = *ui->core_widget->layout();
|
||||
auto& system_layout = *ui->system_widget->layout();
|
||||
|
||||
std::map<std::string, QWidget*> core_hold{};
|
||||
std::map<bool, std::map<std::string, QWidget*>> system_hold{};
|
||||
std::map<u32, QWidget*> core_hold{};
|
||||
std::map<u32, QWidget*> system_hold{};
|
||||
|
||||
std::forward_list<Settings::BasicSetting*> settings;
|
||||
auto push = [&settings](std::forward_list<Settings::BasicSetting*>& list) {
|
||||
|
@ -165,10 +165,10 @@ void ConfigureSystem::Setup() {
|
|||
|
||||
switch (setting->Category()) {
|
||||
case Settings::Category::Core:
|
||||
core_hold[setting->GetLabel()] = widget;
|
||||
core_hold.emplace(setting->Id(), widget);
|
||||
break;
|
||||
case Settings::Category::System:
|
||||
system_hold[setting->IsEnum()].insert(std::pair{setting->GetLabel(), widget});
|
||||
system_hold.emplace(setting->Id(), widget);
|
||||
break;
|
||||
default:
|
||||
delete widget;
|
||||
|
@ -177,10 +177,7 @@ void ConfigureSystem::Setup() {
|
|||
for (const auto& [label, widget] : core_hold) {
|
||||
core_layout.addWidget(widget);
|
||||
}
|
||||
for (const auto& [label, widget] : system_hold[true]) {
|
||||
system_layout.addWidget(widget);
|
||||
}
|
||||
for (const auto& [label, widget] : system_hold[false]) {
|
||||
for (const auto& [id, widget] : system_hold) {
|
||||
system_layout.addWidget(widget);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue