annotate src/gui/translate/config.cc @ 198:bc1ae1810855

dep/animia: switch from using classes to global functions the old idea was ok, but sort of hackish; this method doesn't use classes at all, and this way (especially important!) we can do wayland stuff AND x11 at the same time, which wasn't really possible without stupid workarounds in the other method
author Paper <mrpapersonic@gmail.com>
date Sun, 24 Dec 2023 02:59:42 -0500
parents 29e2840d9b7b
children 71832ffe425a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
91
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include "core/config.h"
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #include "gui/translate/config.h"
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
3
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4 namespace Translate {
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
6 Themes ToTheme(const std::string& theme) {
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7 const std::unordered_map<std::string, Themes> map = {
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
8 {"Default", Themes::OS },
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9 {"Light", Themes::LIGHT},
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 {"Dark", Themes::DARK }
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11 };
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13 if (map.find(theme) == map.end())
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 return Themes::OS;
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 return map.at(theme);
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 }
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18 std::string ToString(const Themes& theme) {
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
19 switch (theme) {
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20 default:
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 case Themes::OS: return "Default";
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 case Themes::LIGHT: return "Light";
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 case Themes::DARK: return "Dark";
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24 }
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 }
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26
29e2840d9b7b *: oops
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27 }