uisettings.h 4.9 KB

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