Mercurial > minori
diff src/gui/translate/config.cc @ 301:b1f625b0227c
*: convert all files CRLF -> LF
some files were in DOS format, others were in unix. now everything
(that at least is under our control) should all be the same format
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 13 May 2024 15:04:51 -0400 |
parents | 657fda1b9cac |
children | c32467cd06bb |
line wrap: on
line diff
--- a/src/gui/translate/config.cc Mon May 13 14:56:37 2024 -0400 +++ b/src/gui/translate/config.cc Mon May 13 15:04:51 2024 -0400 @@ -1,41 +1,41 @@ -#include "core/config.h" -#include "core/strings.h" -#include "gui/translate/config.h" - -#include <QCoreApplication> - -#include <unordered_map> - -namespace Translate { - -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 Theme::Theme::Default; - return map.at(theme); -} - -std::string ToString(const Theme::Theme& theme) { - switch (theme) { - default: - 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")); - } -} - -} // namespace Translate +#include "core/config.h" +#include "core/strings.h" +#include "gui/translate/config.h" + +#include <QCoreApplication> + +#include <unordered_map> + +namespace Translate { + +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 Theme::Theme::Default; + return map.at(theme); +} + +std::string ToString(const Theme::Theme& theme) { + switch (theme) { + default: + 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")); + } +} + +} // namespace Translate