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,11 +132,16 @@ Item {
visible: playButton.visible visible: playButton.visible
} }
Row { Column {
width: parent.width width: parent.width
height: parent.height height: downloadingProgressBar.height + audioControlRow.height
anchors.centerIn: parent
Row {
id: audioControlRow
width: parent.width
height: Theme.iconSizeLarge
Item { Item {
height: parent.height height: Theme.iconSizeLarge
width: parent.width width: parent.width
Image { Image {
id: playButton id: playButton
@ -158,6 +167,16 @@ Item {
} }
} }
} }
ProgressBar {
id: downloadingProgressBar
minimumValue: 0
maximumValue: 100
value: 0
visible: audioDownloadBusyIndicator.visible
width: parent.width
}
}
Rectangle { Rectangle {
id: audioErrorShade id: audioErrorShade

View file

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

View file

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

View file

@ -608,7 +608,7 @@ Page {
case "LocationPreview": case "LocationPreview":
return parentWidth * 0.66666666; // 2 / 3; return parentWidth * 0.66666666; // 2 / 3;
case "VideoPreview": 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": case "AudioPreview":
return parentWidth / 2; return parentWidth / 2;
case "DocumentPreview": case "DocumentPreview":