Debian Codegraph @

Source/Core/DolphinQt/Settings.h

raw symbols SCIP
1 // Copyright 2015 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include <memory>
7
8 #include <QFont>
9 #include <QObject>
10 #include <QRadioButton>
11 #include <QSettings>
12
13 #include "Common/Config/Config.h"
14 #include "Common/HookableEvent.h"
15 #include "Core/Config/MainSettings.h"
16 #include "DiscIO/Enums.h"
17
18 namespace Core
19 {
20 enum class State;
21 }
22
23 namespace DiscIO
24 {
25 enum class Language;
26 }
27
28 namespace NetPlay
29 {
30 class NetPlayClient;
31 class NetPlayServer;
32 } // namespace NetPlay
33
34 class InputConfig;
35
36 // UI settings to be stored in the config directory.
37 class Settings final : public QObject
38 {
39 Q_OBJECT
40
41 public:
42 Settings(const Settings&) = delete;
43 Settings& operator=(const Settings&) = delete;
44 Settings(Settings&&) = delete;
45 Settings& operator=(Settings&&) = delete;
46
47 ~Settings() override;
48
49 void UnregisterDevicesChangedCallback();
50
51 static Settings& Instance();
52 static QSettings& GetQSettings();
53
54 // UI
55 void TriggerThemeChanged();
56 void InitDefaultPalette();
57 bool IsSystemDark();
58 bool IsThemeDark();
59
60 void SetUserStyleName(const QString& stylesheet_name);
61 QString GetUserStyleName() const;
62
63 enum class StyleType : int
64 {
65 System = 0,
66 Light = 1,
67 Dark = 2,
68 User = 3,
69 FusionLight = 4,
70 FusionDarkGray = 5,
71 FusionDark = 6,
72
73 MinValue = 0,
74 MaxValue = 6,
75 };
76
77 void SetStyleType(StyleType type);
78 StyleType GetStyleType() const;
79
80 // this evaluates the current stylesheet settings and refreshes the GUI with them
81 void ApplyStyle();
82
83 void GetToolTipStyle(QColor& window_color, QColor& text_color, QColor& emphasis_text_color,
84 QColor& border_color, const QPalette& palette,
85 const QPalette& high_contrast_palette) const;
86
87 bool IsLogVisible() const;
88 void SetLogVisible(bool visible);
89 bool IsLogConfigVisible() const;
90 void SetLogConfigVisible(bool visible);
91 void SetToolBarVisible(bool visible);
92 bool IsToolBarVisible() const;
93 void SetWidgetsLocked(bool visible);
94 bool AreWidgetsLocked() const;
95
96 void RefreshWidgetVisibility();
97
98 // GameList
99 QStringList GetPaths() const;
100 void AddPath(const QString& path);
101 void RemovePath(const QString& path);
102 bool GetPreferredView() const;
103 void SetPreferredView(bool list);
104 QString GetDefaultGame() const;
105 void SetDefaultGame(const QString& path);
106 void RefreshGameList();
107 void NotifyRefreshGameListStarted();
108 void NotifyRefreshGameListComplete();
109 void NotifyMetadataRefreshComplete();
110 void ReloadTitleDB();
111 bool IsAutoRefreshEnabled() const;
112 void SetAutoRefreshEnabled(bool enabled);
113 bool IsGameCountVisible() const;
114 void SetGameCountVisible(bool visible);
115
116 // Emulation
117 int GetStateSlot() const;
118 void SetStateSlot(int);
119 bool IsBatchModeEnabled() const;
120 void SetBatchModeEnabled(bool batch);
121
122 bool IsSDCardInserted() const;
123 void SetSDCardInserted(bool inserted);
124 bool IsUSBKeyboardConnected() const;
125 void SetUSBKeyboardConnected(bool connected);
126
127 bool IsWiiSpeakMuted() const;
128 void SetWiiSpeakMuted(bool muted);
129
130 void SetIsContinuouslyFrameStepping(bool is_stepping);
131 bool GetIsContinuouslyFrameStepping() const;
132
133 // Graphics
134 Config::ShowCursor GetCursorVisibility() const;
135 bool GetLockCursor() const;
136 void SetKeepWindowOnTop(bool top);
137 bool IsKeepWindowOnTopEnabled() const;
138 bool GetGraphicModsEnabled() const;
139 void SetGraphicModsEnabled(bool enabled);
140
141 // Audio
142 int GetVolume() const;
143 void SetVolume(int volume);
144 void IncreaseVolume(int volume);
145 void DecreaseVolume(int volume);
146
147 // NetPlay
148 std::shared_ptr<NetPlay::NetPlayClient> GetNetPlayClient();
149 void ResetNetPlayClient(NetPlay::NetPlayClient* client = nullptr);
150 std::shared_ptr<NetPlay::NetPlayServer> GetNetPlayServer();
151 void ResetNetPlayServer(NetPlay::NetPlayServer* server = nullptr);
152
153 // Cheats
154 bool GetCheatsEnabled() const;
155
156 // Debug
157 void SetDebugModeEnabled(bool enabled);
158 bool IsDebugModeEnabled() const;
159 void SetRegistersVisible(bool enabled);
160 bool IsRegistersVisible() const;
161 void SetThreadsVisible(bool enabled);
162 bool IsThreadsVisible() const;
163 void SetWatchVisible(bool enabled);
164 bool IsWatchVisible() const;
165 void SetBreakpointsVisible(bool enabled);
166 bool IsBreakpointsVisible() const;
167 void SetCodeVisible(bool enabled);
168 bool IsCodeVisible() const;
169 void SetMemoryVisible(bool enabled);
170 bool IsMemoryVisible() const;
171 void SetNetworkVisible(bool enabled);
172 bool IsNetworkVisible() const;
173 void SetJITVisible(bool enabled);
174 bool IsJITVisible() const;
175 void SetAssemblerVisible(bool enabled);
176 bool IsAssemblerVisible() const;
177 QFont GetDebugFont() const;
178 void SetDebugFont(const QFont& font);
179
180 // Auto-Update
181 QString GetAutoUpdateTrack() const;
182 void SetAutoUpdateTrack(const QString& mode);
183
184 // Fallback Region
185 DiscIO::Region GetFallbackRegion() const;
186 void SetFallbackRegion(const DiscIO::Region& region);
187
188 // Analytics
189 bool IsAnalyticsEnabled() const;
190 void SetAnalyticsEnabled(bool enabled);
191
192 signals:
193 void ConfigChanged();
194 void EmulationStateChanged(Core::State new_state);
195 void ThemeChanged();
196 void PathAdded(const QString&);
197 void PathRemoved(const QString&);
198 void DefaultGameChanged(const QString&);
199 void GameListRefreshRequested();
200 void GameListRefreshStarted();
201 void GameListRefreshCompleted();
202 void TitleDBReloadRequested();
203 void MetadataRefreshRequested();
204 void MetadataRefreshCompleted();
205 void AutoRefreshToggled(bool enabled);
206 void CursorVisibilityChanged();
207 void LockCursorChanged();
208 void KeepWindowOnTopChanged(bool top);
209 void NANDRefresh();
210 void RegistersVisibilityChanged(bool visible);
211 void ThreadsVisibilityChanged(bool visible);
212 void LogVisibilityChanged(bool visible);
213 void LogConfigVisibilityChanged(bool visible);
214 void ToolBarVisibilityChanged(bool visible);
215 void WidgetLockChanged(bool locked);
216 void EnableCheatsChanged(bool enabled);
217 void WatchVisibilityChanged(bool visible);
218 void BreakpointsVisibilityChanged(bool visible);
219 void CodeVisibilityChanged(bool visible);
220 void MemoryVisibilityChanged(bool visible);
221 void NetworkVisibilityChanged(bool visible);
222 void JITVisibilityChanged(bool visible);
223 void AssemblerVisibilityChanged(bool visible);
224 void DebugModeToggled(bool enabled);
225 void DebugFontChanged(const QFont& font);
226 void AutoUpdateTrackChanged(const QString& mode);
227 void FallbackRegionChanged(const DiscIO::Region& region);
228 void AnalyticsToggled(bool enabled);
229 void ReleaseDevices();
230 void DevicesChanged();
231 void WiiSpeakMuteChanged(bool muted);
232 void EnableGfxModsChanged(bool enabled);
233 void GameCountVisibilityChanged(bool visible);
234
235 private:
236 Settings();
237
238 bool m_batch = false;
239 std::atomic<bool> m_continuously_frame_stepping = false;
240
241 std::shared_ptr<NetPlay::NetPlayClient> m_client;
242 std::shared_ptr<NetPlay::NetPlayServer> m_server;
243 Common::EventHook m_hotplug_event_hook;
244 Config::ConfigChangedCallbackID m_config_changed_callback_id;
245
246 Common::EventHook m_core_state_changed_hook;
247 };
248
249 Q_DECLARE_METATYPE(Core::State);