From 768d14e298e9f061ad5be281a3dec04d6c4481d5 Mon Sep 17 00:00:00 2001 From: Ernie Pasveer Date: Wed, 22 Jul 2026 11:04:31 -0500 Subject: [PATCH 1/2] First work on creating a icon color mode. --- src/SeerAboutDialog.cpp | 2 +- src/SeerArrayVisualizerWidget.cpp | 8 +- src/SeerConfigDialog.cpp | 16 +- src/SeerDebugDialog.cpp | 2 +- src/SeerGdbMonitorWidget.cpp | 4 +- src/SeerHelpPageDialog.cpp | 2 +- src/SeerImageVisualizerWidget.cpp | 4 +- src/SeerMainWindow.cpp | 79 +++++++-- src/SeerMainWindow.h | 9 +- src/SeerMainWindow.ui | 16 +- src/SeerMatrixVisualizerWidget.cpp | 4 +- src/SeerMemoryVisualizerWidget.cpp | 4 +- src/SeerStructVisualizerWidget.cpp | 4 +- src/SeerUtl.cpp | 264 +++++++++++++++++++---------- src/SeerUtl.h | 10 +- src/SeerVarVisualizerWidget.cpp | 4 +- 16 files changed, 288 insertions(+), 144 deletions(-) diff --git a/src/SeerAboutDialog.cpp b/src/SeerAboutDialog.cpp index 83946c3..460471a 100644 --- a/src/SeerAboutDialog.cpp +++ b/src/SeerAboutDialog.cpp @@ -53,7 +53,7 @@ SeerAboutDialog::~SeerAboutDialog () { void SeerAboutDialog::handleThemeChanged () { // Get the colorized icon. - QIcon icon = Seer::colorizeIcon(QIcon(":/seer/resources/icons/hicolor/256x256/seergdb.png"), QSize(256,256)); + QIcon icon = Seer::colorizeIcon(QIcon(":/seer/resources/icons/hicolor/256x256/seergdb.png"), Seer::iconColorMode(), QSize(256,256)); // Set the label's pixmap label->setPixmap(icon.pixmap(QSize(256,256))); diff --git a/src/SeerArrayVisualizerWidget.cpp b/src/SeerArrayVisualizerWidget.cpp index 851cda6..7bfb948 100644 --- a/src/SeerArrayVisualizerWidget.cpp +++ b/src/SeerArrayVisualizerWidget.cpp @@ -137,8 +137,8 @@ SeerArrayVisualizerWidget::SeerArrayVisualizerWidget (QWidget* parent) : QWidget #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this); - Seer::colorizeChartViewItem(arrayChartView); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeChartViewItem(arrayChartView, Seer::iconColorMode()); // Restore window settings. readSettings(); @@ -1123,10 +1123,10 @@ void SeerArrayVisualizerWidget::handleLineTypeButtonGroup () { void SeerArrayVisualizerWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); // And the ChartView. - Seer::colorizeChartViewItem(arrayChartView); + Seer::colorizeChartViewItem(arrayChartView, Seer::iconColorMode()); } void SeerArrayVisualizerWidget::createASeries() { diff --git a/src/SeerConfigDialog.cpp b/src/SeerConfigDialog.cpp index 43da16d..b5c3c7c 100644 --- a/src/SeerConfigDialog.cpp +++ b/src/SeerConfigDialog.cpp @@ -110,14 +110,14 @@ SeerConfigDialog::SeerConfigDialog(QWidget* parent) : QDialog(parent) { connect(buttonBox, &QDialogButtonBox::clicked, this, &SeerConfigDialog::handleButtonClicked); // Colorize icons for theme. - Seer::colorizeAllIcons(this); - Seer::colorizeListWidgetItemIcon(configSeerButton, QSize(128,128)); - Seer::colorizeListWidgetItemIcon(configGdbButton, QSize(128,128)); - Seer::colorizeListWidgetItemIcon(configEditorButton, QSize(128,128)); - Seer::colorizeListWidgetItemIcon(configSourceButton, QSize(128,128)); - Seer::colorizeListWidgetItemIcon(configAssemblyButton, QSize(128,128)); - Seer::colorizeListWidgetItemIcon(configKeysButton, QSize(128,128)); - // Seer::colorizeListWidgetItemIcon(configRRButton, QSize(128,128)); // Don't change. It's a multi-colored icon. + Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeListWidgetItemIcon(configSeerButton, Seer::iconColorMode(), QSize(128,128)); + Seer::colorizeListWidgetItemIcon(configGdbButton, Seer::iconColorMode(), QSize(128,128)); + Seer::colorizeListWidgetItemIcon(configEditorButton, Seer::iconColorMode(), QSize(128,128)); + Seer::colorizeListWidgetItemIcon(configSourceButton, Seer::iconColorMode(), QSize(128,128)); + Seer::colorizeListWidgetItemIcon(configAssemblyButton, Seer::iconColorMode(), QSize(128,128)); + Seer::colorizeListWidgetItemIcon(configKeysButton, Seer::iconColorMode(), QSize(128,128)); + // Seer::colorizeListWidgetItemIcon(configRRButton, Seer::iconColorMode(), QSize(128,128)); // Don't change. It's a multi-colored icon. // Set to first page. contentsListWidget->setCurrentRow(0); diff --git a/src/SeerDebugDialog.cpp b/src/SeerDebugDialog.cpp index 61f147d..6d8a7a1 100644 --- a/src/SeerDebugDialog.cpp +++ b/src/SeerDebugDialog.cpp @@ -76,7 +76,7 @@ SeerDebugDialog::SeerDebugDialog (QWidget* parent) : QDialog(parent) { QObject::connect(buttonBox, &QDialogButtonBox::clicked, this, &SeerDebugDialog::handleResetButtonClicked); // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); // Set initial run mode. handleRunModeChanged(0); diff --git a/src/SeerGdbMonitorWidget.cpp b/src/SeerGdbMonitorWidget.cpp index 4e0c19a..f043de3 100644 --- a/src/SeerGdbMonitorWidget.cpp +++ b/src/SeerGdbMonitorWidget.cpp @@ -67,7 +67,7 @@ SeerGdbMonitorWidget::SeerGdbMonitorWidget (QWidget* parent) : QWidget(parent) { #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); // Restore window settings. readSettings(); @@ -196,7 +196,7 @@ void SeerGdbMonitorWidget::handleMacroToolButtonClicked (QAbstractButton* button void SeerGdbMonitorWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); } void SeerGdbMonitorWidget::writeSettings() { diff --git a/src/SeerHelpPageDialog.cpp b/src/SeerHelpPageDialog.cpp index d7af226..13675a7 100644 --- a/src/SeerHelpPageDialog.cpp +++ b/src/SeerHelpPageDialog.cpp @@ -27,7 +27,7 @@ SeerHelpPageDialog::SeerHelpPageDialog(QDialog* parent) : QDialog(parent) { QObject::connect(okPushButton, &QPushButton::clicked, this, &SeerHelpPageDialog::handleOkPushButton); // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); // Restore window settings. readSettings(); diff --git a/src/SeerImageVisualizerWidget.cpp b/src/SeerImageVisualizerWidget.cpp index 5a64a47..ad18623 100644 --- a/src/SeerImageVisualizerWidget.cpp +++ b/src/SeerImageVisualizerWidget.cpp @@ -54,7 +54,7 @@ SeerImageVisualizerWidget::SeerImageVisualizerWidget (QWidget* parent) : QWidget #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); // Restore window settings. readSettings(); @@ -421,7 +421,7 @@ void SeerImageVisualizerWidget::handleCreateImage (const QByteArray& array) { void SeerImageVisualizerWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); } void SeerImageVisualizerWidget::writeSettings() { diff --git a/src/SeerMainWindow.cpp b/src/SeerMainWindow.cpp index f1cc6b2..5eefa2c 100644 --- a/src/SeerMainWindow.cpp +++ b/src/SeerMainWindow.cpp @@ -62,30 +62,48 @@ SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) { toolBar->addWidget(helpToolButton); - // Set up Styles menu. - _styleMenuActionGroup = new QActionGroup(this); - _styleMenuActionGroup->setExclusionPolicy(QActionGroup::ExclusionPolicy::Exclusive); - _styleMenuActionGroup->setEnabled(true); - _styleMenuActionGroup->setVisible(true); + // Set up ThemeStyle menu. + _themeStyleMenuActionGroup = new QActionGroup(this); + _themeStyleMenuActionGroup->setExclusionPolicy(QActionGroup::ExclusionPolicy::Exclusive); + _themeStyleMenuActionGroup->setEnabled(true); + _themeStyleMenuActionGroup->setVisible(true); - QAction* lightStyleAction = menuStyles->addAction("light"); + QAction* lightStyleAction = menuThemeStyle->addAction("light"); lightStyleAction->setCheckable(true); - _styleMenuActionGroup->addAction(lightStyleAction); + _themeStyleMenuActionGroup->addAction(lightStyleAction); - QAction* darkStyleAction = menuStyles->addAction("dark"); + QAction* darkStyleAction = menuThemeStyle->addAction("dark"); darkStyleAction->setCheckable(true); - _styleMenuActionGroup->addAction(darkStyleAction); + _themeStyleMenuActionGroup->addAction(darkStyleAction); QStringList styles = QStyleFactory::keys(); for (int i = 0; i < styles.size(); i++) { - QAction* styleAction = menuStyles->addAction(styles.at(i)); + QAction* styleAction = menuThemeStyle->addAction(styles.at(i)); styleAction->setCheckable(true); - _styleMenuActionGroup->addAction(styleAction); + _themeStyleMenuActionGroup->addAction(styleAction); } + // Set up IconColor menu. + _iconColorMenuActionGroup = new QActionGroup(this); + _iconColorMenuActionGroup->setExclusionPolicy(QActionGroup::ExclusionPolicy::Exclusive); + _iconColorMenuActionGroup->setEnabled(true); + _iconColorMenuActionGroup->setVisible(true); + + QAction* autoIconColorAction = menuIconColor->addAction("auto"); + autoIconColorAction->setCheckable(true); + _iconColorMenuActionGroup->addAction(autoIconColorAction); + + QAction* lightIconColorAction = menuIconColor->addAction("light"); + lightIconColorAction->setCheckable(true); + _iconColorMenuActionGroup->addAction(lightIconColorAction); + + QAction* darkIconColorAction = menuIconColor->addAction("dark"); + darkIconColorAction->setCheckable(true); + _iconColorMenuActionGroup->addAction(darkIconColorAction); + // Hide Nexti and Stepi. Enabled/disabled by SeerEditorManagerWidget. actionGdbNext->setVisible(true); actionGdbNexti->setVisible(false); @@ -177,7 +195,8 @@ SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) { QObject::connect(actionGdbLaunch, &QAction::triggered, this, &SeerMainWindow::handleFileDebugWithOutDefaultProject); QObject::connect(actionGdbTerminate, &QAction::triggered, this, &SeerMainWindow::handleTerminateExecutable); QObject::connect(actionGdbRestart, &QAction::triggered, this, &SeerMainWindow::handleRestartExecutable); - QObject::connect(_styleMenuActionGroup, &QActionGroup::triggered, this, &SeerMainWindow::handleStyleMenuChanged); + QObject::connect(_themeStyleMenuActionGroup, &QActionGroup::triggered, this, &SeerMainWindow::handleThemeStyleMenuChanged); + QObject::connect(_iconColorMenuActionGroup, &QActionGroup::triggered, this, &SeerMainWindow::handleIconColorMenuChanged); QObject::connect(actionGdbContinue, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbContinue); QObject::connect(actionGdbNext, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbNext); QObject::connect(actionGdbStep, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbStep); @@ -234,7 +253,7 @@ SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) { #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); handleRecordSettingsChanged(); @@ -588,6 +607,19 @@ const QString& SeerMainWindow::styleName () { return _styleName; } +void SeerMainWindow::setIconColorName (const QString& name) { + + // Check for Dark/Light style from Seer's resource tree. + if (name == "auto" || name == "dark" || name == "light") { + + _iconColorName = name; + } +} + +const QString& SeerMainWindow::iconColorName () { + return _iconColorName; +} + void SeerMainWindow::handleFileDebugWithDefaultProject () { handleFileDebug(true); } @@ -1027,9 +1059,9 @@ void SeerMainWindow::handleRestartExecutable () { } } -void SeerMainWindow::handleStyleMenuChanged () { +void SeerMainWindow::handleThemeStyleMenuChanged () { - QAction* action = _styleMenuActionGroup->checkedAction(); + QAction* action = _themeStyleMenuActionGroup->checkedAction(); if (action == 0) { return; @@ -1038,6 +1070,17 @@ void SeerMainWindow::handleStyleMenuChanged () { setStyleName(action->text()); } +void SeerMainWindow::handleIconColorMenuChanged () { + + QAction* action = _iconColorMenuActionGroup->checkedAction(); + + if (action == 0) { + return; + } + + setIconColorName(action->text()); +} + void SeerMainWindow::handleShowMessage (QString message, int time) { statusBar()->showMessage(message, time); @@ -1703,6 +1746,7 @@ void SeerMainWindow::writeConfigSettings () { settings.beginGroup("mainwindow"); { settings.setValue("qtstyle", styleName()); + settings.setValue("iconcolor", iconColorName()); } settings.endGroup(); settings.beginGroup("gdb"); { @@ -1786,6 +1830,9 @@ void SeerMainWindow::readConfigSettings () { if (settings.contains("qtstyle")) { setStyleName(settings.value("qtstyle").toString()); } + if (settings.contains("iconcolor")) { + setIconColorName(settings.value("iconcolor").toString()); + } } settings.endGroup(); settings.beginGroup("gdb"); { @@ -2150,6 +2197,6 @@ void SeerMainWindow::handleGdbTargetInterrupt() { void SeerMainWindow::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); } diff --git a/src/SeerMainWindow.h b/src/SeerMainWindow.h index d4d3f3a..b832ce0 100644 --- a/src/SeerMainWindow.h +++ b/src/SeerMainWindow.h @@ -76,6 +76,8 @@ class SeerMainWindow : public QMainWindow, protected Ui::SeerMainWindowForm { void setStyleName (const QString& name); const QString& styleName (); + void setIconColorName (const QString& name); + const QString& iconColorName (); private slots: void handleFileDebugWithDefaultProject (); @@ -105,7 +107,8 @@ class SeerMainWindow : public QMainWindow, protected Ui::SeerMainWindowForm { void handleHelpToolButtonClicked (); void handleTerminateExecutable (); void handleRestartExecutable (); - void handleStyleMenuChanged (); + void handleThemeStyleMenuChanged (); + void handleIconColorMenuChanged (); void handleShowMessage (QString message, int time); void handleGdbStateChanged (); void handleGdbTargetRunning (); @@ -125,8 +128,10 @@ class SeerMainWindow : public QMainWindow, protected Ui::SeerMainWindowForm { void refreshShortCuts (); private: - QActionGroup* _styleMenuActionGroup; + QActionGroup* _themeStyleMenuActionGroup; + QActionGroup* _iconColorMenuActionGroup; QString _styleName; + QString _iconColorName; QAction* _interruptAction; SeerProgressIndicator* _progressIndicator; SeerKeySettings _keySettings; diff --git a/src/SeerMainWindow.ui b/src/SeerMainWindow.ui index 08f4f14..e7e9c17 100644 --- a/src/SeerMainWindow.ui +++ b/src/SeerMainWindow.ui @@ -61,9 +61,18 @@ - + - Styles + Theme Style + + + + :/seer/resources/icons-icons/style.png:/seer/resources/icons-icons/style.png + + + + + Icon Color @@ -79,7 +88,8 @@ - + + diff --git a/src/SeerMatrixVisualizerWidget.cpp b/src/SeerMatrixVisualizerWidget.cpp index bc9b83c..7f27d4d 100644 --- a/src/SeerMatrixVisualizerWidget.cpp +++ b/src/SeerMatrixVisualizerWidget.cpp @@ -65,7 +65,7 @@ SeerMatrixVisualizerWidget::SeerMatrixVisualizerWidget (QWidget* parent) : QWidg #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); // Restore window settings. readSettings(); @@ -647,7 +647,7 @@ void SeerMatrixVisualizerWidget::handleDataChanged () { void SeerMatrixVisualizerWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); } void SeerMatrixVisualizerWidget::writeSettings() { diff --git a/src/SeerMemoryVisualizerWidget.cpp b/src/SeerMemoryVisualizerWidget.cpp index a382f61..d845a7f 100644 --- a/src/SeerMemoryVisualizerWidget.cpp +++ b/src/SeerMemoryVisualizerWidget.cpp @@ -79,7 +79,7 @@ SeerMemoryVisualizerWidget::SeerMemoryVisualizerWidget (QWidget* parent) : QWidg #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); // Restore window settings. readSettings(); @@ -497,7 +497,7 @@ void SeerMemoryVisualizerWidget::handleSaveButton () { void SeerMemoryVisualizerWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); } void SeerMemoryVisualizerWidget::writeSettings() { diff --git a/src/SeerStructVisualizerWidget.cpp b/src/SeerStructVisualizerWidget.cpp index 55a0146..cdede88 100644 --- a/src/SeerStructVisualizerWidget.cpp +++ b/src/SeerStructVisualizerWidget.cpp @@ -53,7 +53,7 @@ SeerStructVisualizerWidget::SeerStructVisualizerWidget (QWidget* parent) : QWidg #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); // Restore window settings. readSettings(); @@ -511,7 +511,7 @@ void SeerStructVisualizerWidget::handleVariableNameLineEdit () { void SeerStructVisualizerWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); } void SeerStructVisualizerWidget::writeSettings () { diff --git a/src/SeerUtl.cpp b/src/SeerUtl.cpp index a82326b..feb152c 100644 --- a/src/SeerUtl.cpp +++ b/src/SeerUtl.cpp @@ -1383,90 +1383,142 @@ namespace Seer { } } - void colorizeAllIcons (QWidget* parent, const QSize& size) { + // + // Icon colorization. + // + static QString _iconColorMode = "auto"; + + void setIconColorMode (const QString& colorMode) { + _iconColorMode = colorMode; + } + + const QString& iconColorMode () { + return _iconColorMode; + } + + void colorizeAllIcons (QWidget* parent, const QString& colorMode, const QSize& size) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 3) if (parent == nullptr) { return; } - // Get the current color scheme - Qt::ColorScheme colorScheme = QGuiApplication::styleHints()->colorScheme(); - - // Look for all button types. - const auto buttons = parent->findChildren(); - - for (QAbstractButton* button : buttons) { - - if (colorScheme == Qt::ColorScheme::Dark) { - button->setIcon(Seer::colorizeIcon(button->icon(), QColor("white"), size)); - }else{ - button->setIcon(Seer::colorizeIcon(button->icon(), QColor("black"), size)); - } - } - - // Look for all menu types. - const auto menus = parent->findChildren(); - - for (QMenu* menu : menus) { - - if (colorScheme == Qt::ColorScheme::Dark) { - menu->setIcon(Seer::colorizeIcon(menu->icon(), QColor("white"), size)); - }else{ - menu->setIcon(Seer::colorizeIcon(menu->icon(), QColor("black"), size)); - } - } - - // Look for all action types. - const auto actions = parent->findChildren(); - - for (QAction* action : actions) { - - if (colorScheme == Qt::ColorScheme::Dark) { - action->setIcon(Seer::colorizeIcon(action->icon(), QColor("white"), size)); - }else{ - action->setIcon(Seer::colorizeIcon(action->icon(), QColor("black"), size)); - } - } - - // Look for the app's titlebar icon. - // XXX Doesn't work! - // XXX Titlebar icon remains the same. It doesn't change. Don't know why. - if (colorScheme == Qt::ColorScheme::Dark) { - QApplication::setWindowIcon(Seer::colorizeIcon(QIcon(":/seer/resources/icons/hicolor/64x64/seergdb.png"), QColor("white"), size)); - }else{ - QApplication::setWindowIcon(Seer::colorizeIcon(QIcon(":/seer/resources/icons/hicolor/64x64/seergdb.png"), QColor("black"), size)); - } -#else - Q_UNUSED(parent); - Q_UNUSED(size); -#endif - } - - void colorizeListWidgetItemIcon (QListWidgetItem* item, const QSize& size) { + if (colorMode == "auto") { #if QT_VERSION >= QT_VERSION_CHECK(6, 6, 3) + // Get the current color scheme + Qt::ColorScheme colorScheme = QGuiApplication::styleHints()->colorScheme(); + + if (colorScheme == Qt::ColorScheme::Light) { + return colorizeAllIcons(parent, "light"); + }else if (colorScheme == Qt::ColorScheme::Dark) { + return colorizeAllIcons(parent, "dark"); + }else{ + qDebug() << "Bad colorScheme of: " << colorScheme; + } + +#endif + return; + + }else if (colorMode == "light") { + + // Look for all button types. + const auto buttons = parent->findChildren(); + + for (QAbstractButton* button : buttons) { + button->setIcon(Seer::colorizeIcon(button->icon(), QColor("black"), size)); + } + + // Look for all menu types. + const auto menus = parent->findChildren(); + + for (QMenu* menu : menus) { + menu->setIcon(Seer::colorizeIcon(menu->icon(), QColor("black"), size)); + } + + // Look for all action types. + const auto actions = parent->findChildren(); + + for (QAction* action : actions) { + action->setIcon(Seer::colorizeIcon(action->icon(), QColor("black"), size)); + } + + // Look for the app's titlebar icon. + // XXX Doesn't work! + // XXX Titlebar icon remains the same. It doesn't change. Don't know why. + QApplication::setWindowIcon(Seer::colorizeIcon(QIcon(":/seer/resources/icons/hicolor/64x64/seergdb.png"), QColor("black"), size)); + + return; + + }else if (colorMode == "dark") { + + // Look for all button types. + const auto buttons = parent->findChildren(); + + for (QAbstractButton* button : buttons) { + button->setIcon(Seer::colorizeIcon(button->icon(), QColor("white"), size)); + } + + // Look for all menu types. + const auto menus = parent->findChildren(); + + for (QMenu* menu : menus) { + menu->setIcon(Seer::colorizeIcon(menu->icon(), QColor("white"), size)); + } + + // Look for all action types. + const auto actions = parent->findChildren(); + + for (QAction* action : actions) { + action->setIcon(Seer::colorizeIcon(action->icon(), QColor("white"), size)); + } + + // Look for the app's titlebar icon. + // XXX Doesn't work! + // XXX Titlebar icon remains the same. It doesn't change. Don't know why. + QApplication::setWindowIcon(Seer::colorizeIcon(QIcon(":/seer/resources/icons/hicolor/64x64/seergdb.png"), QColor("black"), size)); + + return; + } + + qDebug() << "Bad iconColorMode of: " << colorMode; + } + + void colorizeListWidgetItemIcon (QListWidgetItem* item, const QString& colorMode, const QSize& size) { + if (item == nullptr) { return; } - // Get the current color scheme - Qt::ColorScheme colorScheme = QGuiApplication::styleHints()->colorScheme(); - - if (colorScheme == Qt::ColorScheme::Dark) { - item->setIcon(Seer::colorizeIcon(item->icon(), QColor("white"), size)); - }else{ - item->setIcon(Seer::colorizeIcon(item->icon(), QColor("black"), size)); - } -#else - Q_UNUSED(item); - Q_UNUSED(size); -#endif - } - - void colorizeChartViewItem (QChartView* item) { + if (colorMode == "auto") { #if QT_VERSION >= QT_VERSION_CHECK(6, 6, 3) + // Get the current color scheme + Qt::ColorScheme colorScheme = QGuiApplication::styleHints()->colorScheme(); + + if (colorScheme == Qt::ColorScheme::Light) { + item->setIcon(Seer::colorizeIcon(item->icon(), QColor("black"), size)); + }else if (colorScheme == Qt::ColorScheme::Dark) { + item->setIcon(Seer::colorizeIcon(item->icon(), QColor("white"), size)); + }else{ + qDebug() << "Bad colorScheme of: " << colorScheme; + } + +#endif + return; + + }else if (colorMode == "light") { + item->setIcon(Seer::colorizeIcon(item->icon(), QColor("black"), size)); + return; + }else if (colorMode == "dark") { + item->setIcon(Seer::colorizeIcon(item->icon(), QColor("white"), size)); + return; + } + + qDebug() << "Bad iconColorMode of: " << colorMode; + } + + void colorizeChartViewItem (QChartView* item, const QString& colorMode) { + if (item == nullptr) { return; } @@ -1477,35 +1529,62 @@ namespace Seer { return; } - // Get the current color scheme - Qt::ColorScheme colorScheme = QGuiApplication::styleHints()->colorScheme(); - - if (colorScheme == Qt::ColorScheme::Dark) { - chart->setTheme(QChart::ChartThemeDark); - }else{ - chart->setTheme(QChart::ChartThemeLight); - } -#else - Q_UNUSED(item); -#endif - } - - QIcon colorizeIcon (const QIcon& icon, const QSize& size) { + if (colorMode == "auto") { #if QT_VERSION >= QT_VERSION_CHECK(6, 6, 3) - // Get the current color scheme - Qt::ColorScheme colorScheme = QGuiApplication::styleHints()->colorScheme(); + // Get the current color scheme + Qt::ColorScheme colorScheme = QGuiApplication::styleHints()->colorScheme(); - if (colorScheme == Qt::ColorScheme::Dark) { + if (colorScheme == Qt::ColorScheme::Light) { + chart->setTheme(QChart::ChartThemeLight); + }else if (colorScheme == Qt::ColorScheme::Dark) { + chart->setTheme(QChart::ChartThemeDark); + }else{ + qDebug() << "Bad colorScheme of: " << colorScheme; + } + +#endif + return; + + }else if (colorMode == "light") { + chart->setTheme(QChart::ChartThemeLight); + return; + }else if (colorMode == "dark") { + chart->setTheme(QChart::ChartThemeDark); + return; + } + + qDebug() << "Bad iconColorMode of: " << colorMode; + } + + QIcon colorizeIcon (const QIcon& icon, const QString& colorMode, const QSize& size) { + + if (colorMode == "auto") { + +#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 3) + // Get the current color scheme + Qt::ColorScheme colorScheme = QGuiApplication::styleHints()->colorScheme(); + + if (colorScheme == Qt::ColorScheme::Light) { + return Seer::colorizeIcon(icon, QColor("black"), size); + }else if (colorScheme == Qt::ColorScheme::Dark) { + return Seer::colorizeIcon(icon, QColor("white"), size); + }else{ + qDebug() << "Bad colorScheme of: " << colorScheme; + } + +#endif + return icon; + + }else if (colorMode == "light") { return Seer::colorizeIcon(icon, QColor("white"), size); - }else{ + }else if (colorMode == "dark") { return Seer::colorizeIcon(icon, QColor("black"), size); } -#else - Q_UNUSED(size); + + qDebug() << "Bad iconColorMode of: " << colorMode; return icon; -#endif } QIcon colorizeIcon (const QIcon& icon, const QColor& color, const QSize& size) { @@ -1531,6 +1610,7 @@ namespace Seer { return QIcon(coloredPixmap); #else + Q_UNUSED(icon); Q_UNUSED(color); Q_UNUSED(size); diff --git a/src/SeerUtl.h b/src/SeerUtl.h index 722cfa4..54068c3 100644 --- a/src/SeerUtl.h +++ b/src/SeerUtl.h @@ -68,10 +68,12 @@ namespace Seer { bool isFileExistNotify (const QString& filename); bool isDirExistNotify (const QString& dirname); - void colorizeAllIcons (QWidget* parent, const QSize& size = QSize(32,32)); - void colorizeListWidgetItemIcon (QListWidgetItem* item, const QSize& size = QSize(32,32)); - void colorizeChartViewItem (QChartView* item); - QIcon colorizeIcon (const QIcon& icon, const QSize& size = QSize(32,32)); + void setIconColorMode (const QString& colorMode); + const QString& iconColorMode (); + void colorizeAllIcons (QWidget* parent, const QString& colorMode, const QSize& size = QSize(32,32)); + void colorizeListWidgetItemIcon (QListWidgetItem* item, const QString& colorMode, const QSize& size = QSize(32,32)); + void colorizeChartViewItem (QChartView* item, const QString& colorMode); + QIcon colorizeIcon (const QIcon& icon, const QString& colorMode, const QSize& size = QSize(32,32)); QIcon colorizeIcon (const QIcon& icon, const QColor& color, const QSize& size = QSize(32,32)); } diff --git a/src/SeerVarVisualizerWidget.cpp b/src/SeerVarVisualizerWidget.cpp index aacaac2..01d8957 100644 --- a/src/SeerVarVisualizerWidget.cpp +++ b/src/SeerVarVisualizerWidget.cpp @@ -90,7 +90,7 @@ SeerVarVisualizerWidget::SeerVarVisualizerWidget (QWidget* parent) : QWidget(par #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); // Show/hide columns. handleDebugCheckBox(); @@ -946,7 +946,7 @@ void SeerVarVisualizerWidget::handleIndexEditingFinished (const QModelIndex& ind void SeerVarVisualizerWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this); + Seer::colorizeAllIcons(this, Seer::iconColorMode()); } QTreeWidgetItem* SeerVarVisualizerWidget::findItem (const QString& text, Qt::MatchFlags flags, int column) { From 81bd82ef5038c95dab41f8b02cf73f7f74dcfc73 Mon Sep 17 00:00:00 2001 From: Ernie Pasveer Date: Thu, 23 Jul 2026 11:16:48 -0500 Subject: [PATCH 2/2] Finished adding a Icon Theme option (auto/light/dark). --- src/SeerAboutDialog.cpp | 2 +- src/SeerArrayVisualizerWidget.cpp | 8 +-- src/SeerConfigDialog.cpp | 16 ++--- src/SeerDebugDialog.cpp | 2 +- src/SeerGdbMonitorWidget.cpp | 4 +- src/SeerHelpPageDialog.cpp | 2 +- src/SeerImageVisualizerWidget.cpp | 4 +- src/SeerMainWindow.cpp | 24 ++++--- src/SeerMainWindow.h | 5 +- src/SeerMainWindow.ui | 2 +- src/SeerMatrixVisualizerWidget.cpp | 4 +- src/SeerMemoryVisualizerWidget.cpp | 4 +- src/SeerStructVisualizerWidget.cpp | 4 +- src/SeerUtl.cpp | 55 ++++++++-------- src/SeerUtl.h | 100 ++++++++++++++--------------- src/SeerVarVisualizerWidget.cpp | 4 +- 16 files changed, 121 insertions(+), 119 deletions(-) diff --git a/src/SeerAboutDialog.cpp b/src/SeerAboutDialog.cpp index 460471a..3b13dc2 100644 --- a/src/SeerAboutDialog.cpp +++ b/src/SeerAboutDialog.cpp @@ -53,7 +53,7 @@ SeerAboutDialog::~SeerAboutDialog () { void SeerAboutDialog::handleThemeChanged () { // Get the colorized icon. - QIcon icon = Seer::colorizeIcon(QIcon(":/seer/resources/icons/hicolor/256x256/seergdb.png"), Seer::iconColorMode(), QSize(256,256)); + QIcon icon = Seer::colorizeIcon(QIcon(":/seer/resources/icons/hicolor/256x256/seergdb.png"), Seer::iconColorTheme(), QSize(256,256)); // Set the label's pixmap label->setPixmap(icon.pixmap(QSize(256,256))); diff --git a/src/SeerArrayVisualizerWidget.cpp b/src/SeerArrayVisualizerWidget.cpp index 7bfb948..aa50ae5 100644 --- a/src/SeerArrayVisualizerWidget.cpp +++ b/src/SeerArrayVisualizerWidget.cpp @@ -137,8 +137,8 @@ SeerArrayVisualizerWidget::SeerArrayVisualizerWidget (QWidget* parent) : QWidget #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); - Seer::colorizeChartViewItem(arrayChartView, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); + Seer::colorizeChartViewItem(arrayChartView, Seer::iconColorTheme()); // Restore window settings. readSettings(); @@ -1123,10 +1123,10 @@ void SeerArrayVisualizerWidget::handleLineTypeButtonGroup () { void SeerArrayVisualizerWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); // And the ChartView. - Seer::colorizeChartViewItem(arrayChartView, Seer::iconColorMode()); + Seer::colorizeChartViewItem(arrayChartView, Seer::iconColorTheme()); } void SeerArrayVisualizerWidget::createASeries() { diff --git a/src/SeerConfigDialog.cpp b/src/SeerConfigDialog.cpp index b5c3c7c..99032a2 100644 --- a/src/SeerConfigDialog.cpp +++ b/src/SeerConfigDialog.cpp @@ -110,14 +110,14 @@ SeerConfigDialog::SeerConfigDialog(QWidget* parent) : QDialog(parent) { connect(buttonBox, &QDialogButtonBox::clicked, this, &SeerConfigDialog::handleButtonClicked); // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); - Seer::colorizeListWidgetItemIcon(configSeerButton, Seer::iconColorMode(), QSize(128,128)); - Seer::colorizeListWidgetItemIcon(configGdbButton, Seer::iconColorMode(), QSize(128,128)); - Seer::colorizeListWidgetItemIcon(configEditorButton, Seer::iconColorMode(), QSize(128,128)); - Seer::colorizeListWidgetItemIcon(configSourceButton, Seer::iconColorMode(), QSize(128,128)); - Seer::colorizeListWidgetItemIcon(configAssemblyButton, Seer::iconColorMode(), QSize(128,128)); - Seer::colorizeListWidgetItemIcon(configKeysButton, Seer::iconColorMode(), QSize(128,128)); - // Seer::colorizeListWidgetItemIcon(configRRButton, Seer::iconColorMode(), QSize(128,128)); // Don't change. It's a multi-colored icon. + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); + Seer::colorizeListWidgetItemIcon(configSeerButton, Seer::iconColorTheme(), QSize(128,128)); + Seer::colorizeListWidgetItemIcon(configGdbButton, Seer::iconColorTheme(), QSize(128,128)); + Seer::colorizeListWidgetItemIcon(configEditorButton, Seer::iconColorTheme(), QSize(128,128)); + Seer::colorizeListWidgetItemIcon(configSourceButton, Seer::iconColorTheme(), QSize(128,128)); + Seer::colorizeListWidgetItemIcon(configAssemblyButton, Seer::iconColorTheme(), QSize(128,128)); + Seer::colorizeListWidgetItemIcon(configKeysButton, Seer::iconColorTheme(), QSize(128,128)); + // Seer::colorizeListWidgetItemIcon(configRRButton, Seer::iconColorTheme(), QSize(128,128)); // Don't change. It's a multi-colored icon. // Set to first page. contentsListWidget->setCurrentRow(0); diff --git a/src/SeerDebugDialog.cpp b/src/SeerDebugDialog.cpp index 6d8a7a1..21911c0 100644 --- a/src/SeerDebugDialog.cpp +++ b/src/SeerDebugDialog.cpp @@ -76,7 +76,7 @@ SeerDebugDialog::SeerDebugDialog (QWidget* parent) : QDialog(parent) { QObject::connect(buttonBox, &QDialogButtonBox::clicked, this, &SeerDebugDialog::handleResetButtonClicked); // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); // Set initial run mode. handleRunModeChanged(0); diff --git a/src/SeerGdbMonitorWidget.cpp b/src/SeerGdbMonitorWidget.cpp index f043de3..35a749a 100644 --- a/src/SeerGdbMonitorWidget.cpp +++ b/src/SeerGdbMonitorWidget.cpp @@ -67,7 +67,7 @@ SeerGdbMonitorWidget::SeerGdbMonitorWidget (QWidget* parent) : QWidget(parent) { #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); // Restore window settings. readSettings(); @@ -196,7 +196,7 @@ void SeerGdbMonitorWidget::handleMacroToolButtonClicked (QAbstractButton* button void SeerGdbMonitorWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); } void SeerGdbMonitorWidget::writeSettings() { diff --git a/src/SeerHelpPageDialog.cpp b/src/SeerHelpPageDialog.cpp index 13675a7..9e032a2 100644 --- a/src/SeerHelpPageDialog.cpp +++ b/src/SeerHelpPageDialog.cpp @@ -27,7 +27,7 @@ SeerHelpPageDialog::SeerHelpPageDialog(QDialog* parent) : QDialog(parent) { QObject::connect(okPushButton, &QPushButton::clicked, this, &SeerHelpPageDialog::handleOkPushButton); // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); // Restore window settings. readSettings(); diff --git a/src/SeerImageVisualizerWidget.cpp b/src/SeerImageVisualizerWidget.cpp index ad18623..1d057e3 100644 --- a/src/SeerImageVisualizerWidget.cpp +++ b/src/SeerImageVisualizerWidget.cpp @@ -54,7 +54,7 @@ SeerImageVisualizerWidget::SeerImageVisualizerWidget (QWidget* parent) : QWidget #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); // Restore window settings. readSettings(); @@ -421,7 +421,7 @@ void SeerImageVisualizerWidget::handleCreateImage (const QByteArray& array) { void SeerImageVisualizerWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); } void SeerImageVisualizerWidget::writeSettings() { diff --git a/src/SeerMainWindow.cpp b/src/SeerMainWindow.cpp index 5eefa2c..c2d1c39 100644 --- a/src/SeerMainWindow.cpp +++ b/src/SeerMainWindow.cpp @@ -253,7 +253,7 @@ SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) { #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); handleRecordSettingsChanged(); @@ -607,17 +607,15 @@ const QString& SeerMainWindow::styleName () { return _styleName; } -void SeerMainWindow::setIconColorName (const QString& name) { +void SeerMainWindow::setIconColorTheme(const QString& mode) { - // Check for Dark/Light style from Seer's resource tree. - if (name == "auto" || name == "dark" || name == "light") { + Seer::setIconColorTheme(mode); - _iconColorName = name; - } + handleThemeChanged(); // Will trigger the icon colorization. } -const QString& SeerMainWindow::iconColorName () { - return _iconColorName; +const QString& SeerMainWindow::iconColorTheme () { + return Seer::iconColorTheme(); } void SeerMainWindow::handleFileDebugWithDefaultProject () { @@ -1078,7 +1076,7 @@ void SeerMainWindow::handleIconColorMenuChanged () { return; } - setIconColorName(action->text()); + setIconColorTheme(action->text()); } void SeerMainWindow::handleShowMessage (QString message, int time) { @@ -1746,7 +1744,7 @@ void SeerMainWindow::writeConfigSettings () { settings.beginGroup("mainwindow"); { settings.setValue("qtstyle", styleName()); - settings.setValue("iconcolor", iconColorName()); + settings.setValue("iconcolortheme", iconColorTheme()); } settings.endGroup(); settings.beginGroup("gdb"); { @@ -1830,8 +1828,8 @@ void SeerMainWindow::readConfigSettings () { if (settings.contains("qtstyle")) { setStyleName(settings.value("qtstyle").toString()); } - if (settings.contains("iconcolor")) { - setIconColorName(settings.value("iconcolor").toString()); + if (settings.contains("iconcolortheme")) { + setIconColorTheme(settings.value("iconcolortheme").toString()); } } settings.endGroup(); @@ -2197,6 +2195,6 @@ void SeerMainWindow::handleGdbTargetInterrupt() { void SeerMainWindow::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); } diff --git a/src/SeerMainWindow.h b/src/SeerMainWindow.h index b832ce0..12d7d61 100644 --- a/src/SeerMainWindow.h +++ b/src/SeerMainWindow.h @@ -76,8 +76,8 @@ class SeerMainWindow : public QMainWindow, protected Ui::SeerMainWindowForm { void setStyleName (const QString& name); const QString& styleName (); - void setIconColorName (const QString& name); - const QString& iconColorName (); + void setIconColorTheme (const QString& theme); + const QString& iconColorTheme (); private slots: void handleFileDebugWithDefaultProject (); @@ -131,7 +131,6 @@ class SeerMainWindow : public QMainWindow, protected Ui::SeerMainWindowForm { QActionGroup* _themeStyleMenuActionGroup; QActionGroup* _iconColorMenuActionGroup; QString _styleName; - QString _iconColorName; QAction* _interruptAction; SeerProgressIndicator* _progressIndicator; SeerKeySettings _keySettings; diff --git a/src/SeerMainWindow.ui b/src/SeerMainWindow.ui index e7e9c17..1f309a7 100644 --- a/src/SeerMainWindow.ui +++ b/src/SeerMainWindow.ui @@ -72,7 +72,7 @@ - Icon Color + Icon Theme diff --git a/src/SeerMatrixVisualizerWidget.cpp b/src/SeerMatrixVisualizerWidget.cpp index 7f27d4d..f92b445 100644 --- a/src/SeerMatrixVisualizerWidget.cpp +++ b/src/SeerMatrixVisualizerWidget.cpp @@ -65,7 +65,7 @@ SeerMatrixVisualizerWidget::SeerMatrixVisualizerWidget (QWidget* parent) : QWidg #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); // Restore window settings. readSettings(); @@ -647,7 +647,7 @@ void SeerMatrixVisualizerWidget::handleDataChanged () { void SeerMatrixVisualizerWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); } void SeerMatrixVisualizerWidget::writeSettings() { diff --git a/src/SeerMemoryVisualizerWidget.cpp b/src/SeerMemoryVisualizerWidget.cpp index d845a7f..84b317c 100644 --- a/src/SeerMemoryVisualizerWidget.cpp +++ b/src/SeerMemoryVisualizerWidget.cpp @@ -79,7 +79,7 @@ SeerMemoryVisualizerWidget::SeerMemoryVisualizerWidget (QWidget* parent) : QWidg #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); // Restore window settings. readSettings(); @@ -497,7 +497,7 @@ void SeerMemoryVisualizerWidget::handleSaveButton () { void SeerMemoryVisualizerWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); } void SeerMemoryVisualizerWidget::writeSettings() { diff --git a/src/SeerStructVisualizerWidget.cpp b/src/SeerStructVisualizerWidget.cpp index cdede88..dab9763 100644 --- a/src/SeerStructVisualizerWidget.cpp +++ b/src/SeerStructVisualizerWidget.cpp @@ -53,7 +53,7 @@ SeerStructVisualizerWidget::SeerStructVisualizerWidget (QWidget* parent) : QWidg #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); // Restore window settings. readSettings(); @@ -511,7 +511,7 @@ void SeerStructVisualizerWidget::handleVariableNameLineEdit () { void SeerStructVisualizerWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); } void SeerStructVisualizerWidget::writeSettings () { diff --git a/src/SeerUtl.cpp b/src/SeerUtl.cpp index feb152c..ffa9ba1 100644 --- a/src/SeerUtl.cpp +++ b/src/SeerUtl.cpp @@ -1386,23 +1386,28 @@ namespace Seer { // // Icon colorization. // - static QString _iconColorMode = "auto"; + static QString _iconColorTheme = "auto"; - void setIconColorMode (const QString& colorMode) { - _iconColorMode = colorMode; + void setIconColorTheme (const QString& colorTheme) { + + if (colorTheme == "auto" || colorTheme == "dark" || colorTheme == "light") { + _iconColorTheme = colorTheme; + }else{ + qDebug() << "Bad iconColorTheme of: " << colorTheme; + } } - const QString& iconColorMode () { - return _iconColorMode; + const QString& iconColorTheme () { + return _iconColorTheme; } - void colorizeAllIcons (QWidget* parent, const QString& colorMode, const QSize& size) { + void colorizeAllIcons (QWidget* parent, const QString& colorTheme, const QSize& size) { if (parent == nullptr) { return; } - if (colorMode == "auto") { + if (colorTheme == "auto") { #if QT_VERSION >= QT_VERSION_CHECK(6, 6, 3) // Get the current color scheme @@ -1419,7 +1424,7 @@ namespace Seer { #endif return; - }else if (colorMode == "light") { + }else if (colorTheme == "light") { // Look for all button types. const auto buttons = parent->findChildren(); @@ -1449,7 +1454,7 @@ namespace Seer { return; - }else if (colorMode == "dark") { + }else if (colorTheme == "dark") { // Look for all button types. const auto buttons = parent->findChildren(); @@ -1480,16 +1485,16 @@ namespace Seer { return; } - qDebug() << "Bad iconColorMode of: " << colorMode; + qDebug() << "Bad iconColorTheme of: " << colorTheme; } - void colorizeListWidgetItemIcon (QListWidgetItem* item, const QString& colorMode, const QSize& size) { + void colorizeListWidgetItemIcon (QListWidgetItem* item, const QString& colorTheme, const QSize& size) { if (item == nullptr) { return; } - if (colorMode == "auto") { + if (colorTheme == "auto") { #if QT_VERSION >= QT_VERSION_CHECK(6, 6, 3) // Get the current color scheme @@ -1506,18 +1511,18 @@ namespace Seer { #endif return; - }else if (colorMode == "light") { + }else if (colorTheme == "light") { item->setIcon(Seer::colorizeIcon(item->icon(), QColor("black"), size)); return; - }else if (colorMode == "dark") { + }else if (colorTheme == "dark") { item->setIcon(Seer::colorizeIcon(item->icon(), QColor("white"), size)); return; } - qDebug() << "Bad iconColorMode of: " << colorMode; + qDebug() << "Bad iconColorTheme of: " << colorTheme; } - void colorizeChartViewItem (QChartView* item, const QString& colorMode) { + void colorizeChartViewItem (QChartView* item, const QString& colorTheme) { if (item == nullptr) { return; @@ -1529,7 +1534,7 @@ namespace Seer { return; } - if (colorMode == "auto") { + if (colorTheme == "auto") { #if QT_VERSION >= QT_VERSION_CHECK(6, 6, 3) // Get the current color scheme @@ -1546,20 +1551,20 @@ namespace Seer { #endif return; - }else if (colorMode == "light") { + }else if (colorTheme == "light") { chart->setTheme(QChart::ChartThemeLight); return; - }else if (colorMode == "dark") { + }else if (colorTheme == "dark") { chart->setTheme(QChart::ChartThemeDark); return; } - qDebug() << "Bad iconColorMode of: " << colorMode; + qDebug() << "Bad iconColorTheme of: " << colorTheme; } - QIcon colorizeIcon (const QIcon& icon, const QString& colorMode, const QSize& size) { + QIcon colorizeIcon (const QIcon& icon, const QString& colorTheme, const QSize& size) { - if (colorMode == "auto") { + if (colorTheme == "auto") { #if QT_VERSION >= QT_VERSION_CHECK(6, 6, 3) // Get the current color scheme @@ -1576,13 +1581,13 @@ namespace Seer { #endif return icon; - }else if (colorMode == "light") { + }else if (colorTheme == "light") { return Seer::colorizeIcon(icon, QColor("white"), size); - }else if (colorMode == "dark") { + }else if (colorTheme == "dark") { return Seer::colorizeIcon(icon, QColor("black"), size); } - qDebug() << "Bad iconColorMode of: " << colorMode; + qDebug() << "Bad iconColorTheme of: " << colorTheme; return icon; } diff --git a/src/SeerUtl.h b/src/SeerUtl.h index 54068c3..b7987ec 100644 --- a/src/SeerUtl.h +++ b/src/SeerUtl.h @@ -22,58 +22,58 @@ namespace Seer { - QString version (); + QString version (); - QString filterBareNewLines (const QString& str); - QString filterEscapes (const QString& str); - QStringList filterEscapes (const QStringList& strings); - QString expandTabs (const QString& str, int tabwidth, bool morph); - QString expandEnv (const QString& str, bool* ok = nullptr); - QStringList parse (const QString& str, const QString& search, QChar startBracket, QChar endBracket, bool includeSearch); - QString parseFirst (const QString& str, const QString& search, QChar startBracket, QChar endBracket, bool includeSearch); - QString parseFirst (const QString& str, const QString& search, bool includeSearch); - bool hasBookends (const QString& str, QChar startBracket, QChar endBracket); - QString filterBookends (const QString& str, QChar startBracket, QChar endBracket); - QStringList filterBookends (const QStringList& strings, QChar startBracket, QChar endBracket); - QStringList parseCommaList (const QString& str); - QStringList parseCommaList (const QString& str, QChar startBracket, QChar endBracket); - QStringList parseArray (const QString& parentName, const QString& str); - QMap createKeyValueMap (const QStringList& list, QChar separator); - QStringPair parseNameValue (const QString& str, QChar separator); - QString quoteChars (const QString& str, const QString& chars); - QStringList quoteChars (const QStringList& strings, const QString& chars); - QString varObjParent (const QString& str); - bool matchesWildcard (const QStringList& regexpatterns, const QString& string); - bool hasWildcards (const QString& str); - QString elideText (const QString& str, Qt::TextElideMode mode, int length); - QStringList split (const QString& str); - QString unescape (const QString& str); - int createID (); - unsigned char ebcdicToAscii (unsigned char byte); - unsigned char ucharToAscii (unsigned char byte); - QString ucharToHex (const QVector& bytes, int from, int count); - QString ucharToOctal (const QVector& bytes, int from, int count); - QString ucharToAscii (const QVector& bytes, int from, int count); - QString ucharToUShort (const QVector& bytes, int from, int count); - QString ucharToShort (const QVector& bytes, int from, int count); - QString ucharToUInt (const QVector& bytes, int from, int count); - QString ucharToInt (const QVector& bytes, int from, int count); - QString ucharToULong (const QVector& bytes, int from, int count); - QString ucharToLong (const QVector& bytes, int from, int count); - QString ucharToFloat (const QVector& bytes, int from, int count); - QString ucharToDouble (const QVector& bytes, int from, int count); - int typeBytes (const QString& type); - bool readFile (const QString& filename, QStringList& lines); - void printStackTrace (); - bool isFileExistNotify (const QString& filename); - bool isDirExistNotify (const QString& dirname); + QString filterBareNewLines (const QString& str); + QString filterEscapes (const QString& str); + QStringList filterEscapes (const QStringList& strings); + QString expandTabs (const QString& str, int tabwidth, bool morph); + QString expandEnv (const QString& str, bool* ok = nullptr); + QStringList parse (const QString& str, const QString& search, QChar startBracket, QChar endBracket, bool includeSearch); + QString parseFirst (const QString& str, const QString& search, QChar startBracket, QChar endBracket, bool includeSearch); + QString parseFirst (const QString& str, const QString& search, bool includeSearch); + bool hasBookends (const QString& str, QChar startBracket, QChar endBracket); + QString filterBookends (const QString& str, QChar startBracket, QChar endBracket); + QStringList filterBookends (const QStringList& strings, QChar startBracket, QChar endBracket); + QStringList parseCommaList (const QString& str); + QStringList parseCommaList (const QString& str, QChar startBracket, QChar endBracket); + QStringList parseArray (const QString& parentName, const QString& str); + QMap createKeyValueMap (const QStringList& list, QChar separator); + QStringPair parseNameValue (const QString& str, QChar separator); + QString quoteChars (const QString& str, const QString& chars); + QStringList quoteChars (const QStringList& strings, const QString& chars); + QString varObjParent (const QString& str); + bool matchesWildcard (const QStringList& regexpatterns, const QString& string); + bool hasWildcards (const QString& str); + QString elideText (const QString& str, Qt::TextElideMode mode, int length); + QStringList split (const QString& str); + QString unescape (const QString& str); + int createID (); + unsigned char ebcdicToAscii (unsigned char byte); + unsigned char ucharToAscii (unsigned char byte); + QString ucharToHex (const QVector& bytes, int from, int count); + QString ucharToOctal (const QVector& bytes, int from, int count); + QString ucharToAscii (const QVector& bytes, int from, int count); + QString ucharToUShort (const QVector& bytes, int from, int count); + QString ucharToShort (const QVector& bytes, int from, int count); + QString ucharToUInt (const QVector& bytes, int from, int count); + QString ucharToInt (const QVector& bytes, int from, int count); + QString ucharToULong (const QVector& bytes, int from, int count); + QString ucharToLong (const QVector& bytes, int from, int count); + QString ucharToFloat (const QVector& bytes, int from, int count); + QString ucharToDouble (const QVector& bytes, int from, int count); + int typeBytes (const QString& type); + bool readFile (const QString& filename, QStringList& lines); + void printStackTrace (); + bool isFileExistNotify (const QString& filename); + bool isDirExistNotify (const QString& dirname); - void setIconColorMode (const QString& colorMode); - const QString& iconColorMode (); - void colorizeAllIcons (QWidget* parent, const QString& colorMode, const QSize& size = QSize(32,32)); - void colorizeListWidgetItemIcon (QListWidgetItem* item, const QString& colorMode, const QSize& size = QSize(32,32)); - void colorizeChartViewItem (QChartView* item, const QString& colorMode); - QIcon colorizeIcon (const QIcon& icon, const QString& colorMode, const QSize& size = QSize(32,32)); + void setIconColorTheme (const QString& colorTheme); + const QString& iconColorTheme (); + void colorizeAllIcons (QWidget* parent, const QString& colorTheme, const QSize& size = QSize(32,32)); + void colorizeListWidgetItemIcon (QListWidgetItem* item, const QString& colorTheme, const QSize& size = QSize(32,32)); + void colorizeChartViewItem (QChartView* item, const QString& colorTheme); + QIcon colorizeIcon (const QIcon& icon, const QString& colorTheme, const QSize& size = QSize(32,32)); QIcon colorizeIcon (const QIcon& icon, const QColor& color, const QSize& size = QSize(32,32)); } diff --git a/src/SeerVarVisualizerWidget.cpp b/src/SeerVarVisualizerWidget.cpp index 01d8957..0f7d1dc 100644 --- a/src/SeerVarVisualizerWidget.cpp +++ b/src/SeerVarVisualizerWidget.cpp @@ -90,7 +90,7 @@ SeerVarVisualizerWidget::SeerVarVisualizerWidget (QWidget* parent) : QWidget(par #endif // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); // Show/hide columns. handleDebugCheckBox(); @@ -946,7 +946,7 @@ void SeerVarVisualizerWidget::handleIndexEditingFinished (const QModelIndex& ind void SeerVarVisualizerWidget::handleThemeChanged () { // Colorize icons for theme. - Seer::colorizeAllIcons(this, Seer::iconColorMode()); + Seer::colorizeAllIcons(this, Seer::iconColorTheme()); } QTreeWidgetItem* SeerVarVisualizerWidget::findItem (const QString& text, Qt::MatchFlags flags, int column) {