|
| 1 | +#ifndef NEVOLUTIONX_THEME_H |
| 2 | +#define NEVOLUTIONX_THEME_H |
| 3 | + |
| 4 | +#include <string> |
| 5 | + |
| 6 | +#pragma clang diagnostic push |
| 7 | +#pragma clang diagnostic ignored "-Wreturn-type" |
| 8 | +#include "../3rdparty/json.hpp" |
| 9 | +#pragma clang diagnostic pop |
| 10 | + |
| 11 | + |
| 12 | +class Theme { |
| 13 | +public: |
| 14 | + struct MenuTheme { |
| 15 | + std::string font; |
| 16 | + // TODO: Actually support this in Font. |
| 17 | + unsigned int fontColor; |
| 18 | + }; |
| 19 | + |
| 20 | + struct ImageSet { |
| 21 | + std::string image480p; |
| 22 | + std::string image720p; |
| 23 | + }; |
| 24 | + |
| 25 | + explicit Theme(std::string themeDirectory); |
| 26 | + |
| 27 | + void setTitle(std::string const& val) { title = val; } |
| 28 | + std::string const& getTitle() const { return title; } |
| 29 | + |
| 30 | + void setBackground(ImageSet const& val) { background = val; } |
| 31 | + ImageSet const& getBackground() const { return background; } |
| 32 | + |
| 33 | + void setMenu(MenuTheme const& val) { menu = val; } |
| 34 | + MenuTheme const& getMenu() const { return menu; } |
| 35 | + |
| 36 | + std::string getAbsolutePath(std::string const& subpath) const { |
| 37 | + return rootPath + subpath; |
| 38 | + } |
| 39 | + |
| 40 | +private: |
| 41 | + void load(); |
| 42 | + |
| 43 | + std::string rootPath; |
| 44 | + std::string title{ "??MISSING??" }; |
| 45 | + ImageSet background; |
| 46 | + MenuTheme menu; |
| 47 | +}; |
| 48 | + |
| 49 | +void to_json(nlohmann::json& j, Theme const& o); |
| 50 | +void from_json(nlohmann::json const& j, Theme& o); |
| 51 | + |
| 52 | +void to_json(nlohmann::json& j, Theme::MenuTheme const& o); |
| 53 | +void from_json(nlohmann::json const& j, Theme::MenuTheme& o); |
| 54 | + |
| 55 | +void to_json(nlohmann::json& j, Theme::ImageSet const& o); |
| 56 | +void from_json(nlohmann::json const& j, Theme::ImageSet& o); |
| 57 | + |
| 58 | +#endif // NEVOLUTIONX_THEME_H |
0 commit comments