diff --git a/qml/components/AudioPreview.qml b/qml/components/AudioPreview.qml index 3901f6b..c58d69c 100644 --- a/qml/components/AudioPreview.qml +++ b/qml/components/AudioPreview.qml @@ -163,7 +163,7 @@ Item { height: Theme.iconSizeLarge Item { height: Theme.iconSizeLarge - width: parent.width + width: downloadItem.visible ? parent.width / 2 : parent.width IconButton { id: playButton anchors.centerIn: parent @@ -187,6 +187,35 @@ Item { size: BusyIndicatorSize.Large } } + Item { + id: downloadItem + width: parent.width / 2 + height: Theme.iconSizeLarge + visible: audioData[audioType].local.is_downloading_completed + Rectangle { + color: Theme.primaryColor + opacity: Theme.opacityFaint + width: Theme.iconSizeLarge * 0.9 + height: Theme.iconSizeLarge * 0.9 + anchors.centerIn: parent + radius: width / 2 + } + + IconButton { + id: downloadButton + anchors.centerIn: parent + width: Theme.iconSizeLarge + height: Theme.iconSizeLarge + icon { + source: "image://theme/icon-m-cloud-download?white" + asynchronous: true + } + highlighted: audioMessageComponent.highlighted || down + onClicked: { + tdLibWrapper.copyFileToDownloads(audioData[audioType].local.path); + } + } + } } ProgressBar { id: downloadingProgressBar @@ -250,6 +279,7 @@ Item { target: messageAudio onPlaying: { playButton.visible = false; + downloadItem.visible = false; } } @@ -261,7 +291,6 @@ Item { timeLeftItem.visible = true; } else { messageAudio.play(); - timeLeftTimer.start(); } } } @@ -272,7 +301,6 @@ Item { Component.onCompleted: { if (messageAudio.error === MediaPlayer.NoError) { messageAudio.play(); - timeLeftTimer.start(); } else { errorText.text = qsTr("Error loading audio! " + messageAudio.errorString) errorTextOverlay.visible = true; @@ -323,6 +351,7 @@ Item { onStopped: { playButton.visible = true; + downloadItem.visible = true; audioComponentLoader.active = false; } } @@ -336,15 +365,6 @@ Item { size: BusyIndicatorSize.Medium } - Timer { - id: timeLeftTimer - repeat: false - interval: 2000 - onTriggered: { - timeLeftItem.visible = false; - } - } - Item { id: timeLeftItem width: parent.width @@ -372,7 +392,7 @@ Item { visible: audioComponentLoader.active && messageAudio.playbackState === MediaPlayer.PausedState Item { height: parent.height - width: parent.width + width: parent.width / 2 IconButton { id: pausedPlayButton anchors.centerIn: parent @@ -385,7 +405,34 @@ Item { } onClicked: { messageAudio.play(); - timeLeftTimer.start(); + } + } + } + Item { + id: pausedDownloadItem + width: parent.width / 2 + height: parent.height + Rectangle { + color: Theme.primaryColor + opacity: Theme.opacityFaint + width: Theme.iconSizeLarge * 0.9 + height: Theme.iconSizeLarge * 0.9 + anchors.centerIn: parent + radius: width / 2 + } + + IconButton { + id: pausedDownloadButton + anchors.centerIn: parent + width: Theme.iconSizeLarge + height: Theme.iconSizeLarge + icon { + source: "image://theme/icon-m-cloud-download?white" + asynchronous: true + } + highlighted: audioMessageComponent.highlighted || down + onClicked: { + tdLibWrapper.copyFileToDownloads(audioData[audioType].local.path); } } } @@ -406,7 +453,6 @@ Item { onReleased: { messageAudio.seek(Math.floor(value)); messageAudio.play(); - timeLeftTimer.start(); } valueText: getTimeString(Math.round((messageAudio.duration - messageAudioSlider.value) / 1000)) } diff --git a/qml/components/DocumentPreview.qml b/qml/components/DocumentPreview.qml index 565e6a9..df5a6f1 100644 --- a/qml/components/DocumentPreview.qml +++ b/qml/components/DocumentPreview.qml @@ -77,7 +77,7 @@ Item { anchors.centerIn: parent text: qsTr("Download Document") visible: false - highlighted: videoMessageComponent.highlighted || down + highlighted: documentPreviewItem.highlighted || down onClicked: { downloadDocumentButton.visible = false; downloadingProgressBar.visible = true; @@ -101,7 +101,7 @@ Item { anchors.centerIn: parent text: qsTr("Open Document") visible: false - highlighted: videoMessageComponent.highlighted || down + highlighted: documentPreviewItem.highlighted || down onClicked: { documentPreviewItem.openRequested = true; tdLibWrapper.openFileOnDevice(documentData.document.local.path); diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml index 928bb41..241fd35 100644 --- a/qml/pages/OverviewPage.qml +++ b/qml/pages/OverviewPage.qml @@ -183,6 +183,13 @@ Page { onErrorReceived: { Functions.handleErrorMessage(code, message); } + onCopyToDownloadsSuccessful: { + appNotification.show(qsTr("Download of %1 successful.").arg(fileName), filePath); + } + + onCopyToDownloadsError: { + appNotification.show(qsTr("Download failed.")); + } } Component.onCompleted: { diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 6700c24..a1e9739 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1026,6 +1026,14 @@ New Chat Neuer Chat + + Download of %1 successful. + Download von %1 erfolgreich. + + + Download failed. + Download fehlgeschlagen. + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index e0d7413..41caf9e 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1026,6 +1026,14 @@ New Chat New Chat + + Download of %1 successful. + Download of %1 successful. + + + Download failed. + Download failed. + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index e55d8f4..35ed61b 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1015,6 +1015,14 @@ New Chat Nueva charla + + Download of %1 successful. + Bajada de %1 exitosa. + + + Download failed. + Error al bajar + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 92eec5c..1419cd6 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1027,6 +1027,14 @@ New Chat Uusi keskustelu + + Download of %1 successful. + + + + Download failed. + Lataus epäonnistui. + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 627e8f1..f24ffa0 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1015,6 +1015,14 @@ New Chat + + Download of %1 successful. + A %1 letöltése sikerült. + + + Download failed. + A letöltés nem sikerült. + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index dbb229d..c33a2a1 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1026,6 +1026,14 @@ New Chat Nuova chat + + Download of %1 successful. + Download di %1 completato. + + + Download failed. + Download non riuscito. + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index b09993b..4f6b1ae 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1037,6 +1037,14 @@ New Chat Nowy czat + + Download of %1 successful. + + + + Download failed. + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 8842bad..a8a0405 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1037,6 +1037,14 @@ New Chat Новый Чат + + Download of %1 successful. + Успешно скачано %1. + + + Download failed. + Ошибка скачивания. + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 38e9527..4cede85 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1026,6 +1026,14 @@ New Chat Ny chatt + + Download of %1 successful. + Nerladdning av %1 slutförd. + + + Download failed. + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 1c65bcd..69a9502 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1015,6 +1015,14 @@ New Chat 新对话 + + Download of %1 successful. + 已成功下载 %1 。 + + + Download failed. + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 1d93a30..a0687d8 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1026,6 +1026,14 @@ New Chat + + Download of %1 successful. + Download of %1 successful. + + + Download failed. + Download failed. + PinnedMessageItem