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-06-29 11:48:06 +03:00
|
|
|
id: myMedia
|
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 {
|
2020-06-22 21:13:05 +03:00
|
|
|
opacity: 0.4
|
2017-07-20 13:14:16 +03:00
|
|
|
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 {
|
2020-06-29 11:48:06 +03:00
|
|
|
visible: type == 'image'
|
|
|
|
opacity: img.status === Image.Ready ? 0.0 : 1.0
|
2020-06-22 21:13:05 +03:00
|
|
|
Behavior on opacity { FadeAnimator {} }
|
2020-06-29 11:48:06 +03:00
|
|
|
source: "image://theme/icon-m-image?"
|
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
|
|
|
|
|
|
|
Image {
|
|
|
|
visible: type == 'video' || type == "gifv"
|
|
|
|
opacity: img.status === Image.Ready ? 0.0 : 1.0
|
|
|
|
Behavior on opacity { FadeAnimator {} }
|
|
|
|
source: "image://theme/icon-m-file-video?"
|
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
|
|
|
|
|
|
|
Image {
|
|
|
|
visible: type == 'audio'
|
2020-07-03 11:45:30 +03:00
|
|
|
//opacity: img.status === Image.Ready ? 0.0 : 1.0
|
2020-06-29 11:48:06 +03:00
|
|
|
Behavior on opacity { FadeAnimator {} }
|
|
|
|
source: "image://theme/icon-m-file-audio?"
|
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
|
2020-06-29 11:48:06 +03:00
|
|
|
visible: type != 'audio'
|
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"
|
2020-06-29 11:48:06 +03:00
|
|
|
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
|
2020-07-03 11:45:30 +03:00
|
|
|
visible: type != 'audio'
|
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
|
2020-07-03 11:45:30 +03:00
|
|
|
anchors {
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
2017-06-19 01:58:58 +03:00
|
|
|
}
|
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
|
2020-06-22 21:13:05 +03:00
|
|
|
visible: typeof status_sensitive != "undefined" && status_sensitive ? true : false
|
2017-06-19 01:58:58 +03:00
|
|
|
Image {
|
|
|
|
source: "image://theme/icon-l-attention?"+Theme.highlightColor
|
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
2020-07-03 11:45:30 +03:00
|
|
|
anchors.fill: parent
|
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
|
|
|
}
|
|
|
|
}
|