Introduce upload status bar
This commit is contained in:
parent
f19b3ae4cb
commit
97e72bac9b
10 changed files with 74 additions and 6 deletions
|
@ -27,6 +27,7 @@ Item {
|
||||||
height: Theme.itemSizeLarge
|
height: Theme.itemSizeLarge
|
||||||
|
|
||||||
property variant documentData;
|
property variant documentData;
|
||||||
|
property bool openRequested: false;
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
updateDocument();
|
updateDocument();
|
||||||
|
@ -48,12 +49,15 @@ Item {
|
||||||
target: tdLibWrapper
|
target: tdLibWrapper
|
||||||
onFileUpdated: {
|
onFileUpdated: {
|
||||||
if (documentData) {
|
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;
|
downloadBusyIndicator.running = false;
|
||||||
documentData.document = fileInformation;
|
documentData.document = fileInformation;
|
||||||
downloadDocumentButton.visible = false;
|
downloadDocumentButton.visible = false;
|
||||||
openDocumentButton.visible = true;
|
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")
|
text: qsTr("Open Document")
|
||||||
visible: false
|
visible: false
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
documentPreviewItem.openRequested = true;
|
||||||
tdLibWrapper.openFileOnDevice(documentData.document.local.path);
|
tdLibWrapper.openFileOnDevice(documentData.document.local.path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ Item {
|
||||||
property bool fullscreen : false;
|
property bool fullscreen : false;
|
||||||
property bool onScreen;
|
property bool onScreen;
|
||||||
property string videoType : "video";
|
property string videoType : "video";
|
||||||
|
property bool playRequested: false;
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
@ -92,6 +93,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePlay() {
|
function handlePlay() {
|
||||||
|
playRequested = true;
|
||||||
if (videoData[videoType].local.is_downloading_completed) {
|
if (videoData[videoType].local.is_downloading_completed) {
|
||||||
videoUrl = videoData[videoType].local.path;
|
videoUrl = videoData[videoType].local.path;
|
||||||
videoComponentLoader.active = true;
|
videoComponentLoader.active = true;
|
||||||
|
@ -109,11 +111,12 @@ Item {
|
||||||
videoData.thumbnail.photo = fileInformation;
|
videoData.thumbnail.photo = fileInformation;
|
||||||
placeholderImage.source = fileInformation.local.path;
|
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;
|
videoDownloadBusyIndicator.running = false;
|
||||||
videoData[videoType] = fileInformation;
|
videoData[videoType] = fileInformation;
|
||||||
videoUrl = fileInformation.local.path;
|
videoUrl = fileInformation.local.path;
|
||||||
if (onScreen) {
|
if (onScreen && playRequested) {
|
||||||
|
playRequested = false;
|
||||||
videoComponentLoader.active = true;
|
videoComponentLoader.active = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,8 +215,12 @@ function handleLink(link) {
|
||||||
|
|
||||||
function getVideoHeight(videoWidth, videoData) {
|
function getVideoHeight(videoWidth, videoData) {
|
||||||
if (typeof videoData !== "undefined") {
|
if (typeof videoData !== "undefined") {
|
||||||
var aspectRatio = videoData.height / videoData.width;
|
if (videoData.height === 0) {
|
||||||
return Math.round(videoWidth * aspectRatio);
|
return videoWidth;
|
||||||
|
} else {
|
||||||
|
var aspectRatio = videoData.height / videoData.width;
|
||||||
|
return Math.round(videoWidth * aspectRatio);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,6 +215,11 @@ Page {
|
||||||
updateGroupStatusText();
|
updateGroupStatusText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onFileUpdated: {
|
||||||
|
uploadStatusRow.visible = fileInformation.remote.is_uploading_active;
|
||||||
|
uploadingProgressBar.maximumValue = fileInformation.size;
|
||||||
|
uploadingProgressBar.value = fileInformation.remote.uploaded_size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
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 {
|
Text {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
|
|
|
@ -169,6 +169,10 @@
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>Nachricht löschen</translation>
|
<translation>Nachricht löschen</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Uploading...</source>
|
||||||
|
<translation>Lade hoch...</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -169,6 +169,10 @@
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>Borrar mensaje</translation>
|
<translation>Borrar mensaje</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Uploading...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -169,6 +169,10 @@
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>Üzenet törlése</translation>
|
<translation>Üzenet törlése</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Uploading...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -169,6 +169,10 @@
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>Usuń wiadomość</translation>
|
<translation>Usuń wiadomość</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Uploading...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -169,6 +169,10 @@
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation>删除消息</translation>
|
<translation>删除消息</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Uploading...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
|
@ -169,6 +169,10 @@
|
||||||
<source>Delete Message</source>
|
<source>Delete Message</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Uploading...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>CoverPage</name>
|
<name>CoverPage</name>
|
||||||
|
|
Loading…
Reference in a new issue