Progress bar for video downloads

This commit is contained in:
Sebastian Wolf 2020-11-14 21:01:52 +01:00
parent d994f8f102
commit fa470f73ba
2 changed files with 69 additions and 49 deletions

View file

@ -127,6 +127,10 @@ Item {
videoComponentLoader.active = true; videoComponentLoader.active = true;
} }
} }
if (fileId === videoFileId) {
downloadingProgressBar.maximumValue = fileInformation.size;
downloadingProgressBar.value = fileInformation.local.downloaded_size;
}
} }
} }
} }
@ -154,59 +158,73 @@ Item {
visible: playButton.visible visible: playButton.visible
} }
Row { Column {
width: parent.width width: parent.width
height: parent.height height: downloadingProgressBar.height + videoControlRow.height
Item { anchors.centerIn: parent
height: parent.height
width: videoMessageComponent.fullscreen ? parent.width : ( parent.width / 2 ) Row {
Image { id: videoControlRow
id: playButton width: parent.width
anchors.centerIn: parent Item {
width: Theme.iconSizeLarge width: videoMessageComponent.fullscreen ? parent.width : ( parent.width / 2 )
height: Theme.iconSizeLarge height: Theme.iconSizeLarge
source: "image://theme/icon-l-play?white" Image {
asynchronous: true id: playButton
visible: placeholderImage.status === Image.Ready ? true : false anchors.centerIn: parent
MouseArea { width: Theme.iconSizeLarge
anchors.fill: parent height: Theme.iconSizeLarge
onClicked: { source: "image://theme/icon-l-play?white"
fullscreenItem.visible = false; asynchronous: true
handlePlay(); visible: placeholderImage.status === Image.Ready ? true : false
MouseArea {
anchors.fill: parent
onClicked: {
fullscreenItem.visible = false;
handlePlay();
}
} }
} }
BusyIndicator {
id: videoDownloadBusyIndicator
running: false
visible: running
anchors.centerIn: parent
size: BusyIndicatorSize.Large
}
} }
BusyIndicator { Item {
id: videoDownloadBusyIndicator id: fullscreenItem
running: false width: parent.width / 2
visible: running height: Theme.iconSizeLarge
anchors.centerIn: parent visible: !videoMessageComponent.fullscreen
size: BusyIndicatorSize.Large IconButton {
id: fullscreenButton
anchors.centerIn: parent
width: Theme.iconSizeLarge
height: Theme.iconSizeLarge
icon {
asynchronous: true
source: "../../images/icon-l-fullscreen.svg"
sourceSize {
width: Theme.iconSizeLarge
height: Theme.iconSizeLarge
}
}
visible: ( placeholderImage.status === Image.Ready && !videoMessageComponent.fullscreen ) ? true : false
onClicked: {
pageStack.push(Qt.resolvedUrl("../pages/VideoPage.qml"), {"videoData": videoData});
}
}
} }
} }
Item { ProgressBar {
id: fullscreenItem id: downloadingProgressBar
height: parent.height minimumValue: 0
width: parent.width / 2 maximumValue: 100
visible: !videoMessageComponent.fullscreen value: 0
IconButton { visible: videoDownloadBusyIndicator.visible
id: fullscreenButton width: parent.width
anchors.centerIn: parent
width: Theme.iconSizeLarge
height: Theme.iconSizeLarge
icon {
asynchronous: true
source: "../../images/icon-l-fullscreen.svg"
sourceSize {
width: Theme.iconSizeLarge
height: Theme.iconSizeLarge
}
}
visible: ( placeholderImage.status === Image.Ready && !videoMessageComponent.fullscreen ) ? true : false
onClicked: {
pageStack.push(Qt.resolvedUrl("../pages/VideoPage.qml"), {"videoData": videoData});
}
}
} }
} }
@ -246,7 +264,7 @@ Item {
id: videoComponentLoader id: videoComponentLoader
active: false active: false
width: parent.width width: parent.width
height: Functions.getVideoHeight(parent.width, videoData) height: ( rawMessage.content['@type'] === "messageVideoNote" ) ? width : Functions.getVideoHeight(parent.width, videoData)
sourceComponent: videoComponent sourceComponent: videoComponent
} }

View file

@ -263,8 +263,10 @@ Page {
} }
onFileUpdated: { onFileUpdated: {
uploadStatusRow.visible = fileInformation.remote.is_uploading_active; uploadStatusRow.visible = fileInformation.remote.is_uploading_active;
uploadingProgressBar.maximumValue = fileInformation.size; if (uploadStatusRow.visible) {
uploadingProgressBar.value = fileInformation.remote.uploaded_size; uploadingProgressBar.maximumValue = fileInformation.size;
uploadingProgressBar.value = fileInformation.remote.uploaded_size;
}
} }
onEmojiSearchSuccessful: { onEmojiSearchSuccessful: {
chatPage.emojiProposals = result; chatPage.emojiProposals = result;