mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
parent
c9dfd9ab6c
commit
389a6991db
@ -1,6 +1,4 @@
|
||||
import QtQuick 2.12
|
||||
import ScreenPlay 1.0
|
||||
import ScreenPlay.Enums.InstalledType 1.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@ -12,48 +10,31 @@ Item {
|
||||
property string sourceImage
|
||||
property string sourceImageGIF
|
||||
property var type: InstalledType.Unknown
|
||||
onTypeChanged: {
|
||||
if (root.sourceImage === "" && root.sourceImageGIF === "") {
|
||||
image.source = "qrc:/assets/images/missingPreview.png"
|
||||
return
|
||||
}
|
||||
|
||||
if (root.type === InstalledType.GifWallpaper) {
|
||||
image.source = Qt.resolvedUrl(
|
||||
absoluteStoragePath + "/" + root.sourceImageGIF)
|
||||
print(image.source)
|
||||
} else {
|
||||
if (root.sourceImage !== "") {
|
||||
image.source = Qt.resolvedUrl(
|
||||
absoluteStoragePath + "/" + root.sourceImage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function enter() {
|
||||
if (root.type !== InstalledType.GifWallpaper) {
|
||||
if (root.sourceImageGIF !== "")
|
||||
image.source = Qt.resolvedUrl(
|
||||
absoluteStoragePath + "/" + root.sourceImageGIF)
|
||||
if (root.sourceImageGIF != "") {
|
||||
loader_imgGIFPreview.sourceComponent = component_imgGIFPreview
|
||||
}
|
||||
image.playing = true
|
||||
}
|
||||
|
||||
function exit() {
|
||||
image.playing = false
|
||||
if (root.type !== InstalledType.GifWallpaper) {
|
||||
image.source = Qt.resolvedUrl(
|
||||
absoluteStoragePath + "/" + root.sourceImage)
|
||||
}
|
||||
root.state = "loaded"
|
||||
loader_imgGIFPreview.sourceComponent = null
|
||||
}
|
||||
|
||||
AnimatedImage {
|
||||
Image {
|
||||
id: image
|
||||
anchors.fill: parent
|
||||
asynchronous: true
|
||||
cache: true
|
||||
playing: false
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
source: {
|
||||
if (root.sourceImage === "")
|
||||
return "qrc:/assets/images/missingPreview.png"
|
||||
|
||||
return root.screenPreview === "" ? "qrc:/assets/images/missingPreview.png" : Qt.resolvedUrl(
|
||||
absoluteStoragePath + "/" + root.sourceImage)
|
||||
}
|
||||
|
||||
onStatusChanged: {
|
||||
if (image.status === Image.Ready) {
|
||||
@ -64,4 +45,62 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: component_imgGIFPreview
|
||||
AnimatedImage {
|
||||
id: imgGIFPreview
|
||||
asynchronous: true
|
||||
playing: true
|
||||
source: root.sourceImageGIF
|
||||
=== "" ? "qrc:/assets/images/missingPreview.png" : Qt.resolvedUrl(
|
||||
absoluteStoragePath + "/" + root.sourceImageGIF)
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
}
|
||||
}
|
||||
Loader {
|
||||
id: loader_imgGIFPreview
|
||||
anchors.fill: parent
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
from: "loading"
|
||||
to: "loaded"
|
||||
|
||||
OpacityAnimator {
|
||||
target: image
|
||||
duration: 300
|
||||
from: 0
|
||||
to: 1
|
||||
easing.type: Easing.OutQuart
|
||||
}
|
||||
},
|
||||
Transition {
|
||||
from: "hover"
|
||||
to: "loaded"
|
||||
|
||||
OpacityAnimator {
|
||||
target: loader_imgGIFPreview
|
||||
duration: 300
|
||||
from: 1
|
||||
to: 0
|
||||
easing.type: Easing.OutQuart
|
||||
}
|
||||
},
|
||||
Transition {
|
||||
from: "loaded"
|
||||
to: "hover"
|
||||
reversible: true
|
||||
|
||||
OpacityAnimator {
|
||||
target: loader_imgGIFPreview
|
||||
duration: 400
|
||||
from: 0
|
||||
to: 1
|
||||
easing.type: Easing.OutQuart
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user