Added scaling setting

This commit is contained in:
delia 2025-08-28 18:30:59 +02:00
parent 684aa47dbd
commit 754b3d3cd4
3 changed files with 30 additions and 8 deletions

View File

@ -5,7 +5,6 @@
#include <QtConcurrent/qtconcurrentrun.h> #include <QtConcurrent/qtconcurrentrun.h>
#include <X11/X.h> #include <X11/X.h>
#include <cstddef> #include <cstddef>
#include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <nlohmann/json_fwd.hpp> #include <nlohmann/json_fwd.hpp>
#include <qapplication.h> #include <qapplication.h>
@ -31,11 +30,13 @@
#include <QByteArray> #include <QByteArray>
#include <string> #include <string>
#include <strings.h> #include <strings.h>
#include <unistd.h>
#include <vector> #include <vector>
#include <QToolButton> #include <QToolButton>
#include <QGroupBox> #include <QGroupBox>
#include "Qt/WallpaperSettingsWidget.h" #include "Qt/WallpaperSettingsWidget.h"
#include "WallpaperButton.h" #include "WallpaperButton.h"
#include "WallpaperEngine/Logging/CLog.h"
#define PICTURE_SIZE 128 #define PICTURE_SIZE 128
@ -217,6 +218,7 @@ void UIWindow::startNewWallpaperEngine() {
if (!wallpaperEngine->waitForFinished(3000)) { if (!wallpaperEngine->waitForFinished(3000)) {
wallpaperEngine->kill(); wallpaperEngine->kill();
wallpaperEngine->waitForFinished(); wallpaperEngine->waitForFinished();
} }
} }
// delete this->wallpaperEngine; // delete this->wallpaperEngine;

View File

@ -1,9 +1,10 @@
#include "WallpaperSettingsWidget.h" #include "WallpaperSettingsWidget.h"
#include "WallpaperEngine/Logging/CLog.h"
#include <fstream> #include <fstream>
#include <memory>
#include <nlohmann/json_fwd.hpp> #include <nlohmann/json_fwd.hpp>
#include <qchar.h> #include <qchar.h>
#include <qcheckbox.h> #include <qcheckbox.h>
#include <qcombobox.h>
#include <qformlayout.h> #include <qformlayout.h>
#include <qgroupbox.h> #include <qgroupbox.h>
#include <qlineedit.h> #include <qlineedit.h>
@ -18,10 +19,8 @@
#include <QCheckBox> #include <QCheckBox>
#include <QLineEdit> #include <QLineEdit>
#include <QComboBox> #include <QComboBox>
#include <QListView>
#include <variant> #include <variant>
#include <iostream>
#include "WallpaperEngine/Assets/CCombinedContainer.h"
#include "WallpaperEngine/Logging/CLog.h"
WallpaperSettingsWidget::WallpaperSettingsWidget(QWidget* parent) WallpaperSettingsWidget::WallpaperSettingsWidget(QWidget* parent)
: 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({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({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 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({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 QLineEdit(), "FPS:", "fps", "--fps", true, 30});
this->currentOptions.push_back({new QComboBox(), "Scaling:", "scaling", "--scaling", true}); this->currentOptions.push_back({scalingBox, "Scaling:", "scaling", "--scaling", true, "default"});
this->currentOptions.push_back({new QComboBox(), "Clamping:", "clamping", "--clamping", true}); 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 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 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}); 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; continue;
} }
if (auto* comboBox = dynamic_cast<QComboBox*>(opt.widget)) {
if (std::holds_alternative<QString>(opt.defaultValue)) {
comboBox->setCurrentText(std::get<QString>(opt.defaultValue));
}
continue;
}
} }
} }
@ -196,6 +211,12 @@ void WallpaperSettingsWidget::apply() {
if (opt.flagHasValue) flags.append(value + " "); if (opt.flagHasValue) flags.append(value + " ");
continue; continue;
} }
if (auto* comboBox = dynamic_cast<QComboBox*>(opt.widget)) {
QString value = comboBox->currentText();
flags.append(opt.flag + " ");
if (opt.flagHasValue) flags.append(value.toStdString() + " ");
continue;
}
} }
emit applySettings(flags); emit applySettings(flags);
} }

View File

@ -16,7 +16,6 @@
#include "WallpaperEngine/Application/CApplicationContext.h" #include "WallpaperEngine/Application/CApplicationContext.h"
#include "WallpaperEngine/Application/CWallpaperApplication.h" #include "WallpaperEngine/Application/CWallpaperApplication.h"
#include "WallpaperEngine/Logging/CLog.h" #include "WallpaperEngine/Logging/CLog.h"
#include "WallpaperEngine/WebBrowser/CWebBrowserContext.h"
WallpaperEngine::Application::CWallpaperApplication* appPointer; WallpaperEngine::Application::CWallpaperApplication* appPointer;
QCoreApplication* globalApp = nullptr; QCoreApplication* globalApp = nullptr;