mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
emmit applySettings at WallpaperSettingsWidget::update()
This commit is contained in:
parent
f078765987
commit
8ddc02649b
@ -50,7 +50,7 @@ UIWindow::UIWindow(QWidget* parent, QApplication* qapp, SingleInstanceManager* i
|
||||
}
|
||||
|
||||
void UIWindow::setupUIWindow(std::vector<std::string> wallpaperPaths) {
|
||||
this->setWindowTitle("Wallpapers :3");
|
||||
this->setWindowTitle("Linux-WallpaperEngine");
|
||||
|
||||
this->setStyleSheet(R"(
|
||||
QWidget {
|
||||
@ -77,7 +77,8 @@ void UIWindow::setupUIWindow(std::vector<std::string> wallpaperPaths) {
|
||||
|
||||
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;
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "Qt/SingleInstanceManager.h"
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
#include <new>
|
||||
#include <qapplication.h>
|
||||
#include <qboxlayout.h>
|
||||
#include <qcombobox.h>
|
||||
|
@ -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));
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "WallpaperSettingsWidget.h"
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
#include <qchar.h>
|
||||
#include <qcheckbox.h>
|
||||
@ -19,6 +20,8 @@
|
||||
#include <QComboBox>
|
||||
#include <variant>
|
||||
#include <iostream>
|
||||
#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,6 +110,17 @@ 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});
|
||||
@ -146,8 +163,12 @@ void WallpaperSettingsWidget::clearSettings() {
|
||||
if (item->widget()) {
|
||||
delete item->widget();
|
||||
}
|
||||
if (item->layout()) {
|
||||
delete item->layout();
|
||||
}
|
||||
delete item;
|
||||
}
|
||||
|
||||
this->currentOptions.clear();
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ class WallpaperSettingsWidget : public QWidget {
|
||||
" border: 1px solid gray;"
|
||||
"}"
|
||||
"QCheckBox::indicator:checked {"
|
||||
" background-color: #4CAF50;"
|
||||
" background-color:#4488FF;"
|
||||
"}";
|
||||
|
||||
signals:
|
||||
|
Loading…
Reference in New Issue
Block a user