/
pi_coder
/
ByteMachine
Обзор
Документация
Войти
/
pi_coder
/
ByteMachine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/color_themes.cpp
89 строк
2 KB
pimenov-and
Добавлены файлы из старого проекта
12 июл 2026, 20:19
12 июл 2026, 20:19
fbe5753
Код
Авторство
О чём код?
//////////////////////////////////////////////////////////////// // ByteMachine // Цветовые схемы //////////////////////////////////////////////////////////////// #include "color_themes.h" //============================================================== // Перевод цветовой схемы в строку //============================================================== QString colorSchemeToStr(ColorThemes scheme) { switch (scheme) { case ColorThemes::Light: { return "Light"; } case ColorThemes::Dark: { return "Dark"; } default: { return "Unknown"; } } } //============================================================== // Перевод строки в цветовую схему //============================================================== ColorThemes strToColorTheme(const QString &str) { if (str == "Light") { return ColorThemes::Light; } else if (str == "Dark") { return ColorThemes::Dark; } else { return ColorThemes::Unknown; } } //============================================================== // Перевод числа в цветовую схему //============================================================== ColorThemes intToColorTheme(int value) noexcept { switch (value) { case 0: { return ColorThemes::Light; } case 1: { return ColorThemes::Dark; } default: { return ColorThemes::Unknown; } } } //============================================================== // Получение цветовых схем //============================================================== QVector<ColorThemes> colorSchemeValues() { return QVector<ColorThemes> { ColorThemes::Unknown, ColorThemes::Light, ColorThemes::Dark }; } //============================================================== // Проверка корректности цветовой схемы //============================================================== bool isCorrect(ColorThemes scheme) { return colorSchemeValues().contains(scheme); }