# HG changeset patch # User Paper # Date 1698810970 14400 # Node ID 29e2840d9b7b49a4e1d10d3a2c9fcc35ef1c5a83 # Parent c4bb49c2f6ebd515d876c0ce4226333025ca7edd *: oops diff -r c4bb49c2f6eb -r 29e2840d9b7b include/gui/translate/config.h --- /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 diff -r c4bb49c2f6eb -r 29e2840d9b7b src/gui/translate/config.cc --- /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 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"; + } +} + +}