settings: Add UiGeneral class

This commit is contained in:
lat9nq 2023-05-09 01:35:25 -04:00
parent ea4afbfc54
commit 464aad52cd
4 changed files with 16 additions and 7 deletions

View file

@ -144,6 +144,9 @@ float Volume() {
return values.volume.GetValue() / static_cast<f32>(values.volume.GetDefault()); return values.volume.GetValue() / static_cast<f32>(values.volume.GetDefault());
} }
Linkage::Linkage() = default;
Linkage::~Linkage() = default;
const char* TranslateCategory(Category category) { const char* TranslateCategory(Category category) {
switch (category) { switch (category) {
case Category::Audio: case Category::Audio:
@ -176,6 +179,7 @@ const char* TranslateCategory(Category category) {
case Category::Controls: case Category::Controls:
return "Controls"; return "Controls";
case Category::Ui: case Category::Ui:
case Category::UiGeneral:
return "UI"; return "UI";
case Category::UiLayout: case Category::UiLayout:
return "UiLayout"; return "UiLayout";

View file

@ -143,6 +143,7 @@ enum class Category : u32 {
AddOns, AddOns,
Controls, Controls,
Ui, Ui,
UiGeneral,
UiLayout, UiLayout,
UiGameList, UiGameList,
Screenshots, Screenshots,
@ -209,8 +210,10 @@ public:
class Linkage { class Linkage {
public: public:
std::map<Category, std::forward_list<BasicSetting*>> by_category; explicit Linkage();
std::vector<std::function<void()>> restore_functions; ~Linkage();
std::map<Category, std::forward_list<BasicSetting*>> by_category{};
std::vector<std::function<void()>> restore_functions{};
u32 count; u32 count;
}; };

View file

@ -717,6 +717,7 @@ void Config::ReadUIValues() {
ReadMultiplayerValues(); ReadMultiplayerValues();
ReadCategory(Settings::Category::Ui); ReadCategory(Settings::Category::Ui);
ReadCategory(Settings::Category::UiGeneral);
qt_config->endGroup(); qt_config->endGroup();
} }

View file

@ -78,17 +78,18 @@ struct Values {
Setting<bool> show_filter_bar{linkage, true, "showFilterBar", Category::Ui}; Setting<bool> show_filter_bar{linkage, true, "showFilterBar", Category::Ui};
Setting<bool> show_status_bar{linkage, true, "showStatusBar", Category::Ui}; Setting<bool> show_status_bar{linkage, true, "showStatusBar", Category::Ui};
Setting<bool> confirm_before_closing{linkage, true, "confirmClose", Category::Ui}; Setting<bool> confirm_before_closing{linkage, true, "confirmClose", Category::UiGeneral};
Setting<bool> first_start{linkage, true, "firstStart", Category::Ui}; Setting<bool> first_start{linkage, true, "firstStart", Category::Ui};
Setting<bool> pause_when_in_background{linkage, false, "pauseWhenInBackground", Category::Ui}; Setting<bool> pause_when_in_background{linkage, false, "pauseWhenInBackground",
Category::UiGeneral};
Setting<bool> mute_when_in_background{linkage, false, "muteWhenInBackground", Category::Ui}; Setting<bool> mute_when_in_background{linkage, false, "muteWhenInBackground", Category::Ui};
Setting<bool> hide_mouse{linkage, true, "hideInactiveMouse", Category::Ui}; Setting<bool> hide_mouse{linkage, true, "hideInactiveMouse", Category::UiGeneral};
Setting<bool> controller_applet_disabled{linkage, false, "disableControllerApplet", Setting<bool> controller_applet_disabled{linkage, false, "disableControllerApplet",
Category::Ui}; Category::UiGeneral};
// Set when Vulkan is known to crash the application // Set when Vulkan is known to crash the application
bool has_broken_vulkan = false; bool has_broken_vulkan = false;
Setting<bool> select_user_on_boot{linkage, false, "select_user_on_boot", Category::Ui}; Setting<bool> select_user_on_boot{linkage, false, "select_user_on_boot", Category::UiGeneral};
Setting<bool> disable_web_applet{linkage, true, "disable_web_applet", Category::Ui}; Setting<bool> disable_web_applet{linkage, true, "disable_web_applet", Category::Ui};
// Discord RPC // Discord RPC