mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-22 10:42:29 +01:00
bb700780ef
Move common qml stuff into ScreenPlayUtil
64 lines
1.3 KiB
QML
64 lines
1.3 KiB
QML
import QtQuick
|
|
|
|
Item {
|
|
id: screenPlayItemImage
|
|
|
|
property string sourceImage
|
|
property string sourceImageGIF
|
|
|
|
width: 320
|
|
height: 121
|
|
state: "loading"
|
|
|
|
Image {
|
|
id: image
|
|
|
|
anchors.fill: parent
|
|
fillMode: Image.PreserveAspectCrop
|
|
source: screenPlayItemImage.sourceImage.trim()
|
|
onStatusChanged: {
|
|
if (image.status === Image.Ready) {
|
|
screenPlayItemImage.state = "loaded";
|
|
} else if (image.status === Image.Error) {
|
|
source = "images/missingPreview.png";
|
|
screenPlayItemImage.state = "loaded";
|
|
}
|
|
}
|
|
}
|
|
|
|
states: [
|
|
State {
|
|
name: "loading"
|
|
|
|
PropertyChanges {
|
|
target: image
|
|
opacity: 0
|
|
}
|
|
|
|
},
|
|
State {
|
|
name: "loaded"
|
|
|
|
PropertyChanges {
|
|
target: image
|
|
opacity: 1
|
|
}
|
|
|
|
}
|
|
]
|
|
transitions: [
|
|
Transition {
|
|
from: "loading"
|
|
to: "loaded"
|
|
|
|
NumberAnimation {
|
|
target: image
|
|
property: "opacity"
|
|
duration: 300
|
|
easing.type: Easing.InOutQuad
|
|
}
|
|
|
|
}
|
|
]
|
|
}
|