diff src/gui/translate/config.cc @ 279:657fda1b9cac

*: clean up enums
author Paper <paper@paper.us.eu.org>
date Fri, 19 Apr 2024 13:24:06 -0400
parents 862d0d8619f6
children b1f625b0227c
line wrap: on
line diff
--- a/src/gui/translate/config.cc	Thu Apr 18 17:24:42 2024 -0400
+++ b/src/gui/translate/config.cc	Fri Apr 19 13:24:06 2024 -0400
@@ -1,28 +1,40 @@
 #include "core/config.h"
+#include "core/strings.h"
 #include "gui/translate/config.h"
 
+#include <QCoreApplication>
+
 #include <unordered_map>
 
 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 }
+Theme::Theme ToTheme(const std::string& theme) {
+	const std::unordered_map<std::string, Theme::Theme> map = {
+	    {"Default", Theme::Theme::Default   },
+        {"Light",   Theme::Theme::Light},
+        {"Dark",    Theme::Theme::Dark }
     };
 
 	if (map.find(theme) == map.end())
-		return Themes::OS;
+		return Theme::Theme::Default;
 	return map.at(theme);
 }
 
-std::string ToString(const Themes& theme) {
+std::string ToString(const Theme::Theme& theme) {
 	switch (theme) {
 		default:
-		case Themes::OS: return "Default";
-		case Themes::LIGHT: return "Light";
-		case Themes::DARK: return "Dark";
+		case Theme::Theme::Default: return "Default";
+		case Theme::Theme::Light: return "Light";
+		case Theme::Theme::Dark: return "Dark";
+	}
+}
+
+std::string ToLocalString(const Theme::Theme& theme) {
+	switch (theme) {
+		default:
+		case Theme::Theme::Default: return Strings::ToUtf8String(QCoreApplication::tr("Default"));
+		case Theme::Theme::Light: return Strings::ToUtf8String(QCoreApplication::tr("Light"));
+		case Theme::Theme::Dark: return Strings::ToUtf8String(QCoreApplication::tr("Dark"));
 	}
 }