mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 08:34:42 +08:00
Merge pull request #492 from epasveer/445-adopt-app-icons-to-kde-breeze-dark-theme
445 adopt app icons to kde breeze dark theme
This commit is contained in:
@@ -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::iconColorTheme(), QSize(256,256));
|
||||
|
||||
// Set the label's pixmap
|
||||
label->setPixmap(icon.pixmap(QSize(256,256)));
|
||||
|
||||
@@ -137,8 +137,8 @@ SeerArrayVisualizerWidget::SeerArrayVisualizerWidget (QWidget* parent) : QWidget
|
||||
#endif
|
||||
|
||||
// Colorize icons for theme.
|
||||
Seer::colorizeAllIcons(this);
|
||||
Seer::colorizeChartViewItem(arrayChartView);
|
||||
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::colorizeAllIcons(this, Seer::iconColorTheme());
|
||||
|
||||
// And the ChartView.
|
||||
Seer::colorizeChartViewItem(arrayChartView);
|
||||
Seer::colorizeChartViewItem(arrayChartView, Seer::iconColorTheme());
|
||||
}
|
||||
|
||||
void SeerArrayVisualizerWidget::createASeries() {
|
||||
|
||||
@@ -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::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);
|
||||
|
||||
@@ -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::iconColorTheme());
|
||||
|
||||
// Set initial run mode.
|
||||
handleRunModeChanged(0);
|
||||
|
||||
@@ -67,7 +67,7 @@ SeerGdbMonitorWidget::SeerGdbMonitorWidget (QWidget* parent) : QWidget(parent) {
|
||||
#endif
|
||||
|
||||
// Colorize icons for theme.
|
||||
Seer::colorizeAllIcons(this);
|
||||
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::colorizeAllIcons(this, Seer::iconColorTheme());
|
||||
}
|
||||
|
||||
void SeerGdbMonitorWidget::writeSettings() {
|
||||
|
||||
@@ -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::iconColorTheme());
|
||||
|
||||
// Restore window settings.
|
||||
readSettings();
|
||||
|
||||
@@ -54,7 +54,7 @@ SeerImageVisualizerWidget::SeerImageVisualizerWidget (QWidget* parent) : QWidget
|
||||
#endif
|
||||
|
||||
// Colorize icons for theme.
|
||||
Seer::colorizeAllIcons(this);
|
||||
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::colorizeAllIcons(this, Seer::iconColorTheme());
|
||||
}
|
||||
|
||||
void SeerImageVisualizerWidget::writeSettings() {
|
||||
|
||||
+61
-16
@@ -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::iconColorTheme());
|
||||
|
||||
handleRecordSettingsChanged();
|
||||
|
||||
@@ -588,6 +607,17 @@ const QString& SeerMainWindow::styleName () {
|
||||
return _styleName;
|
||||
}
|
||||
|
||||
void SeerMainWindow::setIconColorTheme(const QString& mode) {
|
||||
|
||||
Seer::setIconColorTheme(mode);
|
||||
|
||||
handleThemeChanged(); // Will trigger the icon colorization.
|
||||
}
|
||||
|
||||
const QString& SeerMainWindow::iconColorTheme () {
|
||||
return Seer::iconColorTheme();
|
||||
}
|
||||
|
||||
void SeerMainWindow::handleFileDebugWithDefaultProject () {
|
||||
handleFileDebug(true);
|
||||
}
|
||||
@@ -1027,9 +1057,9 @@ void SeerMainWindow::handleRestartExecutable () {
|
||||
}
|
||||
}
|
||||
|
||||
void SeerMainWindow::handleStyleMenuChanged () {
|
||||
void SeerMainWindow::handleThemeStyleMenuChanged () {
|
||||
|
||||
QAction* action = _styleMenuActionGroup->checkedAction();
|
||||
QAction* action = _themeStyleMenuActionGroup->checkedAction();
|
||||
|
||||
if (action == 0) {
|
||||
return;
|
||||
@@ -1038,6 +1068,17 @@ void SeerMainWindow::handleStyleMenuChanged () {
|
||||
setStyleName(action->text());
|
||||
}
|
||||
|
||||
void SeerMainWindow::handleIconColorMenuChanged () {
|
||||
|
||||
QAction* action = _iconColorMenuActionGroup->checkedAction();
|
||||
|
||||
if (action == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
setIconColorTheme(action->text());
|
||||
}
|
||||
|
||||
void SeerMainWindow::handleShowMessage (QString message, int time) {
|
||||
|
||||
statusBar()->showMessage(message, time);
|
||||
@@ -1703,6 +1744,7 @@ void SeerMainWindow::writeConfigSettings () {
|
||||
|
||||
settings.beginGroup("mainwindow"); {
|
||||
settings.setValue("qtstyle", styleName());
|
||||
settings.setValue("iconcolortheme", iconColorTheme());
|
||||
} settings.endGroup();
|
||||
|
||||
settings.beginGroup("gdb"); {
|
||||
@@ -1786,6 +1828,9 @@ void SeerMainWindow::readConfigSettings () {
|
||||
if (settings.contains("qtstyle")) {
|
||||
setStyleName(settings.value("qtstyle").toString());
|
||||
}
|
||||
if (settings.contains("iconcolortheme")) {
|
||||
setIconColorTheme(settings.value("iconcolortheme").toString());
|
||||
}
|
||||
} settings.endGroup();
|
||||
|
||||
settings.beginGroup("gdb"); {
|
||||
@@ -2150,6 +2195,6 @@ void SeerMainWindow::handleGdbTargetInterrupt() {
|
||||
void SeerMainWindow::handleThemeChanged () {
|
||||
|
||||
// Colorize icons for theme.
|
||||
Seer::colorizeAllIcons(this);
|
||||
Seer::colorizeAllIcons(this, Seer::iconColorTheme());
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,8 @@ class SeerMainWindow : public QMainWindow, protected Ui::SeerMainWindowForm {
|
||||
|
||||
void setStyleName (const QString& name);
|
||||
const QString& styleName ();
|
||||
void setIconColorTheme (const QString& theme);
|
||||
const QString& iconColorTheme ();
|
||||
|
||||
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,7 +128,8 @@ class SeerMainWindow : public QMainWindow, protected Ui::SeerMainWindowForm {
|
||||
void refreshShortCuts ();
|
||||
|
||||
private:
|
||||
QActionGroup* _styleMenuActionGroup;
|
||||
QActionGroup* _themeStyleMenuActionGroup;
|
||||
QActionGroup* _iconColorMenuActionGroup;
|
||||
QString _styleName;
|
||||
QAction* _interruptAction;
|
||||
SeerProgressIndicator* _progressIndicator;
|
||||
|
||||
+13
-3
@@ -61,9 +61,18 @@
|
||||
<addaction name="actionConsoleDetached"/>
|
||||
<addaction name="actionConsoleDetachedMinimized"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuStyles">
|
||||
<widget class="QMenu" name="menuThemeStyle">
|
||||
<property name="title">
|
||||
<string>Styles</string>
|
||||
<string>Theme Style</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resource.qrc">
|
||||
<normaloff>:/seer/resources/icons-icons/style.png</normaloff>:/seer/resources/icons-icons/style.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuIconColor">
|
||||
<property name="title">
|
||||
<string>Icon Theme</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resource.qrc">
|
||||
@@ -79,7 +88,8 @@
|
||||
<addaction name="actionViewAssembly"/>
|
||||
<addaction name="actionViewGdbMonitor"/>
|
||||
<addaction name="menuConsole"/>
|
||||
<addaction name="menuStyles"/>
|
||||
<addaction name="menuThemeStyle"/>
|
||||
<addaction name="menuIconColor"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuSettings">
|
||||
<property name="title">
|
||||
|
||||
@@ -65,7 +65,7 @@ SeerMatrixVisualizerWidget::SeerMatrixVisualizerWidget (QWidget* parent) : QWidg
|
||||
#endif
|
||||
|
||||
// Colorize icons for theme.
|
||||
Seer::colorizeAllIcons(this);
|
||||
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::colorizeAllIcons(this, Seer::iconColorTheme());
|
||||
}
|
||||
|
||||
void SeerMatrixVisualizerWidget::writeSettings() {
|
||||
|
||||
@@ -79,7 +79,7 @@ SeerMemoryVisualizerWidget::SeerMemoryVisualizerWidget (QWidget* parent) : QWidg
|
||||
#endif
|
||||
|
||||
// Colorize icons for theme.
|
||||
Seer::colorizeAllIcons(this);
|
||||
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::colorizeAllIcons(this, Seer::iconColorTheme());
|
||||
}
|
||||
|
||||
void SeerMemoryVisualizerWidget::writeSettings() {
|
||||
|
||||
@@ -53,7 +53,7 @@ SeerStructVisualizerWidget::SeerStructVisualizerWidget (QWidget* parent) : QWidg
|
||||
#endif
|
||||
|
||||
// Colorize icons for theme.
|
||||
Seer::colorizeAllIcons(this);
|
||||
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::colorizeAllIcons(this, Seer::iconColorTheme());
|
||||
}
|
||||
|
||||
void SeerStructVisualizerWidget::writeSettings () {
|
||||
|
||||
+177
-92
@@ -1383,90 +1383,147 @@ namespace Seer {
|
||||
}
|
||||
}
|
||||
|
||||
void colorizeAllIcons (QWidget* parent, const QSize& size) {
|
||||
//
|
||||
// Icon colorization.
|
||||
//
|
||||
static QString _iconColorTheme = "auto";
|
||||
|
||||
void setIconColorTheme (const QString& colorTheme) {
|
||||
|
||||
if (colorTheme == "auto" || colorTheme == "dark" || colorTheme == "light") {
|
||||
_iconColorTheme = colorTheme;
|
||||
}else{
|
||||
qDebug() << "Bad iconColorTheme of: " << colorTheme;
|
||||
}
|
||||
}
|
||||
|
||||
const QString& iconColorTheme () {
|
||||
return _iconColorTheme;
|
||||
}
|
||||
|
||||
void colorizeAllIcons (QWidget* parent, const QString& colorTheme, 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<QAbstractButton*>();
|
||||
|
||||
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<QMenu*>();
|
||||
|
||||
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<QAction*>();
|
||||
|
||||
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 (colorTheme == "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 (colorTheme == "light") {
|
||||
|
||||
// Look for all button types.
|
||||
const auto buttons = parent->findChildren<QAbstractButton*>();
|
||||
|
||||
for (QAbstractButton* button : buttons) {
|
||||
button->setIcon(Seer::colorizeIcon(button->icon(), QColor("black"), size));
|
||||
}
|
||||
|
||||
// Look for all menu types.
|
||||
const auto menus = parent->findChildren<QMenu*>();
|
||||
|
||||
for (QMenu* menu : menus) {
|
||||
menu->setIcon(Seer::colorizeIcon(menu->icon(), QColor("black"), size));
|
||||
}
|
||||
|
||||
// Look for all action types.
|
||||
const auto actions = parent->findChildren<QAction*>();
|
||||
|
||||
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 (colorTheme == "dark") {
|
||||
|
||||
// Look for all button types.
|
||||
const auto buttons = parent->findChildren<QAbstractButton*>();
|
||||
|
||||
for (QAbstractButton* button : buttons) {
|
||||
button->setIcon(Seer::colorizeIcon(button->icon(), QColor("white"), size));
|
||||
}
|
||||
|
||||
// Look for all menu types.
|
||||
const auto menus = parent->findChildren<QMenu*>();
|
||||
|
||||
for (QMenu* menu : menus) {
|
||||
menu->setIcon(Seer::colorizeIcon(menu->icon(), QColor("white"), size));
|
||||
}
|
||||
|
||||
// Look for all action types.
|
||||
const auto actions = parent->findChildren<QAction*>();
|
||||
|
||||
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 iconColorTheme of: " << colorTheme;
|
||||
}
|
||||
|
||||
void colorizeListWidgetItemIcon (QListWidgetItem* item, const QString& colorTheme, 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 (colorTheme == "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 (colorTheme == "light") {
|
||||
item->setIcon(Seer::colorizeIcon(item->icon(), QColor("black"), size));
|
||||
return;
|
||||
}else if (colorTheme == "dark") {
|
||||
item->setIcon(Seer::colorizeIcon(item->icon(), QColor("white"), size));
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "Bad iconColorTheme of: " << colorTheme;
|
||||
}
|
||||
|
||||
void colorizeChartViewItem (QChartView* item, const QString& colorTheme) {
|
||||
|
||||
if (item == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -1477,35 +1534,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 (colorTheme == "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 (colorTheme == "light") {
|
||||
chart->setTheme(QChart::ChartThemeLight);
|
||||
return;
|
||||
}else if (colorTheme == "dark") {
|
||||
chart->setTheme(QChart::ChartThemeDark);
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "Bad iconColorTheme of: " << colorTheme;
|
||||
}
|
||||
|
||||
QIcon colorizeIcon (const QIcon& icon, const QString& colorTheme, const QSize& size) {
|
||||
|
||||
if (colorTheme == "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 (colorTheme == "light") {
|
||||
return Seer::colorizeIcon(icon, QColor("white"), size);
|
||||
}else{
|
||||
}else if (colorTheme == "dark") {
|
||||
return Seer::colorizeIcon(icon, QColor("black"), size);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(size);
|
||||
|
||||
qDebug() << "Bad iconColorTheme of: " << colorTheme;
|
||||
|
||||
return icon;
|
||||
#endif
|
||||
}
|
||||
|
||||
QIcon colorizeIcon (const QIcon& icon, const QColor& color, const QSize& size) {
|
||||
@@ -1531,6 +1615,7 @@ namespace Seer {
|
||||
|
||||
return QIcon(coloredPixmap);
|
||||
#else
|
||||
Q_UNUSED(icon);
|
||||
Q_UNUSED(color);
|
||||
Q_UNUSED(size);
|
||||
|
||||
|
||||
+50
-48
@@ -22,56 +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<QString,QString> 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<quint8>& bytes, int from, int count);
|
||||
QString ucharToOctal (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToAscii (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToUShort (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToShort (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToUInt (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToInt (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToULong (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToLong (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToFloat (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToDouble (const QVector<quint8>& 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<QString,QString> 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<quint8>& bytes, int from, int count);
|
||||
QString ucharToOctal (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToAscii (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToUShort (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToShort (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToUInt (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToInt (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToULong (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToLong (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToFloat (const QVector<quint8>& bytes, int from, int count);
|
||||
QString ucharToDouble (const QVector<quint8>& 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 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 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));
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ SeerVarVisualizerWidget::SeerVarVisualizerWidget (QWidget* parent) : QWidget(par
|
||||
#endif
|
||||
|
||||
// Colorize icons for theme.
|
||||
Seer::colorizeAllIcons(this);
|
||||
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::colorizeAllIcons(this, Seer::iconColorTheme());
|
||||
}
|
||||
|
||||
QTreeWidgetItem* SeerVarVisualizerWidget::findItem (const QString& text, Qt::MatchFlags flags, int column) {
|
||||
|
||||
Reference in New Issue
Block a user