diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-09-04 02:31:10 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-09-04 02:31:10 +0200 |
commit | fa815c3eee27cdae69b2e765b03de62a13f6379d (patch) | |
tree | 4244ae7b62e2c94d749f0b199dd620bdd251dad0 /include | |
parent | dd4573e05cdfa2d9b99ef7a49c99e27c201da3e9 (diff) |
Make font sizes customizable with a config file, see example-config.json. Remove environment variables
Diffstat (limited to 'include')
-rw-r--r-- | include/Config.hpp | 45 | ||||
-rw-r--r-- | include/Theme.hpp | 6 | ||||
-rw-r--r-- | include/Utils.hpp | 2 |
3 files changed, 48 insertions, 5 deletions
diff --git a/include/Config.hpp b/include/Config.hpp new file mode 100644 index 0000000..0cdabe9 --- /dev/null +++ b/include/Config.hpp @@ -0,0 +1,45 @@ +#pragma once + +#include <string> + +namespace QuickMedia { + struct SearchConfig { + int font_size = 16; + }; + + struct TabConfig { + int font_size = 16; + }; + + struct BodyConfig { + int title_font_size = 16; + int author_font_size = 14; + int description_font_size = 14; + int timestamp_font_size = 10; + int reaction_font_size = 14; + int progress_font_size = 14; + int replies_font_size = 14; + int embedded_load_font_size = 14; + }; + + struct InputConfig { + int font_size = 16; + }; + + struct Config { + Config() = default; + Config(const Config&) = delete; + Config&operator=(const Config&) = delete; + + SearchConfig search; + TabConfig tab; + BodyConfig body; + InputConfig input; + bool use_system_fonts = false; + std::string theme = "default"; + float scale = 1.0f; + float font_scale = 1.0f; + }; + + const Config& get_config(); +}
\ No newline at end of file diff --git a/include/Theme.hpp b/include/Theme.hpp index 3b49b4f..25372a6 100644 --- a/include/Theme.hpp +++ b/include/Theme.hpp @@ -5,8 +5,8 @@ namespace QuickMedia { struct Theme { Theme() = default; - Theme(Theme&) = delete; - Theme&operator=(Theme&) = delete; + Theme(const Theme&) = delete; + Theme&operator=(const Theme&) = delete; sf::Color background_color; sf::Color text_color; @@ -35,5 +35,5 @@ namespace QuickMedia { }; void init_themes(); - Theme& get_current_theme(); + const Theme& get_current_theme(); } diff --git a/include/Utils.hpp b/include/Utils.hpp index 08bf4db..0bdf69f 100644 --- a/include/Utils.hpp +++ b/include/Utils.hpp @@ -4,8 +4,6 @@ #include <string> namespace QuickMedia { - float get_ui_scale(); - float get_font_scale(); void show_virtual_keyboard(); void hide_virtual_keyboard(); bool is_touch_enabled(); |