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