configuration: Add base class to tabs
Tabs that largely configure SwitchableSetting's are now Tabs and grouped together.
This commit is contained in:
parent
e5b981e1e4
commit
d3b94d64d4
@ -1,6 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <memory>
|
||||
#include <QCheckBox>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
@ -11,9 +12,14 @@
|
||||
|
||||
namespace ConfigurationShared {
|
||||
|
||||
Tab::Tab(QWidget* parent) : QWidget(parent) {}
|
||||
Tab::Tab(std::shared_ptr<std::forward_list<Tab*>> group_, QWidget* parent)
|
||||
: QWidget(parent), group{group_} {
|
||||
if (group != nullptr) {
|
||||
group->push_front(this);
|
||||
}
|
||||
}
|
||||
|
||||
Tab::~Tab() {}
|
||||
Tab::~Tab() = default;
|
||||
|
||||
} // namespace ConfigurationShared
|
||||
|
||||
|
@ -3,6 +3,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <forward_list>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QWidget>
|
||||
@ -15,11 +18,14 @@ class Tab : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Tab(QWidget* parent = nullptr);
|
||||
explicit Tab(std::shared_ptr<std::forward_list<Tab*>> group_, QWidget* parent = nullptr);
|
||||
~Tab();
|
||||
|
||||
virtual void ApplyConfiguration() = 0;
|
||||
virtual void SetConfiguration() = 0;
|
||||
|
||||
private:
|
||||
std::shared_ptr<std::forward_list<Tab*>> group;
|
||||
};
|
||||
|
||||
constexpr int USE_GLOBAL_INDEX = 0;
|
||||
|
@ -12,8 +12,10 @@
|
||||
#include "yuzu/configuration/configure_audio.h"
|
||||
#include "yuzu/uisettings.h"
|
||||
|
||||
ConfigureAudio::ConfigureAudio(const Core::System& system_, QWidget* parent)
|
||||
: QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()), system{system_} {
|
||||
ConfigureAudio::ConfigureAudio(const Core::System& system_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
QWidget* parent)
|
||||
: Tab(group, parent), ui(std::make_unique<Ui::ConfigureAudio>()), system{system_} {
|
||||
ui->setupUi(this);
|
||||
|
||||
InitializeAudioSinkComboBox();
|
||||
|
@ -5,28 +5,25 @@
|
||||
|
||||
#include <memory>
|
||||
#include <QWidget>
|
||||
#include "yuzu/configuration/configuration_shared.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace ConfigurationShared {
|
||||
enum class CheckState;
|
||||
}
|
||||
|
||||
namespace Ui {
|
||||
class ConfigureAudio;
|
||||
}
|
||||
|
||||
class ConfigureAudio : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
class ConfigureAudio : public ConfigurationShared::Tab {
|
||||
public:
|
||||
explicit ConfigureAudio(const Core::System& system_, QWidget* parent = nullptr);
|
||||
explicit ConfigureAudio(const Core::System& system_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
QWidget* parent = nullptr);
|
||||
~ConfigureAudio() override;
|
||||
|
||||
void ApplyConfiguration();
|
||||
void SetConfiguration();
|
||||
void ApplyConfiguration() override;
|
||||
void SetConfiguration() override;
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent* event) override;
|
||||
|
@ -1,6 +1,8 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <forward_list>
|
||||
#include <memory>
|
||||
#include "common/common_types.h"
|
||||
#include "common/settings.h"
|
||||
#include "core/core.h"
|
||||
@ -8,8 +10,10 @@
|
||||
#include "yuzu/configuration/configuration_shared.h"
|
||||
#include "yuzu/configuration/configure_cpu.h"
|
||||
|
||||
ConfigureCpu::ConfigureCpu(const Core::System& system_, QWidget* parent)
|
||||
: QWidget(parent), ui{std::make_unique<Ui::ConfigureCpu>()}, system{system_} {
|
||||
ConfigureCpu::ConfigureCpu(const Core::System& system_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
QWidget* parent)
|
||||
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureCpu>()}, system{system_} {
|
||||
ui->setupUi(this);
|
||||
|
||||
SetupPerGameUI();
|
||||
|
@ -5,28 +5,25 @@
|
||||
|
||||
#include <memory>
|
||||
#include <QWidget>
|
||||
#include "yuzu/configuration/configuration_shared.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace ConfigurationShared {
|
||||
enum class CheckState;
|
||||
}
|
||||
|
||||
namespace Ui {
|
||||
class ConfigureCpu;
|
||||
}
|
||||
|
||||
class ConfigureCpu : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
class ConfigureCpu : public ConfigurationShared::Tab {
|
||||
public:
|
||||
explicit ConfigureCpu(const Core::System& system_, QWidget* parent = nullptr);
|
||||
explicit ConfigureCpu(const Core::System& system_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
QWidget* parent = nullptr);
|
||||
~ConfigureCpu() override;
|
||||
|
||||
void ApplyConfiguration();
|
||||
void SetConfiguration();
|
||||
void ApplyConfiguration() override;
|
||||
void SetConfiguration() override;
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent* event) override;
|
||||
|
@ -32,21 +32,21 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_,
|
||||
std::vector<VkDeviceInfo::Record>& vk_device_records,
|
||||
Core::System& system_, bool enable_web_config)
|
||||
: QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()},
|
||||
registry(registry_), system{system_}, audio_tab{std::make_unique<ConfigureAudio>(system_,
|
||||
this)},
|
||||
cpu_tab{std::make_unique<ConfigureCpu>(system_, this)},
|
||||
registry(registry_), system{system_}, audio_tab{std::make_unique<ConfigureAudio>(
|
||||
system_, nullptr, this)},
|
||||
cpu_tab{std::make_unique<ConfigureCpu>(system_, nullptr, this)},
|
||||
debug_tab_tab{std::make_unique<ConfigureDebugTab>(system_, this)},
|
||||
filesystem_tab{std::make_unique<ConfigureFilesystem>(this)},
|
||||
general_tab{std::make_unique<ConfigureGeneral>(system_, this)},
|
||||
graphics_advanced_tab{std::make_unique<ConfigureGraphicsAdvanced>(system_, this)},
|
||||
general_tab{std::make_unique<ConfigureGeneral>(system_, nullptr, this)},
|
||||
graphics_advanced_tab{std::make_unique<ConfigureGraphicsAdvanced>(system_, nullptr, this)},
|
||||
graphics_tab{std::make_unique<ConfigureGraphics>(
|
||||
system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); },
|
||||
this)},
|
||||
nullptr, this)},
|
||||
hotkeys_tab{std::make_unique<ConfigureHotkeys>(system_.HIDCore(), this)},
|
||||
input_tab{std::make_unique<ConfigureInput>(system_, this)},
|
||||
network_tab{std::make_unique<ConfigureNetwork>(system_, this)},
|
||||
profile_tab{std::make_unique<ConfigureProfileManager>(system_, this)},
|
||||
system_tab{std::make_unique<ConfigureSystem>(system_, this)},
|
||||
system_tab{std::make_unique<ConfigureSystem>(system_, nullptr, this)},
|
||||
ui_tab{std::make_unique<ConfigureUi>(system_, this)}, web_tab{std::make_unique<ConfigureWeb>(
|
||||
this)} {
|
||||
Settings::SetConfiguringGlobal(true);
|
||||
|
@ -3,9 +3,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <forward_list>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <QDialog>
|
||||
#include "configuration/configuration_shared.h"
|
||||
#include "yuzu/vk_device_info.h"
|
||||
|
||||
namespace Core {
|
||||
@ -69,6 +71,7 @@ private:
|
||||
HotkeyRegistry& registry;
|
||||
|
||||
Core::System& system;
|
||||
std::forward_list<ConfigurationShared::Tab*> tab_group;
|
||||
|
||||
std::unique_ptr<ConfigureAudio> audio_tab;
|
||||
std::unique_ptr<ConfigureCpu> cpu_tab;
|
||||
|
@ -11,8 +11,10 @@
|
||||
#include "yuzu/configuration/configure_general.h"
|
||||
#include "yuzu/uisettings.h"
|
||||
|
||||
ConfigureGeneral::ConfigureGeneral(const Core::System& system_, QWidget* parent)
|
||||
: QWidget(parent), ui{std::make_unique<Ui::ConfigureGeneral>()}, system{system_} {
|
||||
ConfigureGeneral::ConfigureGeneral(
|
||||
const Core::System& system_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, QWidget* parent)
|
||||
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureGeneral>()}, system{system_} {
|
||||
ui->setupUi(this);
|
||||
|
||||
SetupPerGameUI();
|
||||
|
@ -6,34 +6,30 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <QWidget>
|
||||
#include "yuzu/configuration/configuration_shared.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
class ConfigureDialog;
|
||||
|
||||
namespace ConfigurationShared {
|
||||
enum class CheckState;
|
||||
}
|
||||
|
||||
class HotkeyRegistry;
|
||||
|
||||
namespace Ui {
|
||||
class ConfigureGeneral;
|
||||
}
|
||||
|
||||
class ConfigureGeneral : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
class ConfigureGeneral : public ConfigurationShared::Tab {
|
||||
public:
|
||||
explicit ConfigureGeneral(const Core::System& system_, QWidget* parent = nullptr);
|
||||
explicit ConfigureGeneral(const Core::System& system_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
QWidget* parent = nullptr);
|
||||
~ConfigureGeneral() override;
|
||||
|
||||
void SetResetCallback(std::function<void()> callback);
|
||||
void ResetDefaults();
|
||||
void ApplyConfiguration();
|
||||
void SetConfiguration();
|
||||
void ApplyConfiguration() override;
|
||||
void SetConfiguration() override;
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent* event) override;
|
||||
|
@ -70,12 +70,12 @@ static constexpr Settings::VSyncMode PresentModeToSetting(VkPresentModeKHR mode)
|
||||
}
|
||||
}
|
||||
|
||||
ConfigureGraphics::ConfigureGraphics(const Core::System& system_,
|
||||
std::vector<VkDeviceInfo::Record>& records_,
|
||||
const std::function<void()>& expose_compute_option_,
|
||||
QWidget* parent)
|
||||
: QWidget(parent), ui{std::make_unique<Ui::ConfigureGraphics>()}, records{records_},
|
||||
expose_compute_option{expose_compute_option_}, system{system_} {
|
||||
ConfigureGraphics::ConfigureGraphics(
|
||||
const Core::System& system_, std::vector<VkDeviceInfo::Record>& records_,
|
||||
const std::function<void()>& expose_compute_option_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, QWidget* parent)
|
||||
: ConfigurationShared::Tab(group, parent), ui{std::make_unique<Ui::ConfigureGraphics>()},
|
||||
records{records_}, expose_compute_option{expose_compute_option_}, system{system_} {
|
||||
vulkan_device = Settings::values.vulkan_device.GetValue();
|
||||
RetrieveVulkanDevices();
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <vulkan/vulkan_core.h>
|
||||
#include "common/common_types.h"
|
||||
#include "vk_device_info.h"
|
||||
#include "yuzu/configuration/configuration_shared.h"
|
||||
|
||||
class QEvent;
|
||||
class QObject;
|
||||
@ -27,26 +28,21 @@ namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace ConfigurationShared {
|
||||
enum class CheckState;
|
||||
}
|
||||
|
||||
namespace Ui {
|
||||
class ConfigureGraphics;
|
||||
}
|
||||
|
||||
class ConfigureGraphics : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
class ConfigureGraphics : public ConfigurationShared::Tab {
|
||||
public:
|
||||
explicit ConfigureGraphics(const Core::System& system_,
|
||||
std::vector<VkDeviceInfo::Record>& records,
|
||||
const std::function<void()>& expose_compute_option_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
QWidget* parent = nullptr);
|
||||
~ConfigureGraphics() override;
|
||||
|
||||
void ApplyConfiguration();
|
||||
void SetConfiguration();
|
||||
void ApplyConfiguration() override;
|
||||
void SetConfiguration() override;
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent* event) override;
|
||||
|
@ -7,8 +7,10 @@
|
||||
#include "yuzu/configuration/configuration_shared.h"
|
||||
#include "yuzu/configuration/configure_graphics_advanced.h"
|
||||
|
||||
ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(const Core::System& system_, QWidget* parent)
|
||||
: QWidget(parent), ui{std::make_unique<Ui::ConfigureGraphicsAdvanced>()}, system{system_} {
|
||||
ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(
|
||||
const Core::System& system_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, QWidget* parent)
|
||||
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureGraphicsAdvanced>()}, system{system_} {
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -5,28 +5,26 @@
|
||||
|
||||
#include <memory>
|
||||
#include <QWidget>
|
||||
#include "yuzu/configuration/configuration_shared.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace ConfigurationShared {
|
||||
enum class CheckState;
|
||||
}
|
||||
|
||||
namespace Ui {
|
||||
class ConfigureGraphicsAdvanced;
|
||||
}
|
||||
|
||||
class ConfigureGraphicsAdvanced : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
class ConfigureGraphicsAdvanced : public ConfigurationShared::Tab {
|
||||
public:
|
||||
explicit ConfigureGraphicsAdvanced(const Core::System& system_, QWidget* parent = nullptr);
|
||||
explicit ConfigureGraphicsAdvanced(
|
||||
const Core::System& system_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
QWidget* parent = nullptr);
|
||||
~ConfigureGraphicsAdvanced() override;
|
||||
|
||||
void ApplyConfiguration();
|
||||
void SetConfiguration();
|
||||
void ApplyConfiguration() override;
|
||||
void SetConfiguration() override;
|
||||
|
||||
void ExposeComputeOption();
|
||||
|
||||
|
@ -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();
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <forward_list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -13,6 +14,7 @@
|
||||
#include "core/file_sys/vfs_types.h"
|
||||
#include "vk_device_info.h"
|
||||
#include "yuzu/configuration/config.h"
|
||||
#include "yuzu/configuration/configuration_shared.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
@ -73,7 +75,7 @@ private:
|
||||
std::unique_ptr<Config> game_config;
|
||||
|
||||
Core::System& system;
|
||||
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group;
|
||||
std::unique_ptr<ConfigurePerGameAddons> addons_tab;
|
||||
std::unique_ptr<ConfigureAudio> audio_tab;
|
||||
std::unique_ptr<ConfigureCpu> cpu_tab;
|
||||
|
@ -37,8 +37,10 @@ static bool IsValidLocale(u32 region_index, u32 language_index) {
|
||||
return ((LOCALE_BLOCKLIST.at(region_index) >> language_index) & 1) == 0;
|
||||
}
|
||||
|
||||
ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent)
|
||||
: QWidget(parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} {
|
||||
ConfigureSystem::ConfigureSystem(
|
||||
Core::System& system_, std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
QWidget* parent)
|
||||
: Tab(group, parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} {
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->rng_seed_checkbox, &QCheckBox::stateChanged, this, [this](int state) {
|
||||
|
@ -6,28 +6,25 @@
|
||||
#include <memory>
|
||||
|
||||
#include <QWidget>
|
||||
#include "yuzu/configuration/configuration_shared.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace ConfigurationShared {
|
||||
enum class CheckState;
|
||||
}
|
||||
|
||||
namespace Ui {
|
||||
class ConfigureSystem;
|
||||
}
|
||||
|
||||
class ConfigureSystem : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
class ConfigureSystem : public ConfigurationShared::Tab {
|
||||
public:
|
||||
explicit ConfigureSystem(Core::System& system_, QWidget* parent = nullptr);
|
||||
explicit ConfigureSystem(Core::System& system_,
|
||||
std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group,
|
||||
QWidget* parent = nullptr);
|
||||
~ConfigureSystem() override;
|
||||
|
||||
void ApplyConfiguration();
|
||||
void SetConfiguration();
|
||||
void ApplyConfiguration() override;
|
||||
void SetConfiguration() override;
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent* event) override;
|
||||
|
Loading…
Reference in New Issue
Block a user