wallpapers/image: force reload wallpaper after target size changes

When the target size changes while the provider type is single image
or the current wallpaper is animated, the frontend is required to force
update the wallpaper.
wilder-5.26
Fushan Wen 4 years ago
parent 523936395d
commit 2339ea9bb6
No known key found for this signature in database
GPG Key ID: 2E48D1487C91DCAA
  1. 1
      wallpapers/image/imagepackage/contents/ui/main.qml
  2. 5
      wallpapers/image/plugin/utils/mediaproxy.cpp
  3. 7
      wallpapers/image/plugin/utils/mediaproxy.h

@ -89,6 +89,7 @@ QQC2.StackView {
}
targetSize: root.sourceSize
onActualSizeChanged: Qt.callLater(loadImage);
onColorSchemeChanged: loadImageImmediately();
}

@ -91,8 +91,13 @@ void MediaProxy::setTargetSize(const QSize &size)
Q_EMIT targetSizeChanged(size);
if (m_providerType == Provider::Type::Package) {
determineBackgroundType(); // In case file format changes after size changes
updateModelImage();
}
if (m_providerType == Provider::Type::Image || m_backgroundType == BackgroundType::Type::AnimatedImage) {
// When KPackage contains animated wallpapers, image provider is not used.
Q_EMIT actualSizeChanged();
}
}
Provider::Type MediaProxy::providerType() const

@ -77,6 +77,13 @@ Q_SIGNALS:
void targetSizeChanged(const QSize &size);
/**
* Emitted when the target size changes while the provider type is single image
* or the current wallpaper is animated.
* The frontend is required to force update the wallpaper.
*/
void actualSizeChanged();
/**
* Emitted when system color scheme changes. The frontend is required to
* reload the wallpaper even if the image path is not changed.

Loading…
Cancel
Save