uisettings.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // SPDX-FileCopyrightText: 2016 Citra Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <array>
  5. #include <atomic>
  6. #include <vector>
  7. #include <QByteArray>
  8. #include <QMetaType>
  9. #include <QString>
  10. #include <QStringList>
  11. #include <QVector>
  12. #include "common/common_types.h"
  13. #include "common/settings.h"
  14. namespace UISettings {
  15. bool IsDarkTheme();
  16. struct ContextualShortcut {
  17. QString keyseq;
  18. QString controller_keyseq;
  19. int context;
  20. };
  21. struct Shortcut {
  22. QString name;
  23. QString group;
  24. ContextualShortcut shortcut;
  25. };
  26. enum class Theme {
  27. Default,
  28. DefaultColorful,
  29. Dark,
  30. DarkColorful,
  31. MidnightBlue,
  32. MidnightBlueColorful,
  33. };
  34. using Themes = std::array<std::pair<const char*, const char*>, 6>;
  35. extern const Themes themes;
  36. struct GameDir {
  37. QString path;
  38. bool deep_scan = false;
  39. bool expanded = false;
  40. bool operator==(const GameDir& rhs) const {
  41. return path == rhs.path;
  42. }
  43. bool operator!=(const GameDir& rhs) const {
  44. return !operator==(rhs);
  45. }
  46. };
  47. struct Values {
  48. QByteArray geometry;
  49. QByteArray state;
  50. QByteArray renderwindow_geometry;
  51. QByteArray gamelist_header_state;
  52. QByteArray microprofile_geometry;
  53. Settings::Setting<bool> microprofile_visible{false, "microProfileDialogVisible"};
  54. Settings::Setting<bool> single_window_mode{true, "singleWindowMode"};
  55. Settings::Setting<bool> fullscreen{false, "fullscreen"};
  56. Settings::Setting<bool> display_titlebar{true, "displayTitleBars"};
  57. Settings::Setting<bool> show_filter_bar{true, "showFilterBar"};
  58. Settings::Setting<bool> show_status_bar{true, "showStatusBar"};
  59. Settings::Setting<bool> confirm_before_closing{true, "confirmClose"};
  60. Settings::Setting<bool> first_start{true, "firstStart"};
  61. Settings::Setting<bool> pause_when_in_background{false, "pauseWhenInBackground"};
  62. Settings::Setting<bool> mute_when_in_background{false, "muteWhenInBackground"};
  63. Settings::Setting<bool> hide_mouse{true, "hideInactiveMouse"};
  64. // Set when Vulkan is known to crash the application
  65. bool has_broken_vulkan = false;
  66. Settings::Setting<bool> select_user_on_boot{false, "select_user_on_boot"};
  67. // Discord RPC
  68. Settings::Setting<bool> enable_discord_presence{true, "enable_discord_presence"};
  69. Settings::Setting<bool> enable_screenshot_save_as{true, "enable_screenshot_save_as"};
  70. QString roms_path;
  71. QString symbols_path;
  72. QString game_dir_deprecated;
  73. bool game_dir_deprecated_deepscan;
  74. QVector<UISettings::GameDir> game_dirs;
  75. QStringList recent_files;
  76. QString language;
  77. QString theme;
  78. // Shortcut name <Shortcut, context>
  79. std::vector<Shortcut> shortcuts;
  80. Settings::Setting<uint32_t> callout_flags{0, "calloutFlags"};
  81. // multiplayer settings
  82. Settings::Setting<QString> multiplayer_nickname{{}, "nickname"};
  83. Settings::Setting<QString> multiplayer_ip{{}, "ip"};
  84. Settings::SwitchableSetting<uint, true> multiplayer_port{24872, 0, UINT16_MAX, "port"};
  85. Settings::Setting<QString> multiplayer_room_nickname{{}, "room_nickname"};
  86. Settings::Setting<QString> multiplayer_room_name{{}, "room_name"};
  87. Settings::SwitchableSetting<uint, true> multiplayer_max_player{8, 0, 8, "max_player"};
  88. Settings::SwitchableSetting<uint, true> multiplayer_room_port{24872, 0, UINT16_MAX,
  89. "room_port"};
  90. Settings::SwitchableSetting<uint, true> multiplayer_host_type{0, 0, 1, "host_type"};
  91. Settings::Setting<qulonglong> multiplayer_game_id{{}, "game_id"};
  92. Settings::Setting<QString> multiplayer_room_description{{}, "room_description"};
  93. std::pair<std::vector<std::string>, std::vector<std::string>> multiplayer_ban_list;
  94. // logging
  95. Settings::Setting<bool> show_console{false, "showConsole"};
  96. // Game List
  97. Settings::Setting<bool> show_add_ons{true, "show_add_ons"};
  98. Settings::Setting<uint32_t> game_icon_size{64, "game_icon_size"};
  99. Settings::Setting<uint32_t> folder_icon_size{48, "folder_icon_size"};
  100. Settings::Setting<uint8_t> row_1_text_id{3, "row_1_text_id"};
  101. Settings::Setting<uint8_t> row_2_text_id{2, "row_2_text_id"};
  102. std::atomic_bool is_game_list_reload_pending{false};
  103. Settings::Setting<bool> cache_game_list{true, "cache_game_list"};
  104. Settings::Setting<bool> favorites_expanded{true, "favorites_expanded"};
  105. QVector<u64> favorited_ids;
  106. // Compatibility List
  107. Settings::Setting<bool> show_compat{false, "show_compat"};
  108. // Size & File Types Column
  109. Settings::Setting<bool> show_size{true, "show_size"};
  110. Settings::Setting<bool> show_types{true, "show_types"};
  111. bool configuration_applied;
  112. bool reset_to_defaults;
  113. Settings::Setting<bool> disable_web_applet{true, "disable_web_applet"};
  114. };
  115. extern Values values;
  116. } // namespace UISettings
  117. Q_DECLARE_METATYPE(UISettings::GameDir*);