diff '--color=auto' -Nur a/lxqt-config-appearance/lxqtthemeconfig.cpp b/lxqt-config-appearance/lxqtthemeconfig.cpp --- a/lxqt-config-appearance/lxqtthemeconfig.cpp 2024-11-05 05:22:05.000000000 +0000 +++ b/lxqt-config-appearance/lxqtthemeconfig.cpp 2024-11-08 18:39:06.790390985 +0000 @@ -35,7 +35,6 @@ #include #include #include -#include #include @@ -61,11 +60,10 @@ } }; -LXQtThemeConfig::LXQtThemeConfig(LXQt::Settings *settings, StyleConfig *stylePage, QWidget *parent) : +LXQtThemeConfig::LXQtThemeConfig(LXQt::Settings *settings, QWidget *parent) : QWidget(parent), ui(new Ui::LXQtThemeConfig), - mSettings(settings), - mStylePage(stylePage) + mSettings(settings) { ui->setupUi(this); { @@ -96,9 +94,8 @@ initControls(); - connect(ui->lxqtThemeList, &QTreeWidget::currentItemChanged, this, &LXQtThemeConfig::onCurrentItemChanged); + connect(ui->lxqtThemeList, &QTreeWidget::currentItemChanged, this, &LXQtThemeConfig::settingsChanged); connect(ui->wallpaperOverride, &QAbstractButton::clicked, this, &LXQtThemeConfig::settingsChanged); - connect(ui->paletteOverride, &QAbstractButton::clicked, this, &LXQtThemeConfig::onPaletteOverrideChanged); connect(ui->lxqtThemeList, &QTreeWidget::itemDoubleClicked, this, &LXQtThemeConfig::doubleClicked); connect(ui->lxqtThemeList, &QWidget::customContextMenuRequested, this, &LXQtThemeConfig::contextMenu); @@ -125,9 +122,6 @@ ++it; } - ui->wallpaperOverride->setChecked(mSettings->value(QStringLiteral("wallpaper_override")).toBool()); - ui->paletteOverride->setChecked(mSettings->value(QStringLiteral("palette_override")).toBool()); - update(); } @@ -155,12 +149,6 @@ } } } - - if(mSettings->value(QStringLiteral("wallpaper_override")) != ui->wallpaperOverride->isChecked()) - mSettings->setValue(QStringLiteral("wallpaper_override"), ui->wallpaperOverride->isChecked()); - - if(mSettings->value(QStringLiteral("palette_override")) != ui->paletteOverride->isChecked()) - mSettings->setValue(QStringLiteral("palette_override"), ui->paletteOverride->isChecked()); } void LXQtThemeConfig::doubleClicked(QTreeWidgetItem *item, int /*column*/) @@ -188,43 +176,3 @@ }); menu.exec(ui->lxqtThemeList->viewport()->mapToGlobal(p)); } - -void LXQtThemeConfig::loadThemePalette() -{ - QTreeWidgetItem* current = ui->lxqtThemeList->currentItem(); - if (!ui->paletteOverride->isChecked() || !mStylePage || !current) - return; - QString themeName = current->data(0, Qt::UserRole).toString(); - if (themeName.isEmpty()) - return; - themeName[0] = themeName[0].toTitleCase(); // palette names should be as they appear in GUI - auto paths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); - paths.removeDuplicates(); - for (const auto &path : std::as_const(paths)) - { - QDir dir(path + QLatin1String("/lxqt/palettes")); - if (dir.exists()) - { - if (dir.exists(themeName)) - { - const QString palettePath = path + QStringLiteral("/lxqt/palettes/") + themeName; - mStylePage->loadPaletteFile(palettePath); - break; - } - } - } -} - -void LXQtThemeConfig::onPaletteOverrideChanged(bool checked) -{ - emit settingsChanged(); - if (checked) - loadThemePalette(); -} - -void LXQtThemeConfig::onCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*) -{ - emit settingsChanged(); - if (ui->paletteOverride->isChecked()) - loadThemePalette(); -} diff '--color=auto' -Nur a/lxqt-config-appearance/lxqtthemeconfig.h b/lxqt-config-appearance/lxqtthemeconfig.h --- a/lxqt-config-appearance/lxqtthemeconfig.h 2024-11-05 05:22:05.000000000 +0000 +++ b/lxqt-config-appearance/lxqtthemeconfig.h 2024-11-08 18:39:06.791390985 +0000 @@ -30,7 +30,6 @@ #include #include -#include "styleconfig.h" class QTreeWidgetItem; @@ -43,7 +42,7 @@ Q_OBJECT public: - explicit LXQtThemeConfig(LXQt::Settings *settings, StyleConfig *stylePage, QWidget *parent = nullptr); + explicit LXQtThemeConfig(LXQt::Settings *settings, QWidget *parent = nullptr); ~LXQtThemeConfig(); void applyLxqtTheme(); @@ -57,15 +56,10 @@ private slots: void doubleClicked(QTreeWidgetItem *item, int column); void contextMenu(const QPoint& p); - void onPaletteOverrideChanged(bool checked); - void onCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*); private: - void loadThemePalette(); - Ui::LXQtThemeConfig *ui; LXQt::Settings *mSettings; - StyleConfig *mStylePage; }; #endif // LXQTTHEMECONFIG_H diff '--color=auto' -Nur a/lxqt-config-appearance/lxqtthemeconfig.ui b/lxqt-config-appearance/lxqtthemeconfig.ui --- a/lxqt-config-appearance/lxqtthemeconfig.ui 2024-11-05 05:22:05.000000000 +0000 +++ b/lxqt-config-appearance/lxqtthemeconfig.ui 2024-11-08 18:39:06.791390985 +0000 @@ -58,13 +58,6 @@ - - - - Use palette provided by theme - - - diff '--color=auto' -Nur a/lxqt-config-appearance/main.cpp b/lxqt-config-appearance/main.cpp --- a/lxqt-config-appearance/main.cpp 2024-11-05 05:22:05.000000000 +0000 +++ b/lxqt-config-appearance/main.cpp 2024-11-08 18:39:06.791390985 +0000 @@ -88,7 +88,7 @@ QObject::connect(iconPage, &IconThemeConfig::updateOtherSettings, configOtherToolKits, &ConfigOtherToolKits::setConfig); /*** LXQt Theme ***/ - LXQtThemeConfig* themePage = new LXQtThemeConfig(settings, stylePage, dialog); + LXQtThemeConfig* themePage = new LXQtThemeConfig(settings, dialog); dialog->addPage(themePage, QObject::tr("LXQt Theme"), QStringList() << QStringLiteral("preferences-desktop-color") << QStringLiteral("preferences-desktop")); QObject::connect(dialog, &LXQt::ConfigDialog::reset, themePage, &LXQtThemeConfig::initControls); QObject::connect(themePage, &LXQtThemeConfig::settingsChanged, dialog, [dialog] { diff '--color=auto' -Nur a/lxqt-config-appearance/styleconfig.cpp b/lxqt-config-appearance/styleconfig.cpp --- a/lxqt-config-appearance/styleconfig.cpp 2024-11-05 05:22:05.000000000 +0000 +++ b/lxqt-config-appearance/styleconfig.cpp 2024-11-08 18:39:06.791390985 +0000 @@ -485,70 +485,65 @@ dialog.setQuestion(tr("Do you really want to remove selected palette(s)?\nRoot palettes will remain intact if existing.")); if (dialog.exec() == QDialog::Accepted) - { - loadPaletteFile(dialog.currentPalette()); - } -} + { // set color labels + auto paletteFile = dialog.currentPalette(); + if (paletteFile.isEmpty()) + return; + QSettings settings(paletteFile, QSettings::IniFormat); + settings.beginGroup(QStringLiteral("Palette")); + + QColor color; + color = QColor::fromString(settings.value(QStringLiteral("window_color")).toString()); + if (!color.isValid()) + color = QGuiApplication::palette().color(QPalette::Active,QPalette::Window); + ui->winColorLabel->setColor(color, true); + + color = QColor::fromString(settings.value(QStringLiteral("base_color")).toString()); + if (!color.isValid()) + color = QGuiApplication::palette().color(QPalette::Active,QPalette::Base); + ui->baseColorLabel->setColor(color, true); + + color = QColor::fromString(settings.value(QStringLiteral("highlight_color")).toString()); + if (!color.isValid()) + color = QGuiApplication::palette().color(QPalette::Active,QPalette::Highlight); + ui->highlightColorLabel->setColor(color, true); + + color = QColor::fromString(settings.value(QStringLiteral("window_text_color")).toString()); + if (!color.isValid()) + color = QGuiApplication::palette().color(QPalette::Active,QPalette::WindowText); + ui->windowTextColorLabel->setColor(color, true); + + color = QColor::fromString(settings.value(QStringLiteral("text_color")).toString()); + if (!color.isValid()) + color = QGuiApplication::palette().color(QPalette::Active,QPalette::Text); + ui->viewTextColorLabel->setColor(color, true); + + color = QColor::fromString(settings.value(QStringLiteral("highlighted_text_color")).toString()); + if (!color.isValid()) + color = QGuiApplication::palette().color(QPalette::Active,QPalette::HighlightedText); + ui->highlightedTextColorLabel->setColor(color, true); + + color = QColor::fromString(settings.value(QStringLiteral("link_color")).toString()); + if (!color.isValid()) + color = QGuiApplication::palette().color(QPalette::Active,QPalette::Link); + ui->linkColorLabel->setColor(color, true); + + color = QColor::fromString(settings.value(QStringLiteral("link_visited_color")).toString()); + if (!color.isValid()) + color = QGuiApplication::palette().color(QPalette::Active,QPalette::LinkVisited); + ui->linkVisitedColorLabel->setColor(color, true); + + // tooltips use the Inactive color group + color = QColor::fromString(settings.value(QStringLiteral("tooltip_base_color")).toString()); + if (!color.isValid()) + color = QGuiApplication::palette().color(QPalette::Inactive,QPalette::ToolTipBase); + ui->tooltipColorLabel->setColor(color, true); + + color = QColor::fromString(settings.value(QStringLiteral("tooltip_text_color")).toString()); + if (!color.isValid()) + color = QGuiApplication::palette().color(QPalette::Inactive,QPalette::ToolTipText); + ui->tooltipTextColorLabel->setColor(color, true); -void StyleConfig::loadPaletteFile(const QString& paletteFile) -{ // set color labels - if (paletteFile.isEmpty()) - return; - - QSettings settings(paletteFile, QSettings::IniFormat); - settings.beginGroup(QStringLiteral("Palette")); - - QColor color; - color = QColor::fromString(settings.value(QStringLiteral("window_color")).toString()); - if (!color.isValid()) - color = QGuiApplication::palette().color(QPalette::Active,QPalette::Window); - ui->winColorLabel->setColor(color, true); - - color = QColor::fromString(settings.value(QStringLiteral("base_color")).toString()); - if (!color.isValid()) - color = QGuiApplication::palette().color(QPalette::Active,QPalette::Base); - ui->baseColorLabel->setColor(color, true); - - color = QColor::fromString(settings.value(QStringLiteral("highlight_color")).toString()); - if (!color.isValid()) - color = QGuiApplication::palette().color(QPalette::Active,QPalette::Highlight); - ui->highlightColorLabel->setColor(color, true); - - color = QColor::fromString(settings.value(QStringLiteral("window_text_color")).toString()); - if (!color.isValid()) - color = QGuiApplication::palette().color(QPalette::Active,QPalette::WindowText); - ui->windowTextColorLabel->setColor(color, true); - - color = QColor::fromString(settings.value(QStringLiteral("text_color")).toString()); - if (!color.isValid()) - color = QGuiApplication::palette().color(QPalette::Active,QPalette::Text); - ui->viewTextColorLabel->setColor(color, true); - - color = QColor::fromString(settings.value(QStringLiteral("highlighted_text_color")).toString()); - if (!color.isValid()) - color = QGuiApplication::palette().color(QPalette::Active,QPalette::HighlightedText); - ui->highlightedTextColorLabel->setColor(color, true); - - color = QColor::fromString(settings.value(QStringLiteral("link_color")).toString()); - if (!color.isValid()) - color = QGuiApplication::palette().color(QPalette::Active,QPalette::Link); - ui->linkColorLabel->setColor(color, true); - - color = QColor::fromString(settings.value(QStringLiteral("link_visited_color")).toString()); - if (!color.isValid()) - color = QGuiApplication::palette().color(QPalette::Active,QPalette::LinkVisited); - ui->linkVisitedColorLabel->setColor(color, true); - - // tooltips use the Inactive color group - color = QColor::fromString(settings.value(QStringLiteral("tooltip_base_color")).toString()); - if (!color.isValid()) - color = QGuiApplication::palette().color(QPalette::Inactive,QPalette::ToolTipBase); - ui->tooltipColorLabel->setColor(color, true); - - color = QColor::fromString(settings.value(QStringLiteral("tooltip_text_color")).toString()); - if (!color.isValid()) - color = QGuiApplication::palette().color(QPalette::Inactive,QPalette::ToolTipText); - ui->tooltipTextColorLabel->setColor(color, true); - - settings.endGroup(); + settings.endGroup(); + } } diff '--color=auto' -Nur a/lxqt-config-appearance/styleconfig.h b/lxqt-config-appearance/styleconfig.h --- a/lxqt-config-appearance/styleconfig.h 2024-11-05 05:22:05.000000000 +0000 +++ b/lxqt-config-appearance/styleconfig.h 2024-11-08 18:39:06.791390985 +0000 @@ -47,7 +47,6 @@ ~StyleConfig(); void applyStyle(); - void loadPaletteFile(const QString& paletteFile); public slots: void initControls(); diff '--color=auto' -Nur a/lxqt-config-appearance/styleconfig.ui b/lxqt-config-appearance/styleconfig.ui --- a/lxqt-config-appearance/styleconfig.ui 2024-11-05 05:22:05.000000000 +0000 +++ b/lxqt-config-appearance/styleconfig.ui 2024-11-08 18:39:06.791390985 +0000 @@ -127,28 +127,28 @@ - + - Tooltip: + Link: - - - - - + - + - Link: + Tooltip: - + + + + + @@ -191,28 +191,28 @@ - + - Tooltip Text: + Visited Link: - - - - - + - + - Visited Link: + Tooltip Text: - + + + + +