blob: 7c6368fb151c198eb6f6f2e6c4f6f381c794bab9 (
plain)
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
|
#pragma once
#include <string>
#include <type_traits>
#include <glibmm/keyfile.h>
class SettingsManager {
public:
struct Settings {
// [discord]
std::string APIBaseURL { "https://discord.com/api/v9" };
std::string GatewayURL { "wss://gateway.discord.gg/?v=9&encoding=json&compress=zlib-stream" };
std::string DiscordToken;
bool UseMemoryDB { false };
bool Prefetch { false };
bool Autoconnect { false };
// [gui]
std::string MainCSS { "main.css" };
bool AnimatedGuildHoverOnly { true };
bool ShowAnimations { true };
bool ShowCustomEmojis { true };
bool ShowMemberListDiscriminators { true };
bool ShowOwnerCrown { true };
bool SaveState { true };
#ifdef _WIN32
bool ShowStockEmojis { false };
#else
bool ShowStockEmojis { true };
#endif
bool Unreads { true };
bool AltMenu { false };
bool HideToTray { false };
double FontScale { -1.0 };
// [http]
int CacheHTTPConcurrency { 20 };
std::string UserAgent { "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36" };
// [style]
// TODO: convert to StyleProperty... or maybe not? i still cant figure out what the "correct" method is for this
std::string LinkColor { "rgba(40, 200, 180, 255)" };
std::string ChannelsExpanderColor { "rgba(255, 83, 112, 255)" };
std::string NSFWChannelColor { "#ed6666" };
std::string ChannelColor { "#fbfbfb" };
std::string MentionBadgeColor { "#b82525" };
std::string MentionBadgeTextColor { "#fbfbfb" };
std::string UnreadIndicatorColor { "#ffffff" };
// [notifications]
#ifdef _WIN32
bool NotificationsEnabled { false };
#else
bool NotificationsEnabled { true };
#endif
bool NotificationsPlaySound { true };
// [voice]
#ifdef WITH_RNNOISE
std::string VAD { "rnnoise" };
#else
std::string VAD { "gate" };
#endif
// [windows]
bool HideConsole { false };
};
SettingsManager(const std::string &filename);
void Close();
[[nodiscard]] bool IsValid() const;
Settings &GetSettings();
private:
void ReadSettings();
bool m_ok;
std::string m_filename;
Glib::KeyFile m_file;
Settings m_settings;
Settings m_read_settings;
};
|