From e4e08e84687ce88c8c5fbca6afa0c6799a42a395 Mon Sep 17 00:00:00 2001 From: NathanRetzlaff Date: Tue, 10 Jun 2025 13:35:15 -0400 Subject: [PATCH] adds a red theme --- CMakeSettings.json | 1 - src/qt_gui/main_window.cpp | 14 +++++++++ src/qt_gui/main_window_themes.cpp | 47 ++++++++++++++++++++++--------- src/qt_gui/main_window_themes.h | 2 +- src/qt_gui/main_window_ui.h | 6 ++++ 5 files changed, 55 insertions(+), 15 deletions(-) diff --git a/CMakeSettings.json b/CMakeSettings.json index bb522fcfc..f902e6b96 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -6,7 +6,6 @@ "configurationType": "Release", "buildRoot": "${projectDir}\\Build\\${name}", "installRoot": "${projectDir}\\Install\\${name}", - "cmakeCommandArgs": "", "buildCommandArgs": "", "ctestCommandArgs": "", "inheritEnvironments": [ "clang_cl_x64_x64" ], diff --git a/src/qt_gui/main_window.cpp b/src/qt_gui/main_window.cpp index 906a3066e..0b8f08951 100644 --- a/src/qt_gui/main_window.cpp +++ b/src/qt_gui/main_window.cpp @@ -120,6 +120,7 @@ void MainWindow::CreateActions() { m_theme_act_group = new QActionGroup(this); m_theme_act_group->addAction(ui->setThemeDark); m_theme_act_group->addAction(ui->setThemeLight); + m_theme_act_group->addAction(ui->setThemeRed); m_theme_act_group->addAction(ui->setThemeGreen); m_theme_act_group->addAction(ui->setThemeBlue); m_theme_act_group->addAction(ui->setThemeViolet); @@ -787,6 +788,14 @@ void MainWindow::CreateConnects() { isIconBlack = true; } }); + connect(ui->setThemeRed, &QAction::triggered, &m_window_themes, [this]() { + m_window_themes.SetWindowTheme(Theme::Red, ui->mw_searchbar); + Config::setMainWindowTheme(static_cast(Theme::Red)); + if (!isIconBlack) { + SetUiIcons(true); + isIconBlack = true; + } + }); connect(ui->setThemeGreen, &QAction::triggered, &m_window_themes, [this]() { m_window_themes.SetWindowTheme(Theme::Green, ui->mw_searchbar); Config::setMainWindowTheme(static_cast(Theme::Green)); @@ -989,6 +998,11 @@ void MainWindow::SetLastUsedTheme() { isIconBlack = false; SetUiIcons(false); break; + case Theme::Red: + ui->setThemeRed->setChecked(true); + isIconBlack = false; + SetUiIcons(false); + break; case Theme::Green: ui->setThemeGreen->setChecked(true); isIconBlack = false; diff --git a/src/qt_gui/main_window_themes.cpp b/src/qt_gui/main_window_themes.cpp index 624673cba..b1fa9d3e4 100644 --- a/src/qt_gui/main_window_themes.cpp +++ b/src/qt_gui/main_window_themes.cpp @@ -15,19 +15,19 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) { "border-radius: 4px; padding: 5px; }" "QLineEdit:focus {" "border: 1px solid #2A82DA; }"); - themePalette.setColor(QPalette::Window, QColor(50, 50, 50)); - themePalette.setColor(QPalette::WindowText, Qt::white); - themePalette.setColor(QPalette::Base, QColor(20, 20, 20)); - themePalette.setColor(QPalette::AlternateBase, QColor(53, 53, 53)); - themePalette.setColor(QPalette::ToolTipBase, QColor(20, 20, 20)); - themePalette.setColor(QPalette::ToolTipText, Qt::white); - themePalette.setColor(QPalette::Text, Qt::white); - themePalette.setColor(QPalette::Button, QColor(53, 53, 53)); - themePalette.setColor(QPalette::ButtonText, Qt::white); - themePalette.setColor(QPalette::BrightText, Qt::red); - themePalette.setColor(QPalette::Link, QColor(42, 130, 218)); - themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); - themePalette.setColor(QPalette::HighlightedText, Qt::black); + themePalette.setColor(QPalette::Window, QColor(50, 50, 50)); // Dark Gray + themePalette.setColor(QPalette::WindowText, Qt::white); // White + themePalette.setColor(QPalette::Base, QColor(20, 20, 20)); // Dark Dark Gray + themePalette.setColor(QPalette::AlternateBase, QColor(53, 53, 53)); // Gray + themePalette.setColor(QPalette::ToolTipBase, QColor(20, 20, 20)); // Dark Dark Gray + themePalette.setColor(QPalette::ToolTipText, Qt::white); // White + themePalette.setColor(QPalette::Text, Qt::white); // White + themePalette.setColor(QPalette::Button, QColor(53, 53, 53)); // Gray + themePalette.setColor(QPalette::ButtonText, Qt::white); // White + themePalette.setColor(QPalette::BrightText, Qt::red); // Red + themePalette.setColor(QPalette::Link, QColor(42, 130, 218)); // Blue + themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); // Blue + themePalette.setColor(QPalette::HighlightedText, Qt::black); // White qApp->setPalette(themePalette); break; case Theme::Light: @@ -51,6 +51,27 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) { themePalette.setColor(QPalette::HighlightedText, Qt::white); // White qApp->setPalette(themePalette); break; + case Theme::Red: + mw_searchbar->setStyleSheet( + "QLineEdit {" + "background-color: #0e0000; color: #ffffff; border: 1px solid #ffffff; " + "border-radius: 4px; padding: 5px; }" + "QLineEdit:focus {" + "border: 1px solid #2A82DA; }"); + themePalette.setColor(QPalette::Window, QColor(70, 0, 0)); // red 3 + themePalette.setColor(QPalette::WindowText, Qt::white); // White + themePalette.setColor(QPalette::Base, QColor(28, 0, 0, 80)); // red 4 + themePalette.setColor(QPalette::AlternateBase, QColor(56, 0, 0)); // red 2 + themePalette.setColor(QPalette::ToolTipBase, QColor(28, 0, 0, 80)); // red 4 + themePalette.setColor(QPalette::ToolTipText, Qt::white); // White + themePalette.setColor(QPalette::Text, Qt::white); // White + themePalette.setColor(QPalette::ButtonText, Qt::white); // red 2 + themePalette.setColor(QPalette::BrightText, Qt::red); // Red + themePalette.setColor(QPalette::Link, QColor(42, 130, 218)); // Blue + themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); // Blue + themePalette.setColor(QPalette::HighlightedText, Qt::white); // White + qApp->setPalette(themePalette); + break; case Theme::Green: mw_searchbar->setStyleSheet( "QLineEdit {" diff --git a/src/qt_gui/main_window_themes.h b/src/qt_gui/main_window_themes.h index babde0f27..c0d183321 100644 --- a/src/qt_gui/main_window_themes.h +++ b/src/qt_gui/main_window_themes.h @@ -7,7 +7,7 @@ #include #include -enum class Theme : int { Dark, Light, Green, Blue, Violet, Gruvbox, TokyoNight, Oled }; +enum class Theme : int { Dark, Light, Red, Green, Blue, Violet, Gruvbox, TokyoNight, Oled }; class WindowThemes : public QObject { Q_OBJECT diff --git a/src/qt_gui/main_window_ui.h b/src/qt_gui/main_window_ui.h index 4d3481c07..2c1499947 100644 --- a/src/qt_gui/main_window_ui.h +++ b/src/qt_gui/main_window_ui.h @@ -34,6 +34,7 @@ public: QAction* configureAct; QAction* setThemeDark; QAction* setThemeLight; + QAction* setThemeRed; QAction* setThemeGreen; QAction* setThemeBlue; QAction* setThemeViolet; @@ -163,6 +164,9 @@ public: setThemeLight = new QAction(MainWindow); setThemeLight->setObjectName("setThemeLight"); setThemeLight->setCheckable(true); + setThemeRed = new QAction(MainWindow); + setThemeRed->setObjectName("setThemeRed"); + setThemeRed->setCheckable(true); setThemeGreen = new QAction(MainWindow); setThemeGreen->setObjectName("setThemeGreen"); setThemeGreen->setCheckable(true); @@ -316,6 +320,7 @@ public: menuView->addAction(menuThemes->menuAction()); menuThemes->addAction(setThemeDark); menuThemes->addAction(setThemeLight); + menuThemes->addAction(setThemeRed); menuThemes->addAction(setThemeGreen); menuThemes->addAction(setThemeBlue); menuThemes->addAction(setThemeViolet); @@ -404,6 +409,7 @@ public: menuHelp->setTitle(QCoreApplication::translate("MainWindow", "Help", nullptr)); setThemeDark->setText(QCoreApplication::translate("MainWindow", "Dark", nullptr)); setThemeLight->setText(QCoreApplication::translate("MainWindow", "Light", nullptr)); + setThemeRed->setText(QCoreApplication::translate("MainWindow", "Red", nullptr)); setThemeGreen->setText(QCoreApplication::translate("MainWindow", "Green", nullptr)); setThemeBlue->setText(QCoreApplication::translate("MainWindow", "Blue", nullptr)); setThemeViolet->setText(QCoreApplication::translate("MainWindow", "Violet", nullptr));