mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 11:32:42 +01:00
parent
c9dfd9ab6c
commit
389a6991db
@ -1,6 +1,4 @@
|
|||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import ScreenPlay 1.0
|
|
||||||
import ScreenPlay.Enums.InstalledType 1.0
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@ -12,48 +10,31 @@ Item {
|
|||||||
property string sourceImage
|
property string sourceImage
|
||||||
property string sourceImageGIF
|
property string sourceImageGIF
|
||||||
property var type: InstalledType.Unknown
|
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() {
|
function enter() {
|
||||||
if (root.type !== InstalledType.GifWallpaper) {
|
if (root.sourceImageGIF != "") {
|
||||||
if (root.sourceImageGIF !== "")
|
loader_imgGIFPreview.sourceComponent = component_imgGIFPreview
|
||||||
image.source = Qt.resolvedUrl(
|
|
||||||
absoluteStoragePath + "/" + root.sourceImageGIF)
|
|
||||||
}
|
}
|
||||||
image.playing = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function exit() {
|
function exit() {
|
||||||
image.playing = false
|
root.state = "loaded"
|
||||||
if (root.type !== InstalledType.GifWallpaper) {
|
loader_imgGIFPreview.sourceComponent = null
|
||||||
image.source = Qt.resolvedUrl(
|
|
||||||
absoluteStoragePath + "/" + root.sourceImage)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimatedImage {
|
Image {
|
||||||
id: image
|
id: image
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
cache: true
|
cache: true
|
||||||
playing: false
|
|
||||||
fillMode: Image.PreserveAspectCrop
|
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: {
|
onStatusChanged: {
|
||||||
if (image.status === Image.Ready) {
|
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