Wallpaper: Add preload image

pull/11/head
cutefishd 5 years ago
parent bb841dee9c
commit 69c2e62341

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Capa_1"
x="0px"
y="0px"
viewBox="0 0 31.999999 31.999999"
xml:space="preserve"
sodipodi:docname="picture.svg"
width="32"
height="32"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"><metadata
id="metadata49"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
id="defs47" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2160"
inkscape:window-height="1247"
id="namedview45"
showgrid="false"
inkscape:zoom="21.814206"
inkscape:cx="27.689109"
inkscape:cy="12.355181"
inkscape:window-x="0"
inkscape:window-y="35"
inkscape:window-maximized="1"
inkscape:current-layer="Capa_1"
inkscape:document-rotation="0" />
<g
id="g6"
transform="matrix(0.07665494,0,0,0.07665494,1.3895684,1.3895684)"
style="fill-opacity:1;fill:#ffffff">
<g
id="g4"
style="fill-opacity:1;fill:#ffffff">
<path
d="M 345.6,20.2 H 35.6 C 16,20.2 0,36.2 0,55.8 v 194 75.6 C 0,345 16,361 35.6,361 h 310 c 19.6,0 35.6,-16 35.6,-35.6 V 55.8 c 0,-19.6 -16,-35.6 -35.6,-35.6 z m 17.6,305.2 c 0,9.6 -8,17.6 -18,17.6 H 35.6 c -10,0 -18,-8 -18,-18 V 253 L 118,150.6 208.8,255 c 3.2,3.6 8,4 12,1.6 l 73.6,-52 68.8,49.6 z m 0.4,-92.8 -64,-46 c -3.2,-2.4 -7.2,-2.4 -10.4,0 l -72,51.2 -92,-105.6 c -1.6,-2 -4,-2.8 -6.4,-3.2 -2.4,0 -4.8,0.8 -6.8,2.8 l -94.4,96 v -172 c 0,-9.6 8,-17.6 18,-17.6 h 310 c 10,0 18,8 18,18 z"
id="path2"
style="fill-opacity:1;fill:#ffffff" />
</g>
</g><g
id="g12"
transform="matrix(0.07665494,0,0,0.07665494,1.3895684,1.3895684)"
style="fill:#ffffff;fill-opacity:1">
<g
id="g10"
style="fill:#ffffff;fill-opacity:1">
<path
d="m 244.8,73.4 c -25.6,0 -46,20.8 -46,46 -0.4,25.2 20.4,46 46,46 25.6,0 46,-20.8 46,-46 0,-25.6 -20.8,-46 -46,-46 z m 0,74.4 c -15.6,0 -28.4,-12.8 -28.4,-28.4 0,-16 12.8,-28.4 28.4,-28.4 15.6,0 28.4,12.8 28.4,28.4 0,15.6 -12.8,28.4 -28.4,28.4 z"
id="path8"
style="fill:#ffffff;fill-opacity:1" />
</g>
</g>
<g
id="g14">
</g>
<g
id="g16">
</g>
<g
id="g18">
</g>
<g
id="g20">
</g>
<g
id="g22">
</g>
<g
id="g24">
</g>
<g
id="g26">
</g>
<g
id="g28">
</g>
<g
id="g30">
</g>
<g
id="g32">
</g>
<g
id="g34">
</g>
<g
id="g36">
</g>
<g
id="g38">
</g>
<g
id="g40">
</g>
<g
id="g42">
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Capa_1"
x="0px"
y="0px"
viewBox="0 0 31.999999 31.999999"
xml:space="preserve"
sodipodi:docname="picture.svg"
width="32"
height="32"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"><metadata
id="metadata49"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs47"><linearGradient
inkscape:collect="always"
id="linearGradient892"><stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop888" /><stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop890" /></linearGradient><linearGradient
inkscape:collect="always"
xlink:href="#linearGradient892"
id="linearGradient894"
x1="0"
y1="190.6"
x2="381.2"
y2="190.6"
gradientUnits="userSpaceOnUse" /></defs><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2160"
inkscape:window-height="1247"
id="namedview45"
showgrid="false"
inkscape:zoom="21.814206"
inkscape:cx="27.689109"
inkscape:cy="12.355181"
inkscape:window-x="0"
inkscape:window-y="35"
inkscape:window-maximized="1"
inkscape:current-layer="Capa_1" />
<g
id="g6"
transform="matrix(0.07665494,0,0,0.07665494,1.3895684,1.3895684)"
style="fill-opacity:1;fill:#c8cad5">
<g
id="g4"
style="fill-opacity:1;fill:#c8cad5">
<path
d="M 345.6,20.2 H 35.6 C 16,20.2 0,36.2 0,55.8 v 194 75.6 C 0,345 16,361 35.6,361 h 310 c 19.6,0 35.6,-16 35.6,-35.6 V 55.8 c 0,-19.6 -16,-35.6 -35.6,-35.6 z m 17.6,305.2 c 0,9.6 -8,17.6 -18,17.6 H 35.6 c -10,0 -18,-8 -18,-18 V 253 L 118,150.6 208.8,255 c 3.2,3.6 8,4 12,1.6 l 73.6,-52 68.8,49.6 z m 0.4,-92.8 -64,-46 c -3.2,-2.4 -7.2,-2.4 -10.4,0 l -72,51.2 -92,-105.6 c -1.6,-2 -4,-2.8 -6.4,-3.2 -2.4,0 -4.8,0.8 -6.8,2.8 l -94.4,96 v -172 c 0,-9.6 8,-17.6 18,-17.6 h 310 c 10,0 18,8 18,18 z"
id="path2"
style="fill-opacity:1;fill:#c8cad5" />
</g>
</g><g
id="g12"
transform="matrix(0.07665494,0,0,0.07665494,1.3895684,1.3895684)"
style="fill:#c8cad5;fill-opacity:1">
<g
id="g10"
style="fill:#c8cad5;fill-opacity:1">
<path
d="m 244.8,73.4 c -25.6,0 -46,20.8 -46,46 -0.4,25.2 20.4,46 46,46 25.6,0 46,-20.8 46,-46 0,-25.6 -20.8,-46 -46,-46 z m 0,74.4 c -15.6,0 -28.4,-12.8 -28.4,-28.4 0,-16 12.8,-28.4 28.4,-28.4 15.6,0 28.4,12.8 28.4,28.4 0,15.6 -12.8,28.4 -28.4,28.4 z"
id="path8"
style="fill:#c8cad5;fill-opacity:1" />
</g>
</g>
<g
id="g14">
</g>
<g
id="g16">
</g>
<g
id="g18">
</g>
<g
id="g20">
</g>
<g
id="g22">
</g>
<g
id="g24">
</g>
<g
id="g26">
</g>
<g
id="g28">
</g>
<g
id="g30">
</g>
<g
id="g32">
</g>
<g
id="g34">
</g>
<g
id="g36">
</g>
<g
id="g38">
</g>
<g
id="g40">
</g>
<g
id="g42">
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

@ -99,6 +99,17 @@ ItemPage {
}
}
// Preload image
Image {
anchors.centerIn: parent
width: 64
height: width
sourceSize: Qt.size(width, height)
source: FishUI.Theme.darkMode ? "qrc:/images/dark/picture.svg"
: "qrc:/images/light/picture.svg"
visible: _image.status !== Image.Ready
}
Rectangle {
anchors.fill: parent
anchors.margins: FishUI.Units.smallSpacing
@ -106,10 +117,10 @@ ItemPage {
radius: FishUI.Theme.bigRadius + FishUI.Units.smallSpacing / 2
border.color: FishUI.Theme.highlightColor
border.width: image.status == Image.Ready & isSelected ? 3 : 0
border.width: _image.status == Image.Ready & isSelected ? 3 : 0
Image {
id: image
id: _image
anchors.fill: parent
anchors.margins: FishUI.Units.smallSpacing
source: "file://" + modelData
@ -131,8 +142,8 @@ ItemPage {
layer.enabled: true
layer.effect: OpacityMask {
maskSource: Item {
width: image.width
height: image.height
width: _image.width
height: _image.height
Rectangle {
anchors.fill: parent
@ -152,10 +163,10 @@ ItemPage {
}
onEntered: function() {
image.opacity = 0.7
_image.opacity = 0.7
}
onExited: function() {
image.opacity = 1.0
_image.opacity = 1.0
}
onPressedChanged: item.scale = pressed ? 0.97 : 1.0

@ -90,5 +90,7 @@
<file>images/powersave.svg</file>
<file>images/performance.svg</file>
<file>qml/Power/main.qml</file>
<file>images/light/picture.svg</file>
<file>images/dark/picture.svg</file>
</qresource>
</RCC>

Loading…
Cancel
Save