2017-06-16 17:45:04 +03:00
|
|
|
import QtQuick 2.0
|
|
|
|
import Sailfish.Silica 1.0
|
|
|
|
import QtMultimedia 5.0
|
|
|
|
|
2020-05-29 21:05:05 +03:00
|
|
|
|
2017-06-16 17:45:04 +03:00
|
|
|
Item {
|
2020-05-29 21:05:05 +03:00
|
|
|
id: myImage
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-16 17:45:04 +03:00
|
|
|
property string type : ""
|
|
|
|
property string previewURL: ""
|
|
|
|
property string mediaURL: ""
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-07-20 13:14:16 +03:00
|
|
|
Rectangle {
|
|
|
|
opacity: 0.2
|
|
|
|
color: Theme.highlightDimmerColor
|
2020-06-03 08:34:33 +03:00
|
|
|
anchors.fill: parent
|
2017-07-20 13:14:16 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-07-20 13:14:16 +03:00
|
|
|
Image {
|
|
|
|
source: "image://theme/icon-m-image"
|
2020-06-03 08:34:33 +03:00
|
|
|
anchors.centerIn: parent
|
2017-07-20 13:14:16 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-07-20 16:26:20 +03:00
|
|
|
Rectangle {
|
|
|
|
id: progressRec
|
|
|
|
width: 0
|
|
|
|
height: Theme.paddingSmall
|
|
|
|
color: Theme.highlightBackgroundColor
|
2020-06-03 08:34:33 +03:00
|
|
|
anchors.bottom: parent.bottom
|
2017-07-20 16:26:20 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-16 17:45:04 +03:00
|
|
|
Image {
|
2017-06-19 01:58:58 +03:00
|
|
|
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
|
2020-06-03 08:34:33 +03:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-16 17:45:04 +03:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
2020-06-03 08:34:33 +03:00
|
|
|
pageStack.push(Qt.resolvedUrl("./MediaFullScreen.qml"), {
|
|
|
|
"previewURL": previewURL,
|
|
|
|
"mediaURL": mediaURL,
|
|
|
|
"type": type
|
|
|
|
})
|
2017-06-16 17:45:04 +03:00
|
|
|
}
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-19 01:58:58 +03:00
|
|
|
Image {
|
2020-06-03 08:34:33 +03:00
|
|
|
id: videoIcon
|
2017-06-19 01:58:58 +03:00
|
|
|
visible: type === "video" || type === "gifv"
|
|
|
|
source: "image://theme/icon-l-play"
|
2020-06-03 08:34:33 +03:00
|
|
|
anchors.centerIn: parent
|
2017-06-19 01:58:58 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-19 01:58:58 +03:00
|
|
|
BusyIndicator {
|
2020-06-03 08:34:33 +03:00
|
|
|
id: mediaLoader
|
2017-06-19 01:58:58 +03:00
|
|
|
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
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-19 01:58:58 +03:00
|
|
|
Rectangle {
|
2020-06-03 08:34:33 +03:00
|
|
|
id: mediaWarning
|
2017-06-19 01:58:58 +03:00
|
|
|
color: Theme.highlightDimmerColor
|
2017-10-19 11:42:40 +03:00
|
|
|
visible: typeof status_sensitive != 'undefined' && status_sensitive ? true : false
|
2020-06-03 08:34:33 +03:00
|
|
|
anchors.fill: parent
|
|
|
|
|
2017-06-19 01:58:58 +03:00
|
|
|
Image {
|
|
|
|
source: "image://theme/icon-l-attention?"+Theme.highlightColor
|
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-19 01:58:58 +03:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
2020-06-03 08:34:33 +03:00
|
|
|
onClicked: parent.visible = false
|
2017-06-19 01:58:58 +03:00
|
|
|
}
|
|
|
|
}
|
2017-06-16 17:45:04 +03:00
|
|
|
}
|
2017-07-20 13:14:16 +03:00
|
|
|
|
2017-06-16 17:45:04 +03:00
|
|
|
}
|