configuration: Add base class to tabs

Tabs that largely configure SwitchableSetting's are now Tabs and grouped
together.
This commit is contained in:
lat9nq
2023-05-05 23:30:59 -04:00
parent e5b981e1e4
commit d3b94d64d4
18 changed files with 110 additions and 101 deletions

View File

@ -24,6 +24,7 @@
#include "core/loader/loader.h"
#include "ui_configure_per_game.h"
#include "yuzu/configuration/config.h"
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_audio.h"
#include "yuzu/configuration/configure_cpu.h"
#include "yuzu/configuration/configure_general.h"
@ -40,22 +41,23 @@
ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::string& file_name,
std::vector<VkDeviceInfo::Record>& vk_device_records,
Core::System& system_)
: QDialog(parent),
ui(std::make_unique<Ui::ConfigurePerGame>()), title_id{title_id_}, system{system_} {
: QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), title_id{title_id_},
system{system_}, group{std::make_shared<std::forward_list<ConfigurationShared::Tab*>>()} {
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())
: fmt::format("{:016X}", title_id);
game_config = std::make_unique<Config>(config_file_name, Config::ConfigType::PerGameConfig);
addons_tab = std::make_unique<ConfigurePerGameAddons>(system_, this);
audio_tab = std::make_unique<ConfigureAudio>(system_, this);
cpu_tab = std::make_unique<ConfigureCpu>(system_, this);
general_tab = std::make_unique<ConfigureGeneral>(system_, this);
graphics_advanced_tab = std::make_unique<ConfigureGraphicsAdvanced>(system_, this);
audio_tab = std::make_unique<ConfigureAudio>(system_, group, this);
cpu_tab = std::make_unique<ConfigureCpu>(system_, group, this);
general_tab = std::make_unique<ConfigureGeneral>(system_, group, this);
graphics_advanced_tab = std::make_unique<ConfigureGraphicsAdvanced>(system_, group, this);
graphics_tab = std::make_unique<ConfigureGraphics>(
system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, this);
system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, group,
this);
input_tab = std::make_unique<ConfigureInputPerGame>(system_, game_config.get(), this);
system_tab = std::make_unique<ConfigureSystem>(system_, this);
system_tab = std::make_unique<ConfigureSystem>(system_, group, this);
ui->setupUi(this);
@ -88,13 +90,10 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st
ConfigurePerGame::~ConfigurePerGame() = default;
void ConfigurePerGame::ApplyConfiguration() {
for (const auto tab : *group) {
tab->ApplyConfiguration();
}
addons_tab->ApplyConfiguration();
general_tab->ApplyConfiguration();
cpu_tab->ApplyConfiguration();
system_tab->ApplyConfiguration();
graphics_tab->ApplyConfiguration();
graphics_advanced_tab->ApplyConfiguration();
audio_tab->ApplyConfiguration();
input_tab->ApplyConfiguration();
system.ApplySettings();