From 754b3d3cd4d3765cb778596031e161d5e3aad691 Mon Sep 17 00:00:00 2001 From: delia Date: Thu, 28 Aug 2025 18:30:59 +0200 Subject: [PATCH] Added scaling setting --- src/Qt/UIWindow.cpp | 4 +++- src/Qt/WallpaperSettingsWidget.cpp | 33 ++++++++++++++++++++++++------ src/main.cpp | 1 - 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/Qt/UIWindow.cpp b/src/Qt/UIWindow.cpp index 4c7c7b7..c23ae27 100644 --- a/src/Qt/UIWindow.cpp +++ b/src/Qt/UIWindow.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -31,11 +30,13 @@ #include #include #include +#include #include #include #include #include "Qt/WallpaperSettingsWidget.h" #include "WallpaperButton.h" +#include "WallpaperEngine/Logging/CLog.h" #define PICTURE_SIZE 128 @@ -217,6 +218,7 @@ void UIWindow::startNewWallpaperEngine() { if (!wallpaperEngine->waitForFinished(3000)) { wallpaperEngine->kill(); wallpaperEngine->waitForFinished(); + } } // delete this->wallpaperEngine; diff --git a/src/Qt/WallpaperSettingsWidget.cpp b/src/Qt/WallpaperSettingsWidget.cpp index 8d5670c..fa6c3e4 100644 --- a/src/Qt/WallpaperSettingsWidget.cpp +++ b/src/Qt/WallpaperSettingsWidget.cpp @@ -1,9 +1,10 @@ #include "WallpaperSettingsWidget.h" +#include "WallpaperEngine/Logging/CLog.h" #include -#include #include #include #include +#include #include #include #include @@ -18,10 +19,8 @@ #include #include #include +#include #include -#include -#include "WallpaperEngine/Assets/CCombinedContainer.h" -#include "WallpaperEngine/Logging/CLog.h" WallpaperSettingsWidget::WallpaperSettingsWidget(QWidget* parent) : QWidget(parent) { @@ -121,14 +120,24 @@ void WallpaperSettingsWidget::updateSettings(const std::string& wallpaperPath, c } } */ + auto * scalingBox = new QComboBox(); + scalingBox->addItems({"stretch", "fit", "fill", "default"}); + scalingBox->setView(new QListView()); + scalingBox->view()->setStyleSheet( + "QListView { background-color:#2B2A33; selection-background-color:#4488FF; color:white; }" + "QListView::item:hover { background-color:#4488FF; }" + ); + + auto* clampingBox = new QComboBox(); + // clampingBox->addItems({"clamp", "border", "repeat"}); 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}); this->currentOptions.push_back({createStyledCheckBox(this->checkboxStyleSheet), "Disable Audio Reaction:", "disable_audio_reaction", "--no-audio-processing", false, false}); this->currentOptions.push_back({new QLineEdit(), "FPS:", "fps", "--fps", true, 30}); - this->currentOptions.push_back({new QComboBox(), "Scaling:", "scaling", "--scaling", true}); - this->currentOptions.push_back({new QComboBox(), "Clamping:", "clamping", "--clamping", true}); + this->currentOptions.push_back({scalingBox, "Scaling:", "scaling", "--scaling", true, "default"}); + this->currentOptions.push_back({clampingBox, "Clamping:", "clamping", "--clamping", true, ""}); this->currentOptions.push_back({createStyledCheckBox(this->checkboxStyleSheet), "Disable Mouse:", "diable_mouse", "--disable-mouse", false, false}); this->currentOptions.push_back({createStyledCheckBox(this->checkboxStyleSheet), "Disable Parallax", "disable_parallax", "--disable-parallax", false, true}); this->currentOptions.push_back({createStyledCheckBox(this->checkboxStyleSheet), "Disable Fullscreen Pause:", "disable_fullscreen_pause", "--no-fullscreen-pause", true, false}); @@ -154,6 +163,12 @@ void WallpaperSettingsWidget::updateSettings(const std::string& wallpaperPath, c } continue; } + if (auto* comboBox = dynamic_cast(opt.widget)) { + if (std::holds_alternative(opt.defaultValue)) { + comboBox->setCurrentText(std::get(opt.defaultValue)); + } + continue; + } } } @@ -196,6 +211,12 @@ void WallpaperSettingsWidget::apply() { if (opt.flagHasValue) flags.append(value + " "); continue; } + if (auto* comboBox = dynamic_cast(opt.widget)) { + QString value = comboBox->currentText(); + flags.append(opt.flag + " "); + if (opt.flagHasValue) flags.append(value.toStdString() + " "); + continue; + } } emit applySettings(flags); } diff --git a/src/main.cpp b/src/main.cpp index 29f48ac..5747ed4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,7 +16,6 @@ #include "WallpaperEngine/Application/CApplicationContext.h" #include "WallpaperEngine/Application/CWallpaperApplication.h" #include "WallpaperEngine/Logging/CLog.h" -#include "WallpaperEngine/WebBrowser/CWebBrowserContext.h" WallpaperEngine::Application::CWallpaperApplication* appPointer; QCoreApplication* globalApp = nullptr;