blob: 78624d5e14ad4afe3401d3a9fd2a912acf4e9667 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
pragma ComponentBehavior: Bound
import "root:/widgets"
import "root:/services"
import "root:/config"
import QtQuick
Item {
id: root
property url source: Wallpapers.current ? `file://${Wallpapers.current}` : ""
property Image current: one
anchors.fill: parent
onSourceChanged: {
if (current === one)
two.update();
else
one.update();
}
Img {
id: one
}
Img {
id: two
}
component Img: CachingImage {
id: img
function update(): void {
const srcPath = `${root.source}`.slice(7);
if (thumbnail.originalPath === srcPath) {
root.current = this;
} else
path = srcPath;
}
anchors.fill: parent
asynchronous: true
cache: false
fillMode: Image.PreserveAspectCrop
opacity: 0
scale: Wallpapers.showPreview ? 1 : 0.8
onStatusChanged: {
if (status === Image.Ready)
root.current = this;
}
states: State {
name: "visible"
when: root.current === img
PropertyChanges {
img.opacity: 1
img.scale: 1
}
}
transitions: Transition {
from: "*"
to: "*"
NumberAnimation {
target: img
properties: "opacity,scale"
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.standard
}
}
}
}
|