Introduce upload status bar

This commit is contained in:
Sebastian J. Wolf 2020-09-29 23:37:56 +02:00
parent f19b3ae4cb
commit 97e72bac9b
10 changed files with 74 additions and 6 deletions

View file

@ -27,6 +27,7 @@ Item {
height: Theme.itemSizeLarge
property variant documentData;
property bool openRequested: false;
Component.onCompleted: {
updateDocument();
@ -48,12 +49,15 @@ Item {
target: tdLibWrapper
onFileUpdated: {
if (documentData) {
if (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;
documentData.document = fileInformation;
downloadDocumentButton.visible = false;
openDocumentButton.visible = true;
tdLibWrapper.openFileOnDevice(documentData.document.local.path);
if (documentPreviewItem.openRequested) {
documentPreviewItem.openRequested = false;
tdLibWrapper.openFileOnDevice(documentData.document.local.path);
}
}
}
}
@ -87,6 +91,7 @@ Item {
text: qsTr("Open Document")
visible: false
onClicked: {
documentPreviewItem.openRequested = true;
tdLibWrapper.openFileOnDevice(documentData.document.local.path);
}
}

View file

@ -31,6 +31,7 @@ Item {
property bool fullscreen : false;
property bool onScreen;
property string videoType : "video";
property bool playRequested: false;
width: parent.width
height: parent.height
@ -92,6 +93,7 @@ Item {
}
function handlePlay() {
playRequested = true;
if (videoData[videoType].local.is_downloading_completed) {
videoUrl = videoData[videoType].local.path;
videoComponentLoader.active = true;
@ -109,11 +111,12 @@ Item {
videoData.thumbnail.photo = fileInformation;
placeholderImage.source = fileInformation.local.path;
}
if (fileInformation.local.is_downloading_completed && fileId === videoFileId) {
if (!fileInformation.remote.is_uploading_active && fileInformation.local.is_downloading_completed && fileId === videoFileId) {
videoDownloadBusyIndicator.running = false;
videoData[videoType] = fileInformation;
videoUrl = fileInformation.local.path;
if (onScreen) {
if (onScreen && playRequested) {
playRequested = false;
videoComponentLoader.active = true;
}
}

View file

@ -215,8 +215,12 @@ function handleLink(link) {
function getVideoHeight(videoWidth, videoData) {
if (typeof videoData !== "undefined") {
var aspectRatio = videoData.height / videoData.width;
return Math.round(videoWidth * aspectRatio);
if (videoData.height === 0) {
return videoWidth;
} else {
var aspectRatio = videoData.height / videoData.width;
return Math.round(videoWidth * aspectRatio);
}
} else {
return 1;
}

View file

@ -215,6 +215,11 @@ Page {
updateGroupStatusText();
}
}
onFileUpdated: {
uploadStatusRow.visible = fileInformation.remote.is_uploading_active;
uploadingProgressBar.maximumValue = fileInformation.size;
uploadingProgressBar.value = fileInformation.remote.uploaded_size;
}
}
Connections {
@ -1002,6 +1007,33 @@ Page {
}
}
Row {
id: uploadStatusRow
visible: false
spacing: Theme.paddingMedium
width: parent.width
anchors.right: parent.right
Text {
id: uploadingText
font.pixelSize: Theme.fontSizeSmall
text: qsTr("Uploading...")
anchors.verticalCenter: parent.verticalCenter
color: Theme.secondaryColor
visible: uploadStatusRow.visible
}
ProgressBar {
id: uploadingProgressBar
minimumValue: 0
maximumValue: 100
value: 0
visible: uploadStatusRow.visible
width: parent.width - uploadingText.width - Theme.paddingMedium
}
}
Text {
width: parent.width

View file

@ -169,6 +169,10 @@
<source>Delete Message</source>
<translation>Nachricht löschen</translation>
</message>
<message>
<source>Uploading...</source>
<translation>Lade hoch...</translation>
</message>
</context>
<context>
<name>CoverPage</name>

View file

@ -169,6 +169,10 @@
<source>Delete Message</source>
<translation>Borrar mensaje</translation>
</message>
<message>
<source>Uploading...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CoverPage</name>

View file

@ -169,6 +169,10 @@
<source>Delete Message</source>
<translation>Üzenet törlése</translation>
</message>
<message>
<source>Uploading...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CoverPage</name>

View file

@ -169,6 +169,10 @@
<source>Delete Message</source>
<translation>Usuń wiadomość</translation>
</message>
<message>
<source>Uploading...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CoverPage</name>

View file

@ -169,6 +169,10 @@
<source>Delete Message</source>
<translation></translation>
</message>
<message>
<source>Uploading...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CoverPage</name>

View file

@ -169,6 +169,10 @@
<source>Delete Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Uploading...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CoverPage</name>