From 8ddc02649be1c179604e9d0010686653b79762a0 Mon Sep 17 00:00:00 2001 From: delia Date: Thu, 28 Aug 2025 16:59:58 +0200 Subject: [PATCH] emmit applySettings at WallpaperSettingsWidget::update() --- src/Qt/UIWindow.cpp | 8 +++++--- src/Qt/UIWindow.h | 3 +++ src/Qt/WallpaperButton.cpp | 1 - src/Qt/WallpaperSettingsWidget.cpp | 23 ++++++++++++++++++++++- src/Qt/WallpaperSettingsWidget.h | 2 +- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/Qt/UIWindow.cpp b/src/Qt/UIWindow.cpp index 499249a..4c7c7b7 100644 --- a/src/Qt/UIWindow.cpp +++ b/src/Qt/UIWindow.cpp @@ -50,7 +50,7 @@ UIWindow::UIWindow(QWidget* parent, QApplication* qapp, SingleInstanceManager* i } void UIWindow::setupUIWindow(std::vector wallpaperPaths) { - this->setWindowTitle("Wallpapers :3"); + this->setWindowTitle("Linux-WallpaperEngine"); this->setStyleSheet(R"( QWidget { @@ -76,8 +76,9 @@ void UIWindow::setupUIWindow(std::vector wallpaperPaths) { button->setEnabled(false); this->selectedWallpapers[this->screenSelector->currentText().toStdString()] = clickedPath.toStdString(); - - startNewWallpaperEngine(); + + // startNewWallpaperEngine(); + // Doesn't need to start a new WallpaperEngine here since update wallpaperSettings does emit applySettings() updateSelectedButton(); this->wallpaperSettingsWidget->update(this->selectedWallpapers[this->screenSelector->currentText().toStdString()]); }); @@ -218,6 +219,7 @@ void UIWindow::startNewWallpaperEngine() { wallpaperEngine->waitForFinished(); } } + // delete this->wallpaperEngine; // create args QStringList args; diff --git a/src/Qt/UIWindow.h b/src/Qt/UIWindow.h index 8a966c3..19037be 100644 --- a/src/Qt/UIWindow.h +++ b/src/Qt/UIWindow.h @@ -1,7 +1,10 @@ #pragma once #include "Qt/SingleInstanceManager.h" +#include +#include #include +#include #include #include #include diff --git a/src/Qt/WallpaperButton.cpp b/src/Qt/WallpaperButton.cpp index 44426d4..a11a0bf 100644 --- a/src/Qt/WallpaperButton.cpp +++ b/src/Qt/WallpaperButton.cpp @@ -61,5 +61,4 @@ void WallpaperButton::resizeEvent(QResizeEvent* event) { QToolButton::resizeEvent(event); int size = std::min(event->size().width(), event->size().height()) * 0.8f; setIconSize(QSize(size, size)); - } diff --git a/src/Qt/WallpaperSettingsWidget.cpp b/src/Qt/WallpaperSettingsWidget.cpp index cea8040..8d5670c 100644 --- a/src/Qt/WallpaperSettingsWidget.cpp +++ b/src/Qt/WallpaperSettingsWidget.cpp @@ -1,5 +1,6 @@ #include "WallpaperSettingsWidget.h" #include +#include #include #include #include @@ -19,6 +20,8 @@ #include #include #include +#include "WallpaperEngine/Assets/CCombinedContainer.h" +#include "WallpaperEngine/Logging/CLog.h" WallpaperSettingsWidget::WallpaperSettingsWidget(QWidget* parent) : QWidget(parent) { @@ -91,7 +94,10 @@ void WallpaperSettingsWidget::update(const std::string& selected) { // edit Title preview.title->setText(QString::fromStdString(title)); + file.close(); + updateSettings(selected, wallpaperJSON); + apply(); } QCheckBox* createStyledCheckBox(const QString& style) { @@ -104,7 +110,18 @@ void WallpaperSettingsWidget::updateSettings(const std::string& wallpaperPath, c clearSettings(); // TODO: add individual settings depending on wallpaper - + /* + auto general = wallpaper.find("general"); + if (general != wallpaper.end()) { + if (general->find("properties") != general->end()) { + const auto properties = general->at("properties"); + if (properties != nullptr) { + sLog.out(properties); + } + } + } + */ + this->currentOptions.push_back({createStyledCheckBox(this->checkboxStyleSheet), "Mute Audio:", "mute_audio", "--silent", false, false}); this->currentOptions.push_back({new QSlider(Qt::Horizontal), "Volume:", "volume", "--volume", true, 50}); this->currentOptions.push_back({createStyledCheckBox(this->checkboxStyleSheet), "Disable Automute:", "disable_automute", "--noautomute", false, false}); @@ -146,8 +163,12 @@ void WallpaperSettingsWidget::clearSettings() { if (item->widget()) { delete item->widget(); } + if (item->layout()) { + delete item->layout(); + } delete item; } + this->currentOptions.clear(); } diff --git a/src/Qt/WallpaperSettingsWidget.h b/src/Qt/WallpaperSettingsWidget.h index 8571692..f4715b0 100644 --- a/src/Qt/WallpaperSettingsWidget.h +++ b/src/Qt/WallpaperSettingsWidget.h @@ -58,7 +58,7 @@ class WallpaperSettingsWidget : public QWidget { " border: 1px solid gray;" "}" "QCheckBox::indicator:checked {" - " background-color: #4CAF50;" + " background-color:#4488FF;" "}"; signals: