diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-28 22:48:30 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-28 22:48:30 -0500 |
commit | e1703aea3fd597b23bde90e6c505278c517be611 (patch) | |
tree | 37d98fc90c9cd0844388bfb79beda2204f44af92 /src/settings.hpp | |
parent | fd53a76bf6f53a095a639765923a30f2206b2cd6 (diff) | |
parent | e02107feea8214a045e6faa969f00dcbc0d2b072 (diff) | |
download | abaddon-portaudio-e1703aea3fd597b23bde90e6c505278c517be611.tar.gz abaddon-portaudio-e1703aea3fd597b23bde90e6c505278c517be611.zip |
merge master
Diffstat (limited to 'src/settings.hpp')
-rw-r--r-- | src/settings.hpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/settings.hpp b/src/settings.hpp new file mode 100644 index 0000000..ca2303f --- /dev/null +++ b/src/settings.hpp @@ -0,0 +1,55 @@ +#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 }; + + // [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 + + // [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 + std::string LinkColor { "rgba(40, 200, 180, 255)" }; + std::string ChannelsExpanderColor { "rgba(255, 83, 112, 255)" }; + std::string NSFWChannelColor { "#ed6666" }; + }; + + SettingsManager(const std::string &filename); + + void Close(); + 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; +}; |