Verified Commit 4a95a33b authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

wallpapers/image: instantly apply wallpaper on color scheme changed

CCBUG: 207976
parent ba73809a
Pipeline #190631 passed with stage
in 9 minutes and 27 seconds
......@@ -90,7 +90,7 @@ QQC2.StackView {
}
targetSize: root.sourceSize
onColorSchemeChanged: Qt.callLater(loadImage);
onColorSchemeChanged: loadImageImmediately();
}
onFillModeChanged: Qt.callLater(loadImage);
......@@ -98,19 +98,23 @@ QQC2.StackView {
onConfigColorChanged: Qt.callLater(loadImage);
onBlurChanged: Qt.callLater(loadImage);
function loadImage() {
var isFirst = (root.currentItem == undefined);
function loadImageImmediately() {
loadImage(true);
}
function loadImage(skipAnimation) {
const _skipAnimation = root.currentItem == undefined || !!skipAnimation;
var pendingImage = baseImage.createObject(root, { "source": root.modelImage,
"fillMode": root.fillMode,
"sourceSize": root.sourceSize,
"color": root.configColor,
"blur": root.blur,
"opacity": isFirst ? 1: 0});
"opacity": _skipAnimation ? 1: 0});
function replaceWhenLoaded() {
if (pendingImage.status !== Image.Loading) {
root.replace(pendingImage, {},
isFirst ? QQC2.StackView.Immediate : QQC2.StackView.Transition);//dont' animate first show
_skipAnimation ? QQC2.StackView.Immediate : QQC2.StackView.Transition);
pendingImage.statusChanged.disconnect(replaceWhenLoaded);
wallpaper.loading = false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment