qt: Use generated setting keys for uisettings instead of hardcoded string literals

This commit is contained in:
OpenSauce04
2026-07-10 13:04:08 +01:00
committed by OpenSauce
parent f0115effff
commit a2a71ebb60
2 changed files with 65 additions and 31 deletions
+31
View File
@@ -218,6 +218,37 @@ if (ENABLE_QT)
"libvorbis"
"Context"
"favorites"
"microProfileDialogVisible"
"singleWindowMode"
"fullscreen"
"displayTitleBars"
"showFilterBar"
"showStatusBar"
"show_advanced_frametime_info"
"confirmClose"
"saveStateWarning"
"firstStart"
"pauseWhenInBackground"
"muteWhenInBackground"
"hideInactiveMouse"
"check_for_update_on_start"
"update_check_channel"
"inserted_cartridge"
"enable_discord_presence"
"iconSize"
"row1" # The keys for this and...
"row2" # this suck ass.
"hideNoIcon"
"singleLineMode"
"show_compat_column"
"show_region_column"
"show_type_column"
"show_size_column"
"show_play_time_column"
"screenshot_resolution_factor"
"screenshotPath"
"calloutFlags"
"showConsole"
)
set(SETTING_KEY_LIST "${SETTING_KEY_LIST}\n\"${KEY}\",")
set(SETTING_KEY_DEFINITIONS "${SETTING_KEY_DEFINITIONS}\nDEFINE_KEY(${KEY})")
+34 -31
View File
@@ -74,51 +74,54 @@ struct Values {
QByteArray gamelist_header_state;
QByteArray microprofile_geometry;
Settings::Setting<bool> microprofile_visible{false, "microProfileDialogVisible"};
Settings::Setting<bool> microprofile_visible{false, Settings::Keys::microProfileDialogVisible};
Settings::Setting<bool> single_window_mode{true, "singleWindowMode"};
Settings::Setting<bool> fullscreen{false, "fullscreen"};
Settings::Setting<bool> display_titlebar{true, "displayTitleBars"};
Settings::Setting<bool> show_filter_bar{true, "showFilterBar"};
Settings::Setting<bool> show_status_bar{true, "showStatusBar"};
Settings::Setting<bool> show_advanced_frametime_info{false, "show_advanced_frametime_info"};
Settings::Setting<bool> single_window_mode{true, Settings::Keys::singleWindowMode};
Settings::Setting<bool> fullscreen{false, Settings::Keys::fullscreen};
Settings::Setting<bool> display_titlebar{true, Settings::Keys::displayTitleBars};
Settings::Setting<bool> show_filter_bar{true, Settings::Keys::showFilterBar};
Settings::Setting<bool> show_status_bar{true, Settings::Keys::showStatusBar};
Settings::Setting<bool> show_advanced_frametime_info{
false, Settings::Keys::show_advanced_frametime_info};
Settings::Setting<bool> confirm_before_closing{true, "confirmClose"};
Settings::Setting<bool> save_state_warning{true, "saveStateWarning"};
Settings::Setting<bool> first_start{true, "firstStart"};
Settings::Setting<bool> pause_when_in_background{false, "pauseWhenInBackground"};
Settings::Setting<bool> mute_when_in_background{false, "muteWhenInBackground"};
Settings::Setting<bool> hide_mouse{false, "hideInactiveMouse"};
Settings::Setting<bool> confirm_before_closing{true, Settings::Keys::confirmClose};
Settings::Setting<bool> save_state_warning{true, Settings::Keys::saveStateWarning};
Settings::Setting<bool> first_start{true, Settings::Keys::firstStart};
Settings::Setting<bool> pause_when_in_background{false, Settings::Keys::pauseWhenInBackground};
Settings::Setting<bool> mute_when_in_background{false, Settings::Keys::muteWhenInBackground};
Settings::Setting<bool> hide_mouse{false, Settings::Keys::hideInactiveMouse};
#ifdef ENABLE_QT_UPDATE_CHECKER
Settings::Setting<bool> check_for_update_on_start{true, "check_for_update_on_start"};
Settings::Setting<bool> check_for_update_on_start{true,
Settings::Keys::check_for_update_on_start};
Settings::Setting<int> update_check_channel{UpdateCheckChannels::STABLE,
"update_check_channel"};
Settings::Keys::update_check_channel};
#endif
Settings::Setting<std::string> inserted_cartridge{"", "inserted_cartridge"};
Settings::Setting<std::string> inserted_cartridge{"", Settings::Keys::inserted_cartridge};
#ifdef ENABLE_DISCORD_RPC
// Discord RPC
Settings::Setting<bool> enable_discord_presence{true, "enable_discord_presence"};
Settings::Setting<bool> enable_discord_presence{true, Settings::Keys::enable_discord_presence};
#endif
// Game List
Settings::Setting<GameListIconSize> game_list_icon_size{GameListIconSize::LargeIcon,
"iconSize"};
Settings::Setting<GameListText> game_list_row_1{GameListText::TitleName, "row1"};
Settings::Setting<GameListText> game_list_row_2{GameListText::FileName, "row2"};
Settings::Setting<bool> game_list_hide_no_icon{false, "hideNoIcon"};
Settings::Setting<bool> game_list_single_line_mode{false, "singleLineMode"};
Settings::Keys::iconSize};
Settings::Setting<GameListText> game_list_row_1{GameListText::TitleName, Settings::Keys::row1};
Settings::Setting<GameListText> game_list_row_2{GameListText::FileName, Settings::Keys::row2};
Settings::Setting<bool> game_list_hide_no_icon{false, Settings::Keys::hideNoIcon};
Settings::Setting<bool> game_list_single_line_mode{false, Settings::Keys::singleLineMode};
// Compatibility List
Settings::Setting<bool> show_compat_column{true, "show_compat_column"};
Settings::Setting<bool> show_region_column{true, "show_region_column"};
Settings::Setting<bool> show_type_column{true, "show_type_column"};
Settings::Setting<bool> show_size_column{true, "show_size_column"};
Settings::Setting<bool> show_play_time_column{true, "show_play_time_column"};
Settings::Setting<bool> show_compat_column{true, Settings::Keys::show_compat_column};
Settings::Setting<bool> show_region_column{true, Settings::Keys::show_region_column};
Settings::Setting<bool> show_type_column{true, Settings::Keys::show_type_column};
Settings::Setting<bool> show_size_column{true, Settings::Keys::show_size_column};
Settings::Setting<bool> show_play_time_column{true, Settings::Keys::show_play_time_column};
Settings::Setting<u16> screenshot_resolution_factor{0, "screenshot_resolution_factor"};
Settings::SwitchableSetting<std::string> screenshot_path{"", "screenshotPath"};
Settings::Setting<u16> screenshot_resolution_factor{
0, Settings::Keys::screenshot_resolution_factor};
Settings::SwitchableSetting<std::string> screenshot_path{"", Settings::Keys::screenshotPath};
QString roms_path;
QString symbols_path;
@@ -139,7 +142,7 @@ struct Values {
// Shortcut name <Shortcut, context>
std::vector<Shortcut> shortcuts;
Settings::Setting<u32> callout_flags{0, "calloutFlags"};
Settings::Setting<u32> callout_flags{0, Settings::Keys::calloutFlags};
// multiplayer settings
QString nickname;
@@ -160,7 +163,7 @@ struct Values {
bool multiplayer_filter_hide_full;
// logging
Settings::Setting<bool> show_console{false, "showConsole"};
Settings::Setting<bool> show_console{false, Settings::Keys::showConsole};
bool shortcut_already_warned = false;
};