More progress bars & fix some web page previews

This commit is contained in:
Sebastian Wolf 2020-11-14 22:53:51 +01:00
parent fa470f73ba
commit 6666cf494a
4 changed files with 59 additions and 30 deletions

View file

@ -101,6 +101,10 @@ Item {
}
}
}
if (fileId === audioFileId) {
downloadingProgressBar.maximumValue = fileInformation.size;
downloadingProgressBar.value = fileInformation.local.downloaded_size;
}
}
}
}
@ -128,37 +132,52 @@ Item {
visible: playButton.visible
}
Row {
Column {
width: parent.width
height: parent.height
Item {
height: parent.height
height: downloadingProgressBar.height + audioControlRow.height
anchors.centerIn: parent
Row {
id: audioControlRow
width: parent.width
Image {
id: playButton
anchors.centerIn: parent
width: Theme.iconSizeLarge
height: Theme.iconSizeLarge
Item {
height: Theme.iconSizeLarge
source: "image://theme/icon-l-play?white"
asynchronous: true
visible: placeholderImage.status === Image.Ready ? true : false
MouseArea {
anchors.fill: parent
onClicked: {
handlePlay();
width: parent.width
Image {
id: playButton
anchors.centerIn: parent
width: Theme.iconSizeLarge
height: Theme.iconSizeLarge
source: "image://theme/icon-l-play?white"
asynchronous: true
visible: placeholderImage.status === Image.Ready ? true : false
MouseArea {
anchors.fill: parent
onClicked: {
handlePlay();
}
}
}
}
BusyIndicator {
id: audioDownloadBusyIndicator
running: false
visible: running
anchors.centerIn: parent
size: BusyIndicatorSize.Large
BusyIndicator {
id: audioDownloadBusyIndicator
running: false
visible: running
anchors.centerIn: parent
size: BusyIndicatorSize.Large
}
}
}
ProgressBar {
id: downloadingProgressBar
minimumValue: 0
maximumValue: 100
value: 0
visible: audioDownloadBusyIndicator.visible
width: parent.width
}
}
Rectangle {
id: audioErrorShade
width: parent.width

View file

@ -52,7 +52,7 @@ Item {
onFileUpdated: {
if (documentData) {
if (!fileInformation.remote.is_uploading_active && fileId === documentData.document.id && fileInformation.local.is_downloading_completed) {
downloadBusyIndicator.running = false;
downloadingProgressBar.visible = false;
documentData.document = fileInformation;
downloadDocumentButton.visible = false;
openDocumentButton.visible = true;
@ -61,6 +61,10 @@ Item {
tdLibWrapper.openFileOnDevice(documentData.document.local.path);
}
}
if (fileId === documentData.document.id) {
downloadingProgressBar.maximumValue = fileInformation.size;
downloadingProgressBar.value = fileInformation.local.downloaded_size;
}
}
}
}
@ -73,16 +77,18 @@ Item {
visible: false
onClicked: {
downloadDocumentButton.visible = false;
downloadBusyIndicator.running = true;
downloadingProgressBar.visible = true;
tdLibWrapper.downloadFile(documentData.document.id);
}
}
BusyIndicator {
id: downloadBusyIndicator
running: false
size: BusyIndicatorSize.Medium
visible: running
ProgressBar {
id: downloadingProgressBar
minimumValue: 0
maximumValue: 100
value: 0
visible: false
width: parent.width
anchors.centerIn: parent
}

View file

@ -362,6 +362,10 @@ ListItem {
WebPagePreview {
id: webPagePreview
Component.onCompleted: {
webPagePreviewLoader.height = 0;
}
onImplicitHeightChanged: {
webPagePreviewLoader.height = webPagePreview.implicitHeight;
}

View file

@ -608,7 +608,7 @@ Page {
case "LocationPreview":
return parentWidth * 0.66666666; // 2 / 3;
case "VideoPreview":
return ( content['@type'] === "messageVideoNote" ) ? content.video_note.length : ( Functions.getVideoHeight(parentWidth, ( content['@type'] === "messageVideo" ) ? content.video : content.animation) );
return ( content['@type'] === "messageVideoNote" ) ? parentWidth : ( Functions.getVideoHeight(parentWidth, ( content['@type'] === "messageVideo" ) ? content.video : content.animation) );
case "AudioPreview":
return parentWidth / 2;
case "DocumentPreview":