From b9c4b0075ce1f0c63574f2a62c9351c2975666a2 Mon Sep 17 00:00:00 2001 From: Anthony Bilinski Date: Sat, 12 Mar 2022 03:52:53 -0800 Subject: [PATCH] refactor(Style): Move Style enums to enum class --- src/chatlog/chatmessage.cpp | 2 +- src/chatlog/chatwidget.cpp | 6 +- src/chatlog/chatwidget.h | 2 +- src/chatlog/content/filetransferwidget.cpp | 16 +-- src/chatlog/content/text.cpp | 8 +- src/chatlog/content/text.h | 2 +- src/persistence/settings.cpp | 2 +- src/widget/chatformheader.cpp | 2 +- src/widget/form/chatform.cpp | 4 +- src/widget/form/groupchatform.cpp | 2 +- src/widget/form/profileform.cpp | 2 +- src/widget/form/settings/aboutform.cpp | 2 +- src/widget/genericchatroomwidget.cpp | 8 +- src/widget/style.cpp | 143 +++++++++++---------- src/widget/style.h | 6 +- 15 files changed, 104 insertions(+), 103 deletions(-) diff --git a/src/chatlog/chatmessage.cpp b/src/chatlog/chatmessage.cpp index 10a3b3e5f..b4b30d50e 100644 --- a/src/chatlog/chatmessage.cpp +++ b/src/chatlog/chatmessage.cpp @@ -97,7 +97,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString& sender, const QSt if (isMe) authorFont.setBold(true); - QColor color = Style::getColor(Style::MainText); + QColor color = Style::getColor(Style::ColorPalette::MainText); if (colorizeName) { QByteArray hash = QCryptographicHash::hash((sender.toUtf8()), QCryptographicHash::Sha256); auto lightness = color.lightnessF(); diff --git a/src/chatlog/chatwidget.cpp b/src/chatlog/chatwidget.cpp index 85acf400a..a1c3c02ef 100644 --- a/src/chatlog/chatwidget.cpp +++ b/src/chatlog/chatwidget.cpp @@ -235,7 +235,7 @@ ChatWidget::ChatWidget(IChatLog& chatLog_, const Core& core_, DocumentCache& doc setDragMode(QGraphicsView::NoDrag); setViewportUpdateMode(MinimalViewportUpdate); setContextMenuPolicy(Qt::CustomContextMenu); - setBackgroundBrush(QBrush(Style::getColor(Style::GroundBase), Qt::SolidPattern)); + setBackgroundBrush(QBrush(Style::getColor(Style::ColorPalette::GroundBase), Qt::SolidPattern)); // The selection rect for multi-line selection selGraphItem = scene->addRect(0, 0, 0, 0, selectionRectColor.darker(120), selectionRectColor); @@ -798,8 +798,8 @@ void ChatWidget::fontChanged(const QFont& font) void ChatWidget::reloadTheme() { setStyleSheet(Style::getStylesheet("chatArea/chatArea.css", settings)); - setBackgroundBrush(QBrush(Style::getColor(Style::GroundBase), Qt::SolidPattern)); - selectionRectColor = Style::getColor(Style::SelectText); + setBackgroundBrush(QBrush(Style::getColor(Style::ColorPalette::GroundBase), Qt::SolidPattern)); + selectionRectColor = Style::getColor(Style::ColorPalette::SelectText); selGraphItem->setBrush(QBrush(selectionRectColor)); selGraphItem->setPen(QPen(selectionRectColor.darker(120))); setTypingNotification(); diff --git a/src/chatlog/chatwidget.h b/src/chatlog/chatwidget.h index de2d03426..7ea982a59 100644 --- a/src/chatlog/chatwidget.h +++ b/src/chatlog/chatwidget.h @@ -187,7 +187,7 @@ private: int selClickedCol = -1; ChatLine::Ptr selFirstRow; ChatLine::Ptr selLastRow; - QColor selectionRectColor = Style::getColor(Style::SelectText); + QColor selectionRectColor = Style::getColor(Style::ColorPalette::SelectText); SelectionMode selectionMode = SelectionMode::None; QPointF clickPos; QGraphicsRectItem* selGraphItem = nullptr; diff --git a/src/chatlog/content/filetransferwidget.cpp b/src/chatlog/content/filetransferwidget.cpp index b2e5e3d98..52d0c041c 100644 --- a/src/chatlog/content/filetransferwidget.cpp +++ b/src/chatlog/content/filetransferwidget.cpp @@ -54,9 +54,9 @@ FileTransferWidget::FileTransferWidget(QWidget* parent, CoreFile& _coreFile, , coreFile{_coreFile} , ui(new Ui::FileTransferWidget) , fileInfo(file) - , backgroundColor(Style::getColor(Style::TransferMiddle)) - , buttonColor(Style::getColor(Style::TransferWait)) - , buttonBackgroundColor(Style::getColor(Style::GroundBase)) + , backgroundColor(Style::getColor(Style::ColorPalette::TransferMiddle)) + , buttonColor(Style::getColor(Style::ColorPalette::TransferWait)) + , buttonBackgroundColor(Style::getColor(Style::ColorPalette::GroundBase)) , active(true) , settings(settings_) { @@ -387,7 +387,7 @@ void FileTransferWidget::setupButtons(ToxFile const& file) ui->rightButton->setObjectName("cancel"); ui->rightButton->setToolTip(tr("Cancel transfer")); - setButtonColor(Style::getColor(Style::TransferGood)); + setButtonColor(Style::getColor(Style::ColorPalette::TransferGood)); break; case ToxFile::PAUSED: @@ -405,7 +405,7 @@ void FileTransferWidget::setupButtons(ToxFile const& file) ui->rightButton->setObjectName("cancel"); ui->rightButton->setToolTip(tr("Cancel transfer")); - setButtonColor(Style::getColor(Style::TransferMiddle)); + setButtonColor(Style::getColor(Style::ColorPalette::TransferMiddle)); break; case ToxFile::INITIALIZING: @@ -534,14 +534,14 @@ void FileTransferWidget::updateBackgroundColor(const ToxFile::FileStatus status) case ToxFile::INITIALIZING: case ToxFile::PAUSED: case ToxFile::TRANSMITTING: - setBackgroundColor(Style::getColor(Style::TransferMiddle), false); + setBackgroundColor(Style::getColor(Style::ColorPalette::TransferMiddle), false); break; case ToxFile::BROKEN: case ToxFile::CANCELED: - setBackgroundColor(Style::getColor(Style::TransferBad), true); + setBackgroundColor(Style::getColor(Style::ColorPalette::TransferBad), true); break; case ToxFile::FINISHED: - setBackgroundColor(Style::getColor(Style::TransferGood), true); + setBackgroundColor(Style::getColor(Style::ColorPalette::TransferGood), true); break; default: qCritical() << "Invalid file status"; diff --git a/src/chatlog/content/text.cpp b/src/chatlog/content/text.cpp index d506c8791..9a3ef455a 100644 --- a/src/chatlog/content/text.cpp +++ b/src/chatlog/content/text.cpp @@ -231,7 +231,7 @@ void Text::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWid sel.cursor.setPosition(getSelectionEnd(), QTextCursor::KeepAnchor); } - const QColor selectionColor = Style::getColor(Style::SelectText); + const QColor selectionColor = Style::getColor(Style::ColorPalette::SelectText); sel.format.setBackground(selectionColor.lighter(selectionHasFocus ? 100 : 160)); sel.format.setForeground(selectionHasFocus ? Qt::white : Qt::black); @@ -463,7 +463,7 @@ void Text::selectText(QTextCursor& cursor, const std::pair& point) cursor.endEditBlock(); QTextCharFormat format; - format.setBackground(QBrush(Style::getColor(Style::SearchHighlighted))); + format.setBackground(QBrush(Style::getColor(Style::ColorPalette::SearchHighlighted))); cursor.mergeCharFormat(format); regenerate(); @@ -473,9 +473,9 @@ void Text::selectText(QTextCursor& cursor, const std::pair& point) QColor Text::textColor() const { - QColor c = Style::getColor(Style::MainText); + QColor c = Style::getColor(Style::ColorPalette::MainText); if (textType == ACTION) { - c = Style::getColor(Style::Action); + c = Style::getColor(Style::ColorPalette::Action); } else if (textType == CUSTOM) { c = customColor; } diff --git a/src/chatlog/content/text.h b/src/chatlog/content/text.h index 7805df782..4ced0a319 100644 --- a/src/chatlog/content/text.h +++ b/src/chatlog/content/text.h @@ -43,7 +43,7 @@ public: Text(DocumentCache&, Settings&, const QString& txt = "", const QFont& font = QFont(), bool enableElide = false, const QString& rawText = QString(), const TextType& type = NORMAL, - const QColor& custom = Style::getColor(Style::MainText)); + const QColor& custom = Style::getColor(Style::ColorPalette::MainText)); virtual ~Text(); void setText(const QString& txt); diff --git a/src/persistence/settings.cpp b/src/persistence/settings.cpp index 335d18f6a..e79b4f25a 100644 --- a/src/persistence/settings.cpp +++ b/src/persistence/settings.cpp @@ -222,7 +222,7 @@ void Settings::loadGlobal() s.beginGroup("Chat"); { - chatMessageFont = s.value("chatMessageFont", Style::getFont(Style::Big)).value(); + chatMessageFont = s.value("chatMessageFont", Style::getFont(Style::Font::Big)).value(); } s.endGroup(); diff --git a/src/widget/chatformheader.cpp b/src/widget/chatformheader.cpp index 490218a39..96ac8abe1 100644 --- a/src/widget/chatformheader.cpp +++ b/src/widget/chatformheader.cpp @@ -128,7 +128,7 @@ ChatFormHeader::ChatFormHeader(Settings& settings_, QWidget* parent) nameLabel = new CroppingLabel(); nameLabel->setObjectName("nameLabel"); - nameLabel->setMinimumHeight(Style::getFont(Style::Medium).pixelSize()); + nameLabel->setMinimumHeight(Style::getFont(Style::Font::Medium).pixelSize()); nameLabel->setEditable(true); nameLabel->setTextFormat(Qt::PlainText); connect(nameLabel, &CroppingLabel::editFinished, this, &ChatFormHeader::nameChanged); diff --git a/src/widget/form/chatform.cpp b/src/widget/form/chatform.cpp index b0c0e92cb..9294f7cd8 100644 --- a/src/widget/form/chatform.cpp +++ b/src/widget/form/chatform.cpp @@ -124,8 +124,8 @@ ChatForm::ChatForm(Profile& profile, Friend* chatFriend, IChatLog& chatLog_, statusMessageLabel = new CroppingLabel(); statusMessageLabel->setObjectName("statusLabel"); - statusMessageLabel->setFont(Style::getFont(Style::Medium)); - statusMessageLabel->setMinimumHeight(Style::getFont(Style::Medium).pixelSize()); + statusMessageLabel->setFont(Style::getFont(Style::Font::Medium)); + statusMessageLabel->setMinimumHeight(Style::getFont(Style::Font::Medium).pixelSize()); statusMessageLabel->setTextFormat(Qt::PlainText); statusMessageLabel->setContextMenuPolicy(Qt::CustomContextMenu); diff --git a/src/widget/form/groupchatform.cpp b/src/widget/form/groupchatform.cpp index eb9d019b9..a7cb790e1 100644 --- a/src/widget/form/groupchatform.cpp +++ b/src/widget/form/groupchatform.cpp @@ -106,7 +106,7 @@ GroupChatForm::GroupChatForm(Core& core_, Group* chatGroup, IChatLog& chatLog_, headWidget->setMode(mode); setName(group->getName()); - nusersLabel->setFont(Style::getFont(Style::Medium)); + nusersLabel->setFont(Style::getFont(Style::Font::Medium)); nusersLabel->setObjectName("statusLabel"); retranslateUi(); diff --git a/src/widget/form/profileform.cpp b/src/widget/form/profileform.cpp index 6f2196b27..a95237585 100644 --- a/src/widget/form/profileform.cpp +++ b/src/widget/form/profileform.cpp @@ -116,7 +116,7 @@ ProfileForm::ProfileForm(IProfileInfo* profileInfo_, Settings& settings_, // tox toxId = new ClickableTE(); - toxId->setFont(Style::getFont(Style::Small)); + toxId->setFont(Style::getFont(Style::Font::Small)); toxId->setToolTip(bodyUI->toxId->toolTip()); QVBoxLayout* toxIdGroup = qobject_cast(bodyUI->toxGroup->layout()); diff --git a/src/widget/form/settings/aboutform.cpp b/src/widget/form/settings/aboutform.cpp index f54e19d30..ba582ec2f 100644 --- a/src/widget/form/settings/aboutform.cpp +++ b/src/widget/form/settings/aboutform.cpp @@ -212,7 +212,7 @@ QString AboutForm::createLink(QString path, QString text) const { return QString::fromUtf8( "%3") - .arg(path, Style::getColor(Style::Link).name(), text); + .arg(path, Style::getColor(Style::ColorPalette::Link).name(), text); } AboutForm::~AboutForm() diff --git a/src/widget/genericchatroomwidget.cpp b/src/widget/genericchatroomwidget.cpp index e1acaa267..b0abd4a68 100644 --- a/src/widget/genericchatroomwidget.cpp +++ b/src/widget/genericchatroomwidget.cpp @@ -94,8 +94,8 @@ void GenericChatroomWidget::compactChange(bool _compact) mainLayout->addWidget(&statusPic); mainLayout->addSpacing(5); mainLayout->activate(); - statusMessageLabel->setFont(Style::getFont(Style::Small)); - nameLabel->setFont(Style::getFont(Style::Medium)); + statusMessageLabel->setFont(Style::getFont(Style::Font::Small)); + nameLabel->setFont(Style::getFont(Style::Font::Medium)); } else { setFixedHeight(55); avatar->setSize(QSize(40, 40)); @@ -111,8 +111,8 @@ void GenericChatroomWidget::compactChange(bool _compact) mainLayout->addWidget(&statusPic); mainLayout->addSpacing(10); mainLayout->activate(); - statusMessageLabel->setFont(Style::getFont(Style::Medium)); - nameLabel->setFont(Style::getFont(Style::Big)); + statusMessageLabel->setFont(Style::getFont(Style::Font::Medium)); + nameLabel->setFont(Style::getFont(Style::Font::Big)); } } diff --git a/src/widget/style.cpp b/src/widget/style.cpp index 4951a54e1..df25893eb 100644 --- a/src/widget/style.cpp +++ b/src/widget/style.cpp @@ -82,45 +82,46 @@ QString qssifyFont(QFont font) return QString("%1 %2px \"%3\"").arg(font.weight() * 8).arg(font.pixelSize()).arg(font.family()); } -QMap palette; - +using ColorPalette = Style::ColorPalette; +QMap palette; QMap dictColor; QMap dictFont; QMap dictTheme; +using MainTheme = Style::MainTheme; const QList themeNameColors = { - {Style::Light, QObject::tr("Default"), QColor()}, - {Style::Light, QObject::tr("Blue"), QColor("#004aa4")}, - {Style::Light, QObject::tr("Olive"), QColor("#97ba00")}, - {Style::Light, QObject::tr("Red"), QColor("#c23716")}, - {Style::Light, QObject::tr("Violet"), QColor("#4617b5")}, - {Style::Dark, QObject::tr("Dark"), QColor()}, - {Style::Dark, QObject::tr("Dark blue"), QColor("#00336d")}, - {Style::Dark, QObject::tr("Dark olive"), QColor("#4d5f00")}, - {Style::Dark, QObject::tr("Dark red"), QColor("#7a210d")}, - {Style::Dark, QObject::tr("Dark violet"), QColor("#280d6c")} + {MainTheme::Light, QObject::tr("Default"), QColor()}, + {MainTheme::Light, QObject::tr("Blue"), QColor("#004aa4")}, + {MainTheme::Light, QObject::tr("Olive"), QColor("#97ba00")}, + {MainTheme::Light, QObject::tr("Red"), QColor("#c23716")}, + {MainTheme::Light, QObject::tr("Violet"), QColor("#4617b5")}, + {MainTheme::Dark, QObject::tr("Dark"), QColor()}, + {MainTheme::Dark, QObject::tr("Dark blue"), QColor("#00336d")}, + {MainTheme::Dark, QObject::tr("Dark olive"), QColor("#4d5f00")}, + {MainTheme::Dark, QObject::tr("Dark red"), QColor("#7a210d")}, + {MainTheme::Dark, QObject::tr("Dark violet"), QColor("#280d6c")} }; -const QMap aliasColors = { - {Style::TransferGood, "transferGood"}, - {Style::TransferWait, "transferWait"}, - {Style::TransferBad, "transferBad"}, - {Style::TransferMiddle, "transferMiddle"}, - {Style::MainText,"mainText"}, - {Style::NameActive, "nameActive"}, - {Style::StatusActive,"statusActive"}, - {Style::GroundExtra, "groundExtra"}, - {Style::GroundBase, "groundBase"}, - {Style::Orange, "orange"}, - {Style::Yellow, "yellow"}, - {Style::ThemeDark, "themeDark"}, - {Style::ThemeMediumDark, "themeMediumDark"}, - {Style::ThemeMedium, "themeMedium"}, - {Style::ThemeLight, "themeLight"}, - {Style::Action, "action"}, - {Style::Link, "link"}, - {Style::SearchHighlighted, "searchHighlighted"}, - {Style::SelectText, "selectText"}, +const QMap aliasColors = { + {ColorPalette::TransferGood, "transferGood"}, + {ColorPalette::TransferWait, "transferWait"}, + {ColorPalette::TransferBad, "transferBad"}, + {ColorPalette::TransferMiddle, "transferMiddle"}, + {ColorPalette::MainText,"mainText"}, + {ColorPalette::NameActive, "nameActive"}, + {ColorPalette::StatusActive,"statusActive"}, + {ColorPalette::GroundExtra, "groundExtra"}, + {ColorPalette::GroundBase, "groundBase"}, + {ColorPalette::Orange, "orange"}, + {ColorPalette::Yellow, "yellow"}, + {ColorPalette::ThemeDark, "themeDark"}, + {ColorPalette::ThemeMediumDark, "themeMediumDark"}, + {ColorPalette::ThemeMedium, "themeMedium"}, + {ColorPalette::ThemeLight, "themeLight"}, + {ColorPalette::Action, "action"}, + {ColorPalette::Link, "link"}, + {ColorPalette::SearchHighlighted, "searchHighlighted"}, + {ColorPalette::SelectText, "selectText"}, }; // stylesheet filename, font -> stylesheet @@ -206,12 +207,12 @@ const QString Style::getImagePath(const QString& filename, Settings& settings) } } -QColor Style::getColor(Style::ColorPalette entry) +QColor Style::getColor(ColorPalette entry) { return palette[entry]; } -QFont Style::getFont(Style::Font font) +QFont Style::getFont(Font font) { // fonts as defined in // https://github.com/ItsDuke/Tox-UI/blob/master/UI%20GUIDELINES.md @@ -228,7 +229,7 @@ QFont Style::getFont(Style::Font font) appFont(defSize - 1, QFont::Light), // small light }; - return fonts[font]; + return fonts[static_cast(font)]; } const QString Style::resolve(const QString& filename, Settings& settings, const QFont& baseFont) @@ -266,13 +267,13 @@ const QString Style::resolve(const QString& filename, Settings& settings, const dictFont = { {"@baseFont", QString::fromUtf8("'%1' %2px").arg(baseFont.family()).arg(QFontInfo(baseFont).pixelSize())}, - {"@extraBig", qssifyFont(Style::getFont(Style::ExtraBig))}, - {"@big", qssifyFont(Style::getFont(Style::Big))}, - {"@bigBold", qssifyFont(Style::getFont(Style::BigBold))}, - {"@medium", qssifyFont(Style::getFont(Style::Medium))}, - {"@mediumBold", qssifyFont(Style::getFont(Style::MediumBold))}, - {"@small", qssifyFont(Style::getFont(Style::Small))}, - {"@smallLight", qssifyFont(Style::getFont(Style::SmallLight))}}; + {"@extraBig", qssifyFont(Style::getFont(Font::ExtraBig))}, + {"@big", qssifyFont(Style::getFont(Font::Big))}, + {"@bigBold", qssifyFont(Style::getFont(Font::BigBold))}, + {"@medium", qssifyFont(Style::getFont(Font::Medium))}, + {"@mediumBold", qssifyFont(Style::getFont(Font::MediumBold))}, + {"@small", qssifyFont(Style::getFont(Font::Small))}, + {"@smallLight", qssifyFont(Style::getFont(Font::SmallLight))}}; } for (const QString& key : dictColor.keys()) { @@ -353,21 +354,21 @@ void Style::setThemeColor(const QColor& color) { if (!color.isValid()) { // Reset to default - palette[ThemeDark] = getColor(ThemeDark); - palette[ThemeMediumDark] = getColor(ThemeMediumDark); - palette[ThemeMedium] = getColor(ThemeMedium); - palette[ThemeLight] = getColor(ThemeLight); + palette[ColorPalette::ThemeDark] = getColor(ColorPalette::ThemeDark); + palette[ColorPalette::ThemeMediumDark] = getColor(ColorPalette::ThemeMediumDark); + palette[ColorPalette::ThemeMedium] = getColor(ColorPalette::ThemeMedium); + palette[ColorPalette::ThemeLight] = getColor(ColorPalette::ThemeLight); } else { - palette[ThemeDark] = color.darker(155); - palette[ThemeMediumDark] = color.darker(135); - palette[ThemeMedium] = color.darker(120); - palette[ThemeLight] = color.lighter(110); + palette[ColorPalette::ThemeDark] = color.darker(155); + palette[ColorPalette::ThemeMediumDark] = color.darker(135); + palette[ColorPalette::ThemeMedium] = color.darker(120); + palette[ColorPalette::ThemeLight] = color.lighter(110); } - dictTheme["@themeDark"] = getColor(ThemeDark).name(); - dictTheme["@themeMediumDark"] = getColor(ThemeMediumDark).name(); - dictTheme["@themeMedium"] = getColor(ThemeMedium).name(); - dictTheme["@themeLight"] = getColor(ThemeLight).name(); + dictTheme["@themeDark"] = getColor(ColorPalette::ThemeDark).name(); + dictTheme["@themeMediumDark"] = getColor(ColorPalette::ThemeMediumDark).name(); + dictTheme["@themeMedium"] = getColor(ColorPalette::ThemeMedium).name(); + dictTheme["@themeLight"] = getColor(ColorPalette::ThemeLight).name(); } /** @@ -395,7 +396,7 @@ void Style::initPalette(Settings& settings) auto keys = aliasColors.keys(); colourSettings.beginGroup("colors"); - QMap c; + QMap c; for (auto k : keys) { c[k] = colourSettings.value(aliasColors[k], "#000").toString(); palette[k] = QColor(colourSettings.value(aliasColors[k], "#000").toString()); @@ -408,27 +409,27 @@ void Style::initPalette(Settings& settings) void Style::initDictColor() { dictColor = { - {"@transferGood", Style::getColor(Style::TransferGood).name()}, - {"@transferWait", Style::getColor(Style::TransferWait).name()}, - {"@transferBad", Style::getColor(Style::TransferBad).name()}, - {"@transferMiddle", Style::getColor(Style::TransferMiddle).name()}, - {"@mainText", Style::getColor(Style::MainText).name()}, - {"@nameActive", Style::getColor(Style::NameActive).name()}, - {"@statusActive", Style::getColor(Style::StatusActive).name()}, - {"@groundExtra", Style::getColor(Style::GroundExtra).name()}, - {"@groundBase", Style::getColor(Style::GroundBase).name()}, - {"@orange", Style::getColor(Style::Orange).name()}, - {"@yellow", Style::getColor(Style::Yellow).name()}, - {"@action", Style::getColor(Style::Action).name()}, - {"@link", Style::getColor(Style::Link).name()}, - {"@searchHighlighted", Style::getColor(Style::SearchHighlighted).name()}, - {"@selectText", Style::getColor(Style::SelectText).name()}}; + {"@transferGood", Style::getColor(ColorPalette::TransferGood).name()}, + {"@transferWait", Style::getColor(ColorPalette::TransferWait).name()}, + {"@transferBad", Style::getColor(ColorPalette::TransferBad).name()}, + {"@transferMiddle", Style::getColor(ColorPalette::TransferMiddle).name()}, + {"@mainText", Style::getColor(ColorPalette::MainText).name()}, + {"@nameActive", Style::getColor(ColorPalette::NameActive).name()}, + {"@statusActive", Style::getColor(ColorPalette::StatusActive).name()}, + {"@groundExtra", Style::getColor(ColorPalette::GroundExtra).name()}, + {"@groundBase", Style::getColor(ColorPalette::GroundBase).name()}, + {"@orange", Style::getColor(ColorPalette::Orange).name()}, + {"@yellow", Style::getColor(ColorPalette::Yellow).name()}, + {"@action", Style::getColor(ColorPalette::Action).name()}, + {"@link", Style::getColor(ColorPalette::Link).name()}, + {"@searchHighlighted", Style::getColor(ColorPalette::SearchHighlighted).name()}, + {"@selectText", Style::getColor(ColorPalette::SelectText).name()}}; } QString Style::getThemePath(Settings& settings) { const int num = settings.getThemeColor(); - if (themeNameColors[num].type == Dark) { + if (themeNameColors[num].type == MainTheme::Dark) { return BuiltinThemeDarkPath; } diff --git a/src/widget/style.h b/src/widget/style.h index 5eec374f1..65896c029 100644 --- a/src/widget/style.h +++ b/src/widget/style.h @@ -29,7 +29,7 @@ class Settings; class Style { public: - enum ColorPalette + enum class ColorPalette { TransferGood, TransferWait, @@ -52,7 +52,7 @@ public: SelectText }; - enum Font + enum class Font { ExtraBig, Big, @@ -63,7 +63,7 @@ public: SmallLight }; - enum MainTheme + enum class MainTheme { Light, Dark