Mercurial > minori
changeset 91:29e2840d9b7b
*: oops
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 31 Oct 2023 23:56:10 -0400 |
parents | c4bb49c2f6eb |
children | 2c27582a177c |
files | include/gui/translate/config.h src/gui/translate/config.cc |
diffstat | 2 files changed, 39 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/gui/translate/config.h Tue Oct 31 23:56:10 2023 -0400 @@ -0,0 +1,12 @@ +#ifndef __gui__translate__config_h +#define __gui__translate__config_h +#include "core/config.h" + +namespace Translate { + +Themes ToTheme(const std::string& theme); +std::string ToString(const Themes& theme); + +} + +#endif // __gui__translate__config_h \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gui/translate/config.cc Tue Oct 31 23:56:10 2023 -0400 @@ -0,0 +1,27 @@ +#include "core/config.h" +#include "gui/translate/config.h" + +namespace Translate { + +Themes ToTheme(const std::string& theme) { + const std::unordered_map<std::string, Themes> map = { + {"Default", Themes::OS }, + {"Light", Themes::LIGHT}, + {"Dark", Themes::DARK } + }; + + if (map.find(theme) == map.end()) + return Themes::OS; + return map.at(theme); +} + +std::string ToString(const Themes& theme) { + switch (theme) { + default: + case Themes::OS: return "Default"; + case Themes::LIGHT: return "Light"; + case Themes::DARK: return "Dark"; + } +} + +}