Merge remote-tracking branch 'origin/master' into searching

This commit is contained in:
Sebastian Wolf 2020-12-28 22:16:59 +01:00
commit 78a71cfbab
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
17 changed files with 172 additions and 17 deletions

View file

@ -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))
}

View file

@ -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);

View file

@ -583,6 +583,9 @@ Page {
}
lastQueuedIndex = -1
}
if (chatInformation.unread_count === 0) {
tdLibWrapper.readAllChatMentions(chatInformation.id);
}
}
}
@ -892,6 +895,8 @@ Page {
if (bottomIndex > -1) {
viewMessageTimer.queueViewMessage(bottomIndex)
}
} else {
tdLibWrapper.readAllChatMentions(chatInformation.id);
}
manuallyScrolledToBottom = chatView.atYEnd
}

View file

@ -203,6 +203,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: {

View file

@ -958,6 +958,14 @@ void TDLibWrapper::searchPublicChats(const QString &query)
requestObject.insert(_TYPE, "searchPublicChats");
requestObject.insert("query", query);
requestObject.insert(_EXTRA, "searchPublicChats");
}
void TDLibWrapper::readAllChatMentions(qlonglong chatId)
{
LOG("Read all chat mentions" << chatId);
QVariantMap requestObject;
requestObject.insert(_TYPE, "readAllChatMentions");
requestObject.insert("chat_id", chatId);
this->sendRequest(requestObject);
}

View file

@ -181,6 +181,7 @@ public:
Q_INVOKABLE void importContacts(const QVariantList &contacts);
Q_INVOKABLE void searchChatMessages(const qlonglong &chatId, const QString &query, const qlonglong fromMessageId = 0);
Q_INVOKABLE void searchPublicChats(const QString &query);
Q_INVOKABLE void readAllChatMentions(qlonglong chatId);
// Others (candidates for extraction ;))
Q_INVOKABLE void searchEmoji(const QString &queryString);

View file

@ -1042,6 +1042,14 @@
<source>Search Chats</source>
<translation>Chats suchen</translation>
</message>
<message>
<source>Download of %1 successful.</source>
<translation type="unfinished">Download von %1 erfolgreich.</translation>
</message>
<message>
<source>Download failed.</source>
<translation type="unfinished">Download fehlgeschlagen.</translation>
</message>
</context>
<context>
<name>PinnedMessageItem</name>

View file

@ -1042,6 +1042,14 @@
<source>Search Chats</source>
<translation>Search Chats</translation>
</message>
<message>
<source>Download of %1 successful.</source>
<translation type="unfinished">Download of %1 successful.</translation>
</message>
<message>
<source>Download failed.</source>
<translation type="unfinished">Download failed.</translation>
</message>
</context>
<context>
<name>PinnedMessageItem</name>

View file

@ -1031,6 +1031,14 @@
<source>Search Chats</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download of %1 successful.</source>
<translation type="unfinished">Bajada de %1 exitosa.</translation>
</message>
<message>
<source>Download failed.</source>
<translation type="unfinished">Error al bajar</translation>
</message>
</context>
<context>
<name>PinnedMessageItem</name>

View file

@ -1043,6 +1043,14 @@
<source>Search Chats</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download of %1 successful.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download failed.</source>
<translation type="unfinished">Lataus epäonnistui.</translation>
</message>
</context>
<context>
<name>PinnedMessageItem</name>

View file

@ -1031,6 +1031,14 @@
<source>Search Chats</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download of %1 successful.</source>
<translation type="unfinished">A %1 letöltése sikerült.</translation>
</message>
<message>
<source>Download failed.</source>
<translation type="unfinished">A letöltés nem sikerült.</translation>
</message>
</context>
<context>
<name>PinnedMessageItem</name>

View file

@ -1042,6 +1042,14 @@
<source>Search Chats</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download of %1 successful.</source>
<translation type="unfinished">Download di %1 completato.</translation>
</message>
<message>
<source>Download failed.</source>
<translation type="unfinished">Download non riuscito.</translation>
</message>
</context>
<context>
<name>PinnedMessageItem</name>

View file

@ -1053,6 +1053,14 @@
<source>Search Chats</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download of %1 successful.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download failed.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PinnedMessageItem</name>

View file

@ -1053,6 +1053,14 @@
<source>Search Chats</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download of %1 successful.</source>
<translation type="unfinished">Успешно скачано %1.</translation>
</message>
<message>
<source>Download failed.</source>
<translation type="unfinished">Ошибка скачивания.</translation>
</message>
</context>
<context>
<name>PinnedMessageItem</name>

View file

@ -1042,6 +1042,14 @@
<source>Search Chats</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download of %1 successful.</source>
<translation type="unfinished">Nerladdning av %1 slutförd.</translation>
</message>
<message>
<source>Download failed.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PinnedMessageItem</name>

View file

@ -1031,6 +1031,14 @@
<source>Search Chats</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download of %1 successful.</source>
<translation type="unfinished"> %1 </translation>
</message>
<message>
<source>Download failed.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PinnedMessageItem</name>

View file

@ -1042,6 +1042,14 @@
<source>Search Chats</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download of %1 successful.</source>
<translation type="unfinished">Download of %1 successful.</translation>
</message>
<message>
<source>Download failed.</source>
<translation type="unfinished">Download failed.</translation>
</message>
</context>
<context>
<name>PinnedMessageItem</name>