From 9f40afbd1495dc5dfc219c83203f66c23e067372 Mon Sep 17 00:00:00 2001 From: liudun Date: Wed, 6 Mar 2024 11:04:09 +0800 Subject: [PATCH] fix(screensaver plugin): Lock screen wallpaper switching, screensaver will not switch automatically MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: Lock screen wallpaper switching, screensaver will not switch automatically Log: 锁屏壁纸切换,屏保不会自动切换 Bug: bug#I8J6U1ukui屏保自动切换 --- src/screensaver/scconfiguration.cpp | 3 +++ src/screensaver/scconfiguration.h | 1 + src/screensaver/screensaver.cpp | 9 ++++++++- src/screensaver/screensaver.h | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/screensaver/scconfiguration.cpp b/src/screensaver/scconfiguration.cpp index d743ad4..3876f6a 100644 --- a/src/screensaver/scconfiguration.cpp +++ b/src/screensaver/scconfiguration.cpp @@ -66,6 +66,9 @@ void SCConfiguration::onConfigurationChanged(QString key, QVariant value) }else if(key == "backgroundPath"){ QString path = value.toString(); Q_EMIT backgroundPathChanged(path); + }else if(key == "background"){ + QString path = value.toString(); + Q_EMIT backgroundChanged(path); }else if(key == "mytext"){ QString text = value.toString(); Q_EMIT myTextChanged(text); diff --git a/src/screensaver/scconfiguration.h b/src/screensaver/scconfiguration.h index 04b2ba8..2c188a3 100644 --- a/src/screensaver/scconfiguration.h +++ b/src/screensaver/scconfiguration.h @@ -68,6 +68,7 @@ Q_SIGNALS: void cycleTimeChanged(int cycleTime); bool autoSwitchChanged(bool changed); QString backgroundPathChanged(QString path); + QString backgroundChanged(QString path); QString myTextChanged(QString text); bool showCRestTimeChanged(bool isShow); bool showURestTimeChanged(bool isShow); diff --git a/src/screensaver/screensaver.cpp b/src/screensaver/screensaver.cpp index 4245fbb..f844f84 100644 --- a/src/screensaver/screensaver.cpp +++ b/src/screensaver/screensaver.cpp @@ -151,7 +151,7 @@ void Screensaver::getConfiguration() textIsCenter = configuration->getTextIsCenter(); myText = configuration->getMyText(); }else - isUShowRestTime = configuration->getUShowRestTime(); + isUShowRestTime = configuration->getUShowRestTime(); curFontSize = configuration->getFontSize(); m_ptToPx = configuration->getPtToPx(); @@ -168,6 +168,8 @@ void Screensaver::connectSingles() this, &Screensaver::autoSwitchChanged); connect(configuration, &SCConfiguration::backgroundPathChanged, this, &Screensaver::backgroundPathChanged); + connect(configuration, &SCConfiguration::backgroundChanged, + this, &Screensaver::backgroundChanged); connect(configuration, &SCConfiguration::cycleTimeChanged, this, &Screensaver::cycleTimeChanged); connect(configuration, &SCConfiguration::myTextChanged, @@ -254,6 +256,11 @@ void Screensaver::backgroundPathChanged(QString path) startSwitchImages(); } +void Screensaver::backgroundChanged(QString path) +{ + background = loadFromFile(path); +} + void Screensaver::cycleTimeChanged(int cTime) { cycleTime = cTime; diff --git a/src/screensaver/screensaver.h b/src/screensaver/screensaver.h index 2772316..4c83c86 100644 --- a/src/screensaver/screensaver.h +++ b/src/screensaver/screensaver.h @@ -194,6 +194,7 @@ private Q_SLOTS: void updateTime(); void autoSwitchChanged(bool iswitch); void backgroundPathChanged(QString path); + void backgroundChanged(QString path); void cycleTimeChanged(int cTime); void myTextChanged(QString text); void showCRestTimeChanged(bool isShow);