harbour-tooter/qml/pages/components/MyImage.qml

93 lines
2.4 KiB
QML
Raw Normal View History

2017-06-16 17:45:04 +03:00
import QtQuick 2.0
import Sailfish.Silica 1.0
import QtMultimedia 5.0
2017-06-16 17:45:04 +03:00
Item {
id: myImage
2017-06-16 17:45:04 +03:00
property string type : ""
property string previewURL: ""
property string mediaURL: ""
2017-07-20 13:14:16 +03:00
Rectangle {
opacity: 0.2
color: Theme.highlightDimmerColor
anchors.fill: parent
2017-07-20 13:14:16 +03:00
}
2017-07-20 13:14:16 +03:00
Image {
source: "image://theme/icon-m-image"
anchors.centerIn: parent
2017-07-20 13:14:16 +03:00
}
2017-07-20 16:26:20 +03:00
Rectangle {
id: progressRec
width: 0
height: Theme.paddingSmall
color: Theme.highlightBackgroundColor
anchors.bottom: parent.bottom
2017-07-20 16:26:20 +03:00
}
2017-06-16 17:45:04 +03:00
Image {
id: img
2017-06-16 17:45:04 +03:00
asynchronous: true
opacity: status === Image.Ready ? 1.0 : 0.0
Behavior on opacity { FadeAnimator {} }
source: previewURL
fillMode: Image.PreserveAspectCrop
anchors.fill: parent
2017-07-20 16:26:20 +03:00
onProgressChanged: {
if (progress != 1)
progressRec.width = parent.width * progress
else {
progressRec.width = 0;
}
}
2017-06-16 17:45:04 +03:00
MouseArea {
anchors.fill: parent
onClicked: {
pageStack.push(Qt.resolvedUrl("./MediaFullScreen.qml"), {
"previewURL": previewURL,
"mediaURL": mediaURL,
"type": type
})
2017-06-16 17:45:04 +03:00
}
}
Image {
id: videoIcon
visible: type === "video" || type === "gifv"
source: "image://theme/icon-l-play"
anchors.centerIn: parent
}
BusyIndicator {
id: mediaLoader
size: BusyIndicatorSize.Large
running: img.status !== Image.Ready
opacity: img.status === Image.Ready ? 0.0 : 1.0
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
}
Rectangle {
id: mediaWarning
color: Theme.highlightDimmerColor
visible: typeof status_sensitive != 'undefined' && status_sensitive ? true : false
anchors.fill: parent
Image {
source: "image://theme/icon-l-attention?"+Theme.highlightColor
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: parent.visible = false
}
}
2017-06-16 17:45:04 +03:00
}
}