From f9a824ca2ccd32710f05d5b6fbecfead85076d38 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Thu, 31 Dec 2020 17:30:55 +0200 Subject: [PATCH 01/59] Apply opacity to picture and badge as a group It matters when page is being dimmed --- qml/components/PhotoTextsListItem.qml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/qml/components/PhotoTextsListItem.qml b/qml/components/PhotoTextsListItem.qml index f5fbb4b..a728053 100644 --- a/qml/components/PhotoTextsListItem.qml +++ b/qml/components/PhotoTextsListItem.qml @@ -33,15 +33,14 @@ ListItem { height: contentColumn.height spacing: Theme.paddingMedium - Column { - id: pictureColumn + ShaderEffectSource { + id: pictureItem width: contentColumn.height - Theme.paddingSmall height: contentColumn.height - Theme.paddingSmall anchors.verticalCenter: parent.verticalCenter - - Item { - width: parent.width - height: parent.width + sourceItem: Item { + width: pictureItem.width + height: pictureItem.width ProfileThumbnail { id: pictureThumbnail @@ -93,7 +92,7 @@ ListItem { Column { id: contentColumn - width: mainColumn.width - pictureColumn.width - mainRow.spacing + width: mainColumn.width - pictureItem.width - mainRow.spacing spacing: Theme.paddingSmall Row { From 9662df3c74f9708fb9558b9842aadfeb12fb3cd7 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Thu, 31 Dec 2020 19:12:50 +0100 Subject: [PATCH 02/59] Start with voice notes --- harbour-fernschreiber.pro | 1 + qml/components/VoiceNoteOverlay.qml | 72 +++++++++++++++++++++ qml/pages/ChatPage.qml | 28 +++++++- translations/harbour-fernschreiber-de.ts | 7 ++ translations/harbour-fernschreiber-en.ts | 7 ++ translations/harbour-fernschreiber-es.ts | 7 ++ translations/harbour-fernschreiber-fi.ts | 7 ++ translations/harbour-fernschreiber-hu.ts | 7 ++ translations/harbour-fernschreiber-it.ts | 7 ++ translations/harbour-fernschreiber-pl.ts | 7 ++ translations/harbour-fernschreiber-ru.ts | 7 ++ translations/harbour-fernschreiber-sv.ts | 7 ++ translations/harbour-fernschreiber-zh_CN.ts | 7 ++ translations/harbour-fernschreiber.ts | 7 ++ 14 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 qml/components/VoiceNoteOverlay.qml diff --git a/harbour-fernschreiber.pro b/harbour-fernschreiber.pro index f751a28..4c1e850 100644 --- a/harbour-fernschreiber.pro +++ b/harbour-fernschreiber.pro @@ -58,6 +58,7 @@ DISTFILES += qml/harbour-fernschreiber.qml \ qml/components/ReplyMarkupButtons.qml \ qml/components/StickerPicker.qml \ qml/components/PhotoTextsListItem.qml \ + qml/components/VoiceNoteOverlay.qml \ qml/components/WebPagePreview.qml \ qml/components/chatInformationPage/ChatInformationEditArea.qml \ qml/components/chatInformationPage/ChatInformationPageContent.qml \ diff --git a/qml/components/VoiceNoteOverlay.qml b/qml/components/VoiceNoteOverlay.qml new file mode 100644 index 0000000..fb2b92a --- /dev/null +++ b/qml/components/VoiceNoteOverlay.qml @@ -0,0 +1,72 @@ +/* + Copyright (C) 2020 Sebastian J. Wolf and other contributors + + This file is part of Fernschreiber. + + Fernschreiber is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Fernschreiber is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Fernschreiber. If not, see . +*/ +import QtQuick 2.6 +import Sailfish.Silica 1.0 +import "../components" +import "../js/twemoji.js" as Emoji + +Item { + id: voiceNoteOverlayItem + anchors.fill: parent + + Rectangle { + id: stickerPickerOverlayBackground + anchors.fill: parent + + color: Theme.overlayBackgroundColor + opacity: Theme.opacityHigh + } + + Flickable { + id: voiceNoteFlickable + anchors.fill: parent + anchors.margins: Theme.paddingMedium + + Behavior on opacity { NumberAnimation {} } + + contentHeight: voiceNoteColumn.height + clip: true + + Column { + id: voiceNoteColumn + spacing: Theme.paddingMedium + width: voiceNoteFlickable.width + + InfoLabel { + text: qsTr("Record a Voice Note") + } + + Image { + id: recorderImage + source: "image://theme/icon-l-recorder" + anchors { + horizontalCenter: parent.horizontalCenter + } + + fillMode: Image.PreserveAspectFit + asynchronous: true + width: Theme.itemSizeLarge + height: Theme.itemSizeLarge + } + + } + } + +} + diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 961d643..dc1c50f 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -621,7 +621,7 @@ Page { contentWidth: width PullDownMenu { - visible: chatInformation.id !== chatPage.myUserId && !stickerPickerLoader.active && !messageOverlayLoader.active + visible: chatInformation.id !== chatPage.myUserId && !stickerPickerLoader.active && !voiceNoteOverlayLoader.active && !messageOverlayLoader.active MenuItem { id: closeSecretChatMenuItem visible: chatPage.isSecretChat && chatPage.secretChatDetails.state["@type"] !== "secretChatStateClosed" @@ -874,7 +874,7 @@ Page { id: chatView visible: !blurred - property bool blurred: messageOverlayLoader.item + property bool blurred: messageOverlayLoader.item || stickerPickerLoader.item || voiceNoteOverlayLoader.item anchors.fill: parent opacity: chatPage.loading ? 0 : 1 @@ -1132,6 +1132,15 @@ Page { } } + Loader { + id: voiceNoteOverlayLoader + active: false + asynchronous: true + width: parent.width + height: active ? parent.height : 0 + source: "../components/VoiceNoteOverlay.qml" + } + } Column { @@ -1216,6 +1225,19 @@ Page { }) } } + IconButton { + visible: chatPage.hasSendPrivilege("can_send_media_messages") + icon.source: "image://theme/icon-m-mic" + icon.sourceSize { + width: Theme.iconSizeMedium + height: Theme.iconSizeMedium + } + highlighted: down || voiceNoteOverlayLoader.active + onClicked: { + voiceNoteOverlayLoader.active = !voiceNoteOverlayLoader.active; + stickerPickerLoader.active = false; + } + } IconButton { visible: chatPage.hasSendPrivilege("can_send_media_messages") icon.source: "image://theme/icon-m-document" @@ -1243,6 +1265,7 @@ Page { highlighted: down || stickerPickerLoader.active onClicked: { stickerPickerLoader.active = !stickerPickerLoader.active; + voiceNoteOverlayLoader.active = false; } } IconButton { @@ -1528,6 +1551,7 @@ Page { if (attachmentOptionsRow.isNeeded) { attachmentOptionsRow.isNeeded = false; stickerPickerLoader.active = false; + voiceNoteOverlayLoader.active = false; } else { attachmentOptionsRow.isNeeded = true; } diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 489527b..e871efc 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1418,6 +1418,13 @@ Download fehlgeschlagen. + + VoiceNoteOverlay + + Record a Voice Note + + + WebPagePreview diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 701afc6..6e943e0 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1418,6 +1418,13 @@ Download failed. + + VoiceNoteOverlay + + Record a Voice Note + + + WebPagePreview diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 828b71c..06060e9 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1399,6 +1399,13 @@ Error al bajar + + VoiceNoteOverlay + + Record a Voice Note + + + WebPagePreview diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 0882c32..83349c7 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1419,6 +1419,13 @@ Lataus epäonnistui. + + VoiceNoteOverlay + + Record a Voice Note + + + WebPagePreview diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 7ca1400..cbe6a16 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1399,6 +1399,13 @@ A letöltés nem sikerült. + + VoiceNoteOverlay + + Record a Voice Note + + + WebPagePreview diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 3c2baf9..85f802a 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1418,6 +1418,13 @@ Download non riuscito. + + VoiceNoteOverlay + + Record a Voice Note + + + WebPagePreview diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index c2b925d..92fdc5f 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1437,6 +1437,13 @@ Nieudane pobieranie + + VoiceNoteOverlay + + Record a Voice Note + + + WebPagePreview diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 72454c2..481f829 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1437,6 +1437,13 @@ Ошибка скачивания. + + VoiceNoteOverlay + + Record a Voice Note + + + WebPagePreview diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index c649561..e3d44d2 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1418,6 +1418,13 @@ Nerladdning misslyckades. + + VoiceNoteOverlay + + Record a Voice Note + + + WebPagePreview diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 8e4f8f9..c938305 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1399,6 +1399,13 @@ 下载失败 + + VoiceNoteOverlay + + Record a Voice Note + + + WebPagePreview diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 8005242..b9adc5e 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1418,6 +1418,13 @@ Download failed. + + VoiceNoteOverlay + + Record a Voice Note + + + WebPagePreview From c3f5fee378fa3231de52c4d629a78570f8052c43 Mon Sep 17 00:00:00 2001 From: carlosgonz <45316884+GNUuser@users.noreply.github.com> Date: Thu, 31 Dec 2020 15:00:32 -0500 Subject: [PATCH 03/59] Update harbour-fernschreiber-es.ts --- translations/harbour-fernschreiber-es.ts | 68 ++++++++++++------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 828b71c..77f11f8 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -263,15 +263,15 @@ Mark chat as unread - + Marcar como no leído Draft - + Borrador Mark chat as read - + Marcar como leído @@ -395,11 +395,11 @@ Search in Chat - + Buscar en charla Search in chat... - + Buscar @@ -777,21 +777,21 @@ has added %1 to the chat - + ha añadido %1 a charla has removed %1 from the chat - + ha quitado %1 de charla have added %1 to the chat myself - + ha añadido %1 a la charla have removed %1 from the chat myself - + ha quitado %1 de charla @@ -828,7 +828,7 @@ Please enter your phone number to continue. - Marcar número de teléfono para continuar. + Marcar el número de teléfono para continuar. Continue @@ -876,7 +876,7 @@ Use the international format, e.g. %1 - Usar el formato internacional %1 + Usa el formato internacional %1 About Fernschreiber @@ -902,7 +902,7 @@ Copy Message to Clipboard - Copiar mensaje + Copiar Message deleted @@ -922,7 +922,7 @@ Select Message - Seleccionar mensaje + Seleccionar Pin Message @@ -930,11 +930,11 @@ Message unpinned - Desanclar mensaje + Mensaje desanclado Unpin Message - + Desanclar mensaje @@ -1055,19 +1055,19 @@ Filter your chats... - + Filtrar las charlas... Search Chats - + Buscar charlas Download of %1 successful. - Bajada de %1 exitosa. + Bajada de %1 exitosa. Download failed. - Error al bajar + Error al bajar @@ -1082,7 +1082,7 @@ Message unpinned - Desanclar mensaje + Mensaje desanclado @@ -1259,43 +1259,43 @@ SearchChatsPage No chats found. - + No se han encontrado charlas. Searching chats... - + Buscando charlas... Private Chat - Privado + Privado Group - + Grupo Channel - + Canal %1 members - %1 miembros + %1 miembros %1 subscribers - %1 suscriptores + %1 suscriptores Search Chats - + Buscar charlas Search a chat... - + Buscar una charla... Enter your query to start searching (at least 5 characters needed) - + Introducir la consulta para iniciar la búsqueda (se necesitan al menos 5 caracteres) @@ -1784,21 +1784,21 @@ has added %1 to the chat - + ha añadido %1 a la charla has removed %1 from the chat - + ha quitado %1 de la charla have added %1 to the chat myself - + ha añadido %1 a la charla have removed %1 from the chat myself - + ha añadido %1 de la charla From 42398eee967cd787254645fb60f5122e1480a240 Mon Sep 17 00:00:00 2001 From: John Gibbon Date: Fri, 1 Jan 2021 01:30:23 +0100 Subject: [PATCH 04/59] Implement TextArea focus after message send option fixes #149 --- qml/pages/ChatPage.qml | 12 ++++++++++-- qml/pages/SettingsPage.qml | 10 ++++++++++ src/appsettings.cpp | 15 +++++++++++++++ src/appsettings.h | 5 +++++ translations/harbour-fernschreiber-de.ts | 8 ++++++++ translations/harbour-fernschreiber-en.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-es.ts | 8 ++++++++ translations/harbour-fernschreiber-fi.ts | 8 ++++++++ translations/harbour-fernschreiber-hu.ts | 8 ++++++++ translations/harbour-fernschreiber-it.ts | 8 ++++++++ translations/harbour-fernschreiber-pl.ts | 8 ++++++++ translations/harbour-fernschreiber-ru.ts | 8 ++++++++ translations/harbour-fernschreiber-sv.ts | 8 ++++++++ translations/harbour-fernschreiber-zh_CN.ts | 8 ++++++++ translations/harbour-fernschreiber.ts | 8 ++++++++ 15 files changed, 132 insertions(+), 6 deletions(-) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 727b317..38c4081 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -243,6 +243,10 @@ Page { } else { tdLibWrapper.sendTextMessage(chatInformation.id, newMessageTextField.text, newMessageColumn.replyToMessageId); } + + if(appSettings.focusTextAreaAfterSend) { + lostFocusTimer.start(); + } } controlSendButton(); newMessageInReplyToRow.inReplyToMessage = null; @@ -1507,7 +1511,9 @@ Page { if (appSettings.sendByEnter) { sendMessage(); newMessageTextField.text = ""; - newMessageTextField.focus = false; + if(!appSettings.focusTextAreaAfterSend) { + newMessageTextField.focus = false; + } } } @@ -1546,7 +1552,9 @@ Page { onClicked: { sendMessage(); newMessageTextField.text = ""; - newMessageTextField.focus = false; + if(!appSettings.focusTextAreaAfterSend) { + newMessageTextField.focus = false; + } } } } diff --git a/qml/pages/SettingsPage.qml b/qml/pages/SettingsPage.qml index e9abe19..800d5ef 100644 --- a/qml/pages/SettingsPage.qml +++ b/qml/pages/SettingsPage.qml @@ -52,6 +52,16 @@ Page { } } + TextSwitch { + checked: appSettings.focusTextAreaAfterSend + text: qsTr("Focus text input area after send") + description: qsTr("Focus the text input area after sending a message") + automaticCheck: false + onClicked: { + appSettings.focusTextAreaAfterSend = !checked + } + } + TextSwitch { checked: appSettings.useOpenWith text: qsTr("Open-with menu integration") diff --git a/src/appsettings.cpp b/src/appsettings.cpp index 497578f..0924a42 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -22,6 +22,7 @@ namespace { const QString KEY_SEND_BY_ENTER("sendByEnter"); + const QString KEY_FOCUS_TEXTAREA_AFTER_SEND("focusTextAreaAfterSend"); const QString KEY_USE_OPEN_WITH("useOpenWith"); const QString KEY_SHOW_STICKERS_AS_IMAGES("showStickersAsImages"); const QString KEY_ANIMATE_STICKERS("animateStickers"); @@ -48,6 +49,20 @@ void AppSettings::setSendByEnter(bool sendByEnter) } } +bool AppSettings::getFocusTextAreaAfterSend() const +{ + return settings.value(KEY_FOCUS_TEXTAREA_AFTER_SEND, false).toBool(); +} + +void AppSettings::setFocusTextAreaAfterSend(bool focusTextAreaAfterSend) +{ + if (getFocusTextAreaAfterSend() != focusTextAreaAfterSend) { + LOG(KEY_FOCUS_TEXTAREA_AFTER_SEND << focusTextAreaAfterSend); + settings.setValue(KEY_FOCUS_TEXTAREA_AFTER_SEND, focusTextAreaAfterSend); + emit focusTextAreaAfterSendChanged(); + } +} + bool AppSettings::getUseOpenWith() const { return settings.value(KEY_USE_OPEN_WITH, true).toBool(); diff --git a/src/appsettings.h b/src/appsettings.h index bb63cdf..a040e60 100644 --- a/src/appsettings.h +++ b/src/appsettings.h @@ -24,6 +24,7 @@ class AppSettings : public QObject { Q_OBJECT Q_PROPERTY(bool sendByEnter READ getSendByEnter WRITE setSendByEnter NOTIFY sendByEnterChanged) + Q_PROPERTY(bool focusTextAreaAfterSend READ getFocusTextAreaAfterSend WRITE setFocusTextAreaAfterSend NOTIFY focusTextAreaAfterSendChanged) Q_PROPERTY(bool useOpenWith READ getUseOpenWith WRITE setUseOpenWith NOTIFY useOpenWithChanged) Q_PROPERTY(bool showStickersAsImages READ showStickersAsImages WRITE setShowStickersAsImages NOTIFY showStickersAsImagesChanged) Q_PROPERTY(bool animateStickers READ animateStickers WRITE setAnimateStickers NOTIFY animateStickersChanged) @@ -45,6 +46,9 @@ public: bool getSendByEnter() const; void setSendByEnter(bool sendByEnter); + bool getFocusTextAreaAfterSend() const; + void setFocusTextAreaAfterSend(bool focusTextAreaAfterSend); + bool getUseOpenWith() const; void setUseOpenWith(bool useOpenWith); @@ -65,6 +69,7 @@ public: signals: void sendByEnterChanged(); + void focusTextAreaAfterSendChanged(); void useOpenWithChanged(); void showStickersAsImagesChanged(); void animateStickersChanged(); diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 489527b..4e13c72 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1391,6 +1391,14 @@ Enable storage optimizer Speicheroptimierer einschalten + + Focus text input area after send + Texteingabe nach Senden fokussieren + + + Focus the text input area after sending a message + Fokussiert die Texteingabe nach Senden einer Nachricht + StickerPicker diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 701afc6..aae0a43 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1391,6 +1391,14 @@ Enable storage optimizer Enable storage optimizer + + Focus text input area after send + Focus text input area after send + + + Focus the text input area after sending a message + Focus the text input area after sending a message + StickerPicker @@ -1803,21 +1811,21 @@ has added %1 to the chat - has added %1 to the chat + has added %1 to the chat has removed %1 from the chat - has removed %1 from the chat + has removed %1 from the chat have added %1 to the chat myself - have added %1 to the chat + have added %1 to the chat have removed %1 from the chat myself - have removed %1 from the chat + have removed %1 from the chat diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 828b71c..95241a7 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1372,6 +1372,14 @@ Enable storage optimizer Optimizador de almacenamiento + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 0882c32..7f0d06b 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1392,6 +1392,14 @@ Enable storage optimizer Käytä tallennustilan optimointia + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 7ca1400..32fcc07 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1372,6 +1372,14 @@ Enable storage optimizer + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 3c2baf9..37072ec 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1391,6 +1391,14 @@ Enable storage optimizer Abilita ottimizzazione memoria + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index c2b925d..e6389ce 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1410,6 +1410,14 @@ Enable storage optimizer Włącz optymalizację pamięci + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 72454c2..ccc1434 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1410,6 +1410,14 @@ Enable storage optimizer Включить оптимизацию хранилища + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index c649561..9d0eeff 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1391,6 +1391,14 @@ Enable storage optimizer Aktivera lagringsoptimering + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 8e4f8f9..424535d 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1372,6 +1372,14 @@ Enable storage optimizer 启用储存加速器 + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 8005242..3468e69 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1391,6 +1391,14 @@ Enable storage optimizer + + Focus text input area after send + + + + Focus the text input area after sending a message + + StickerPicker From 2c078307dc1f61a145dedcdea4a5aeb842acc176 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Fri, 1 Jan 2021 14:39:22 +0100 Subject: [PATCH 05/59] Add singular/plural forms to search chats page --- qml/pages/SearchChatsPage.qml | 12 ++++++------ translations/harbour-fernschreiber-de.ts | 14 ++++++++++---- translations/harbour-fernschreiber-en.ts | 14 ++++++++++---- translations/harbour-fernschreiber-es.ts | 12 ++++++++---- translations/harbour-fernschreiber-fi.ts | 14 ++++++++++---- translations/harbour-fernschreiber-hu.ts | 12 ++++++++---- translations/harbour-fernschreiber-it.ts | 14 ++++++++++---- translations/harbour-fernschreiber-pl.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-ru.ts | 16 ++++++++++++---- translations/harbour-fernschreiber-sv.ts | 14 ++++++++++---- translations/harbour-fernschreiber-zh_CN.ts | 12 ++++++++---- translations/harbour-fernschreiber.ts | 14 ++++++++++---- 12 files changed, 114 insertions(+), 50 deletions(-) diff --git a/qml/pages/SearchChatsPage.qml b/qml/pages/SearchChatsPage.qml index 82fe385..3e0571b 100644 --- a/qml/pages/SearchChatsPage.qml +++ b/qml/pages/SearchChatsPage.qml @@ -175,13 +175,13 @@ Page { onBasicGroupFullInfoUpdated: { if (foundChatListDelegate.isBasicGroup && groupId.toString() === foundChatListDelegate.foundChatInformation.type.basic_group_id.toString()) { - foundChatListItem.secondaryText.text = qsTr("%1 members").arg(Number(groupFullInfo.members.length).toLocaleString(Qt.locale(), "f", 0)); + foundChatListItem.secondaryText.text = qsTr("%1 members", "", groupFullInfo.members.length).arg(Number(groupFullInfo.members.length).toLocaleString(Qt.locale(), "f", 0)); foundChatListItem.tertiaryText.text = Emoji.emojify(groupFullInfo.description, foundChatListItem.tertiaryText.font.pixelSize, "../js/emoji/"); } } onBasicGroupFullInfoReceived: { if (foundChatListDelegate.isBasicGroup && groupId.toString() === foundChatListDelegate.foundChatInformation.type.basic_group_id.toString()) { - foundChatListItem.secondaryText.text = qsTr("%1 members").arg(Number(groupFullInfo.members.length).toLocaleString(Qt.locale(), "f", 0)); + foundChatListItem.secondaryText.text = qsTr("%1 members", "", groupFullInfo.members.length).arg(Number(groupFullInfo.members.length).toLocaleString(Qt.locale(), "f", 0)); foundChatListItem.tertiaryText.text = Emoji.emojify(groupFullInfo.description, foundChatListItem.tertiaryText.font.pixelSize, "../js/emoji/"); } } @@ -189,9 +189,9 @@ Page { onSupergroupFullInfoUpdated: { if (foundChatListDelegate.isSupergroup && groupId.toString() === foundChatListDelegate.foundChatInformation.type.supergroup_id.toString()) { if (foundChatListDelegate.relatedInformation.is_channel) { - foundChatListItem.secondaryText.text = qsTr("%1 subscribers").arg(Number(groupFullInfo.member_count).toLocaleString(Qt.locale(), "f", 0)); + foundChatListItem.secondaryText.text = qsTr("%1 subscribers", "", groupFullInfo.member_count).arg(Number(groupFullInfo.member_count).toLocaleString(Qt.locale(), "f", 0)); } else { - foundChatListItem.secondaryText.text = qsTr("%1 members").arg(Number(groupFullInfo.member_count).toLocaleString(Qt.locale(), "f", 0)); + foundChatListItem.secondaryText.text = qsTr("%1 members", "", groupFullInfo.member_count).arg(Number(groupFullInfo.member_count).toLocaleString(Qt.locale(), "f", 0)); } foundChatListItem.tertiaryText.text = Emoji.emojify(groupFullInfo.description, foundChatListItem.tertiaryText.font.pixelSize, "../js/emoji/"); } @@ -199,9 +199,9 @@ Page { onSupergroupFullInfoReceived: { if (foundChatListDelegate.isSupergroup && groupId.toString() === foundChatListDelegate.foundChatInformation.type.supergroup_id.toString()) { if (foundChatListDelegate.relatedInformation.is_channel) { - foundChatListItem.secondaryText.text = qsTr("%1 subscribers").arg(Number(groupFullInfo.member_count).toLocaleString(Qt.locale(), "f", 0)); + foundChatListItem.secondaryText.text = qsTr("%1 subscribers", "", groupFullInfo.member_count).arg(Number(groupFullInfo.member_count).toLocaleString(Qt.locale(), "f", 0)); } else { - foundChatListItem.secondaryText.text = qsTr("%1 members").arg(Number(groupFullInfo.member_count).toLocaleString(Qt.locale(), "f", 0)); + foundChatListItem.secondaryText.text = qsTr("%1 members", "", groupFullInfo.member_count).arg(Number(groupFullInfo.member_count).toLocaleString(Qt.locale(), "f", 0)); } foundChatListItem.tertiaryText.text = Emoji.emojify(groupFullInfo.description, foundChatListItem.tertiaryText.font.pixelSize, "../js/emoji/"); } diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 4e13c72..7ee069f 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1296,13 +1296,19 @@ Channel Kanal - + %1 members - %1 Mitglied + + %1 Mitglied + %1 Mitglieder + - + %1 subscribers - %1 Abonnent + + %1 Abonnent + %1 Abonnenten + Search Chats diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index aae0a43..71052b7 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1296,13 +1296,19 @@ Channel Channel - + %1 members - %1 member + + %1 member + %1 members + - + %1 subscribers - %1 subscriber + + %1 subscriber + %1 subscribers + Search Chats diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index e5e8efc..a1fa860 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1277,13 +1277,17 @@ Channel Canal - + %1 members - %1 miembros + + %1 miembros + - + %1 subscribers - %1 suscriptores + + %1 suscriptores + Search Chats diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 7f0d06b..4e3d076 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1297,13 +1297,19 @@ Channel - + %1 members - %1 jäsen + + %1 jäsen + + - + %1 subscribers - %1 tilaaja + + %1 tilaaja + + Search Chats diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 32fcc07..a5019b4 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1277,13 +1277,17 @@ Channel - + %1 members - %1 tag + + %1 tag + - + %1 subscribers - %1 feliratkozott + + %1 feliratkozott + Search Chats diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 37072ec..36b4c54 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1296,13 +1296,19 @@ Channel - + %1 members - %1 membro + + %1 membro + + - + %1 subscribers - %1 abbonato + + %1 abbonato + + Search Chats diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index e6389ce..ee55b91 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1315,13 +1315,21 @@ Channel - + %1 members - %1 członek + + %1 członek + + + - + %1 subscribers - %1 subskrybent + + %1 subskrybent + + + Search Chats diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index ccc1434..7784a23 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1315,13 +1315,21 @@ Channel - + %1 members - %1 участников + + %1 участников + + + - + %1 subscribers - %1 подписчиков + + %1 подписчиков + + + Search Chats diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 9d0eeff..03cbe8a 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1296,13 +1296,19 @@ Channel Kanal - + %1 members - %1 medlemmar + + %1 medlemmar + + - + %1 subscribers - %1 prenumeranter + + %1 prenumeranter + + Search Chats diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 424535d..69b6f31 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1277,13 +1277,17 @@ Channel - + %1 members - %1 位成员 + + %1 位成员 + - + %1 subscribers - %1 位订阅者 + + %1 位订阅者 + Search Chats diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 3468e69..14c006b 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1296,13 +1296,19 @@ Channel - + %1 members - %1 member + + %1 member + + - + %1 subscribers - %1 subscriber + + %1 subscriber + + Search Chats From 732af7c33470972b69694abf1f1c1eea39289aca Mon Sep 17 00:00:00 2001 From: carlosgonz <45316884+GNUuser@users.noreply.github.com> Date: Fri, 1 Jan 2021 10:38:36 -0500 Subject: [PATCH 06/59] Update harbour-fernschreiber-es.ts --- translations/harbour-fernschreiber-es.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index a1fa860..6a68cfb 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1279,13 +1279,13 @@ %1 members - + %1 miembros %1 subscribers - + %1 suscriptores @@ -1378,11 +1378,11 @@ Focus text input area after send - + Enfocar el área de entrada de texto después de enviar Focus the text input area after sending a message - + Enfocar el área de entrada de texto después de enviar un mensaje From 04f6c14e864c17723168eac1297de48144951471 Mon Sep 17 00:00:00 2001 From: John Gibbon Date: Fri, 1 Jan 2021 21:06:38 +0100 Subject: [PATCH 07/59] Remove warning if no draft_message is present --- qml/pages/ChatPage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 38c4081..f8ca80d 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -459,7 +459,7 @@ Page { Debug.log("[ChatPage] Received pinned message"); pinnedMessageItem.pinnedMessage = message; } - if (messageId === chatInformation.draft_message.reply_to_message_id) { + if (chatInformation.draft_message && messageId === chatInformation.draft_message.reply_to_message_id) { newMessageInReplyToRow.inReplyToMessage = message; } } From d3eac32216411293aa97127b006cf61de860f64b Mon Sep 17 00:00:00 2001 From: John Gibbon Date: Fri, 1 Jan 2021 21:13:14 +0100 Subject: [PATCH 08/59] Remove warnings about Slider maximumValue not > minimumValue --- qml/components/AudioPreview.qml | 2 +- qml/components/VideoPreview.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qml/components/AudioPreview.qml b/qml/components/AudioPreview.qml index e37c8ac..b8a7d17 100644 --- a/qml/components/AudioPreview.qml +++ b/qml/components/AudioPreview.qml @@ -444,7 +444,7 @@ Item { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: positionText.top minimumValue: 0 - maximumValue: messageAudio.duration ? messageAudio.duration : 0 + maximumValue: messageAudio.duration ? messageAudio.duration : 0.1 stepSize: 1 value: messageAudio.position enabled: messageAudio.seekable diff --git a/qml/components/VideoPreview.qml b/qml/components/VideoPreview.qml index 8015d71..a17fae1 100644 --- a/qml/components/VideoPreview.qml +++ b/qml/components/VideoPreview.qml @@ -482,7 +482,7 @@ Item { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: positionText.top minimumValue: 0 - maximumValue: messageVideo.duration ? messageVideo.duration : 0 + maximumValue: messageVideo.duration ? messageVideo.duration : 0.1 highlighted: videoMessageComponent.highlighted || down stepSize: 1 From d38f56b9fe300ee8aab1db1bf5f6b91ca613fe67 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 2 Jan 2021 00:15:25 +0100 Subject: [PATCH 09/59] Recording Vorbis files works & connected to UI --- harbour-fernschreiber.pro | 2 +- qml/components/VoiceNoteOverlay.qml | 145 ++++++++++++++++++-- qml/pages/ChatPage.qml | 5 + src/fernschreiberutils.cpp | 104 +++++++++++++- src/fernschreiberutils.h | 46 ++++++- src/harbour-fernschreiber.cpp | 1 + translations/harbour-fernschreiber-de.ts | 24 ++++ translations/harbour-fernschreiber-en.ts | 24 ++++ translations/harbour-fernschreiber-es.ts | 24 ++++ translations/harbour-fernschreiber-fi.ts | 24 ++++ translations/harbour-fernschreiber-hu.ts | 24 ++++ translations/harbour-fernschreiber-it.ts | 24 ++++ translations/harbour-fernschreiber-pl.ts | 24 ++++ translations/harbour-fernschreiber-ru.ts | 24 ++++ translations/harbour-fernschreiber-sv.ts | 24 ++++ translations/harbour-fernschreiber-zh_CN.ts | 24 ++++ translations/harbour-fernschreiber.ts | 24 ++++ 17 files changed, 555 insertions(+), 12 deletions(-) diff --git a/harbour-fernschreiber.pro b/harbour-fernschreiber.pro index 4c1e850..5823b5a 100644 --- a/harbour-fernschreiber.pro +++ b/harbour-fernschreiber.pro @@ -16,7 +16,7 @@ CONFIG += sailfishapp sailfishapp_i18n PKGCONFIG += nemonotifications-qt5 zlib -QT += core dbus sql +QT += core dbus sql multimedia DEFINES += QT_STATICPLUGIN diff --git a/qml/components/VoiceNoteOverlay.qml b/qml/components/VoiceNoteOverlay.qml index fb2b92a..66dcb4f 100644 --- a/qml/components/VoiceNoteOverlay.qml +++ b/qml/components/VoiceNoteOverlay.qml @@ -1,5 +1,5 @@ /* - Copyright (C) 2020 Sebastian J. Wolf and other contributors + Copyright (C) 2020-21 Sebastian J. Wolf and other contributors This file is part of Fernschreiber. @@ -18,13 +18,74 @@ */ import QtQuick 2.6 import Sailfish.Silica 1.0 +import WerkWolf.Fernschreiber 1.0 import "../components" import "../js/twemoji.js" as Emoji +import "../js/debug.js" as Debug Item { id: voiceNoteOverlayItem anchors.fill: parent + property int recordingState: fernschreiberUtils.getVoiceNoteRecordingState(); + property int recordingDuration: 0; + + function handleRecordingState() { + switch (recordingState) { + case FernschreiberUtilities.Unavailable: + recordingStateLabel.text = qsTr("Unavailable"); + break; + case FernschreiberUtilities.Stopped: + recordingStateLabel.text = qsTr("Stopped"); + break; + case FernschreiberUtilities.Starting: + recordingStateLabel.text = qsTr("Starting"); + break; + case FernschreiberUtilities.Recording: + recordingStateLabel.text = qsTr("Recording"); + break; + case FernschreiberUtilities.Stopping: + recordingStateLabel.text = qsTr("Stopping"); + break; + } + } + + function getTwoDigitString(numberToBeConverted) { + var numberString = "00"; + if (numberToBeConverted > 0 && numberToBeConverted < 10) { + numberString = "0" + String(numberToBeConverted); + } + if (numberToBeConverted >= 10) { + numberString = String(numberToBeConverted); + } + return numberString; + } + + function handleRecordingDuration() { + var minutes = Math.floor(recordingDuration / 60); + var seconds = recordingDuration % 60; + recordingDurationLabel.text = getTwoDigitString(minutes) + ":" + getTwoDigitString(seconds); + } + + Component.onCompleted: { + handleRecordingState(); + handleRecordingDuration(); + } + + Connections { + target: fernschreiberUtils + onVoiceNoteDurationChanged: { + Debug.log("New duration received: " + duration); + recordingDuration = Math.round(duration / 1000); + handleRecordingDuration(); + } + onVoiceNoteRecordingStateChanged: { + Debug.log("New state received: " + state); + recordingState = state; + handleRecordingState(); + } + } + Rectangle { id: stickerPickerOverlayBackground anchors.fill: parent @@ -52,17 +113,85 @@ Item { text: qsTr("Record a Voice Note") } - Image { - id: recorderImage - source: "image://theme/icon-l-recorder" + Label { + wrapMode: Text.Wrap + width: parent.width - ( 2 * Theme.horizontalPageMargin ) + horizontalAlignment: Text.AlignHCenter + text: qsTr("Press the button to start recording") + font.pixelSize: Theme.fontSizeMedium anchors { horizontalCenter: parent.horizontalCenter } + } - fillMode: Image.PreserveAspectFit - asynchronous: true - width: Theme.itemSizeLarge - height: Theme.itemSizeLarge + Item { + width: Theme.iconSizeExtraLarge + height: Theme.iconSizeExtraLarge + anchors { + horizontalCenter: parent.horizontalCenter + } + Rectangle { + color: Theme.primaryColor + opacity: Theme.opacityOverlay + width: Theme.iconSizeExtraLarge + height: Theme.iconSizeExtraLarge + anchors.centerIn: parent + radius: width / 2 + } + + Rectangle { + id: recordButton + color: "red" + width: Theme.iconSizeExtraLarge * 0.6 + height: Theme.iconSizeExtraLarge * 0.6 + anchors.centerIn: parent + radius: width / 2 + MouseArea { + anchors.fill: parent + onClicked: { + recordButton.visible = false; + fernschreiberUtils.startRecordingVoiceNote(); + } + } + } + + Rectangle { + id: stopButton + visible: !recordButton.visible + color: Theme.overlayBackgroundColor + width: Theme.iconSizeExtraLarge * 0.4 + height: Theme.iconSizeExtraLarge * 0.4 + anchors.centerIn: parent + MouseArea { + anchors.fill: parent + onClicked: { + recordButton.visible = true; + fernschreiberUtils.stopRecordingVoiceNote(); + } + } + } + } + + Label { + id: recordingStateLabel + wrapMode: Text.Wrap + width: parent.width - ( 2 * Theme.horizontalPageMargin ) + horizontalAlignment: Text.AlignHCenter + font.pixelSize: Theme.fontSizeMedium + anchors { + horizontalCenter: parent.horizontalCenter + } + } + + Label { + id: recordingDurationLabel + wrapMode: Text.Wrap + width: parent.width - ( 2 * Theme.horizontalPageMargin ) + horizontalAlignment: Text.AlignHCenter + font.pixelSize: Theme.fontSizeMedium + anchors { + horizontalCenter: parent.horizontalCenter + } } } diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index f5f0aeb..0cdbb6f 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -1145,6 +1145,11 @@ Page { width: parent.width height: active ? parent.height : 0 source: "../components/VoiceNoteOverlay.qml" + onActiveChanged: { + if (!active) { + fernschreiberUtils.stopRecordingVoiceNote(); + } + } } } diff --git a/src/fernschreiberutils.cpp b/src/fernschreiberutils.cpp index b75734a..d079d59 100644 --- a/src/fernschreiberutils.cpp +++ b/src/fernschreiberutils.cpp @@ -1,10 +1,57 @@ -#include "fernschreiberutils.h" +/* + Copyright (C) 2020-21 Sebastian J. Wolf and other contributors + This file is part of Fernschreiber. + + Fernschreiber is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Fernschreiber is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Fernschreiber. If not, see . +*/ + +#include "fernschreiberutils.h" #include #include +#include +#include +#include +#include +#include + +#define DEBUG_MODULE FernschreiberUtils +#include "debuglog.h" FernschreiberUtils::FernschreiberUtils(QObject *parent) : QObject(parent) { + LOG("Initializing audio recorder..."); + + QString temporaryDirectoryPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + + "/harbour-fernschreiber"; + QDir temporaryDirectory(temporaryDirectoryPath); + if (!temporaryDirectory.exists()) { + temporaryDirectory.mkpath(temporaryDirectoryPath); + } + + QAudioEncoderSettings encoderSettings; + encoderSettings.setCodec("audio/vorbis"); + encoderSettings.setChannelCount(1); + encoderSettings.setQuality(QMultimedia::LowQuality); + this->audioRecorder.setEncodingSettings(encoderSettings); + this->audioRecorder.setContainerFormat("ogg"); + this->audioRecorder.setOutputLocation(QUrl::fromLocalFile(temporaryDirectoryPath + "/voicenote.ogg")); + + QMediaRecorder::Status audioRecorderStatus = this->audioRecorder.status(); + this->handleAudioRecorderStatusChanged(audioRecorderStatus); + + connect(&audioRecorder, SIGNAL(durationChanged(qlonglong)), this, SIGNAL(voiceNoteDurationChanged(qlonglong))); + connect(&audioRecorder, SIGNAL(statusChanged(QMediaRecorder::Status)), this, SLOT(handleAudioRecorderStatusChanged(QMediaRecorder::Status))); } @@ -128,3 +175,58 @@ QString FernschreiberUtils::getUserName(const QVariantMap &userInformation) const QString lastName = userInformation.value("last_name").toString(); return QString(firstName + " " + lastName).trimmed(); } + +void FernschreiberUtils::startRecordingVoiceNote() +{ + LOG("Start recording voice note..."); + QString voiceNotePath = this->voiceNotePath(); + LOG("Using temporary file at " << voiceNotePath); + if (QFile::exists(voiceNotePath)) { + LOG("Removing old temporary file..."); + QFile::remove(voiceNotePath); + } + this->audioRecorder.setVolume(1); + this->audioRecorder.record(); +} + +void FernschreiberUtils::stopRecordingVoiceNote() +{ + LOG("Stop recording voice note..."); + this->audioRecorder.stop(); +} + +QString FernschreiberUtils::voiceNotePath() +{ + return this->audioRecorder.outputLocation().toLocalFile(); +} + +FernschreiberUtils::VoiceNoteRecordingState FernschreiberUtils::getVoiceNoteRecordingState() +{ + return this->voiceNoteRecordingState; +} + +void FernschreiberUtils::handleAudioRecorderStatusChanged(QMediaRecorder::Status status) +{ + LOG("Audio recorder status changed:" << status); + switch (status) { + case QMediaRecorder::UnavailableStatus: + case QMediaRecorder::UnloadedStatus: + case QMediaRecorder::LoadingStatus: + this->voiceNoteRecordingState = VoiceNoteRecordingState::Unavailable; + break; + case QMediaRecorder::LoadedStatus: + case QMediaRecorder::PausedStatus: + this->voiceNoteRecordingState = VoiceNoteRecordingState::Stopped; + break; + case QMediaRecorder::StartingStatus: + this->voiceNoteRecordingState = VoiceNoteRecordingState::Starting; + break; + case QMediaRecorder::FinalizingStatus: + this->voiceNoteRecordingState = VoiceNoteRecordingState::Stopping; + break; + case QMediaRecorder::RecordingStatus: + this->voiceNoteRecordingState = VoiceNoteRecordingState::Recording; + break; + } + emit voiceNoteRecordingStateChanged(this->voiceNoteRecordingState); +} diff --git a/src/fernschreiberutils.h b/src/fernschreiberutils.h index 35fc8a0..16e80c3 100644 --- a/src/fernschreiberutils.h +++ b/src/fernschreiberutils.h @@ -1,7 +1,27 @@ +/* + Copyright (C) 2020-21 Sebastian J. Wolf and other contributors + + This file is part of Fernschreiber. + + Fernschreiber is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Fernschreiber is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Fernschreiber. If not, see . +*/ + #ifndef FERNSCHREIBERUTILS_H #define FERNSCHREIBERUTILS_H #include +#include #include "tdlibwrapper.h" class FernschreiberUtils : public QObject @@ -10,12 +30,34 @@ class FernschreiberUtils : public QObject public: explicit FernschreiberUtils(QObject *parent = nullptr); + enum VoiceNoteRecordingState { + Unavailable, + Stopped, + Starting, + Recording, + Stopping + }; + Q_ENUM(VoiceNoteRecordingState) + static QString getMessageShortText(TDLibWrapper *tdLibWrapper, const QVariantMap &messageContent, const bool isChannel, const qlonglong currentUserId, const QVariantMap &messageSender); static QString getUserName(const QVariantMap &userInformation); -signals: + Q_INVOKABLE void startRecordingVoiceNote(); + Q_INVOKABLE void stopRecordingVoiceNote(); + Q_INVOKABLE QString voiceNotePath(); + Q_INVOKABLE VoiceNoteRecordingState getVoiceNoteRecordingState(); + +signals: + void voiceNoteDurationChanged(qlonglong duration); + void voiceNoteRecordingStateChanged(VoiceNoteRecordingState state); + +private slots: + void handleAudioRecorderStatusChanged(QMediaRecorder::Status status); + +private: + QAudioRecorder audioRecorder; + VoiceNoteRecordingState voiceNoteRecordingState; -public slots: }; #endif // FERNSCHREIBERUTILS_H diff --git a/src/harbour-fernschreiber.cpp b/src/harbour-fernschreiber.cpp index 6efdf5d..0852fea 100644 --- a/src/harbour-fernschreiber.cpp +++ b/src/harbour-fernschreiber.cpp @@ -82,6 +82,7 @@ int main(int argc, char *argv[]) FernschreiberUtils *fernschreiberUtils = new FernschreiberUtils(view.data()); context->setContextProperty("fernschreiberUtils", fernschreiberUtils); + qmlRegisterUncreatableType(uri, 1, 0, "FernschreiberUtilities", QString()); DBusAdaptor *dBusAdaptor = tdLibWrapper->getDBusAdaptor(); context->setContextProperty("dBusAdaptor", dBusAdaptor); diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 10db4a5..6894a9e 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1438,6 +1438,30 @@ Record a Voice Note + + Press the button to start recording + + + + Unavailable + + + + Stopped + + + + Starting + + + + Recording + + + + Stopping + + WebPagePreview diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index ffaad43..e474f3f 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1438,6 +1438,30 @@ Record a Voice Note + + Press the button to start recording + + + + Unavailable + + + + Stopped + + + + Starting + + + + Recording + + + + Stopping + + WebPagePreview diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 57c7541..5f812e5 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1417,6 +1417,30 @@ Record a Voice Note + + Press the button to start recording + + + + Unavailable + + + + Stopped + + + + Starting + + + + Recording + + + + Stopping + + WebPagePreview diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 2739023..cb1004c 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1439,6 +1439,30 @@ Record a Voice Note + + Press the button to start recording + + + + Unavailable + + + + Stopped + + + + Starting + + + + Recording + + + + Stopping + + WebPagePreview diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 630f4ae..a160d2d 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1417,6 +1417,30 @@ Record a Voice Note + + Press the button to start recording + + + + Unavailable + + + + Stopped + + + + Starting + + + + Recording + + + + Stopping + + WebPagePreview diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 5c18e4c..d0319bc 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1438,6 +1438,30 @@ Record a Voice Note + + Press the button to start recording + + + + Unavailable + + + + Stopped + + + + Starting + + + + Recording + + + + Stopping + + WebPagePreview diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index dd55b46..fc7f215 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1459,6 +1459,30 @@ Record a Voice Note + + Press the button to start recording + + + + Unavailable + + + + Stopped + + + + Starting + + + + Recording + + + + Stopping + + WebPagePreview diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 0edb938..d3b4699 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1459,6 +1459,30 @@ Record a Voice Note + + Press the button to start recording + + + + Unavailable + + + + Stopped + + + + Starting + + + + Recording + + + + Stopping + + WebPagePreview diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 2a159af..0bbb2e4 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1438,6 +1438,30 @@ Record a Voice Note + + Press the button to start recording + + + + Unavailable + + + + Stopped + + + + Starting + + + + Recording + + + + Stopping + + WebPagePreview diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 44d8a9e..437b5d8 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1417,6 +1417,30 @@ Record a Voice Note + + Press the button to start recording + + + + Unavailable + + + + Stopped + + + + Starting + + + + Recording + + + + Stopping + + WebPagePreview diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index f0b5aa4..5664771 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1438,6 +1438,30 @@ Record a Voice Note + + Press the button to start recording + + + + Unavailable + + + + Stopped + + + + Starting + + + + Recording + + + + Stopping + + WebPagePreview From 473c60345198f7fb8f40dfb6bd4ebad64813f6c3 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 2 Jan 2021 16:10:01 +0100 Subject: [PATCH 10/59] Reorganize title bar, introduce interaction hint --- qml/pages/OverviewPage.qml | 75 ++++++++++++--------- src/appsettings.cpp | 15 +++++ src/appsettings.h | 5 ++ translations/harbour-fernschreiber-de.ts | 4 ++ translations/harbour-fernschreiber-en.ts | 4 ++ translations/harbour-fernschreiber-es.ts | 4 ++ translations/harbour-fernschreiber-fi.ts | 4 ++ translations/harbour-fernschreiber-hu.ts | 4 ++ translations/harbour-fernschreiber-it.ts | 4 ++ translations/harbour-fernschreiber-pl.ts | 4 ++ translations/harbour-fernschreiber-ru.ts | 4 ++ translations/harbour-fernschreiber-sv.ts | 4 ++ translations/harbour-fernschreiber-zh_CN.ts | 4 ++ translations/harbour-fernschreiber.ts | 4 ++ 14 files changed, 109 insertions(+), 30 deletions(-) diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml index 404f0d3..178bc2c 100644 --- a/qml/pages/OverviewPage.qml +++ b/qml/pages/OverviewPage.qml @@ -66,6 +66,13 @@ Page { overviewPage.chatListCreated = true; chatListView.scrollToTop(); updateSecondaryContentTimer.start(); + var remainingInteractionHints = appSettings.remainingInteractionHints; + Debug.log("Remaining interaction hints: " + remainingInteractionHints); + if (remainingInteractionHints > 0) { + interactionHintTimer.start(); + titleInteractionHint.visible = true; + appSettings.remainingInteractionHints = remainingInteractionHints - 1; + } } } @@ -164,7 +171,6 @@ Page { if (chatSearchField.text === "") { chatSearchField.visible = false; pageHeader.visible = true; - searchChatButton.visible = overviewPage.connectionState === TelegramAPI.ConnectionReady; } chatSearchField.focus = false; overviewPage.focus = true; @@ -254,43 +260,34 @@ Page { Row { id: headerRow - width: parent.width - Theme.horizontalPageMargin - - GlassItem { - id: pageStatus - width: Theme.itemSizeMedium - height: Theme.itemSizeMedium - color: "red" - falloffRadius: 0.1 - radius: 0.2 - cache: false - } + width: parent.width PageHeader { id: pageHeader title: qsTr("Fernschreiber") - width: visible ? ( parent.width - pageStatus.width - searchChatButton.width ) : 0 + leftMargin: Theme.itemSizeMedium opacity: visible ? 1 : 0 Behavior on opacity { FadeAnimation {} } - } - IconButton { - id: searchChatButton - width: visible ? height : 0 - opacity: visible ? 1 : 0 - Behavior on opacity { NumberAnimation {} } - anchors.verticalCenter: parent.verticalCenter - icon { - source: "image://theme/icon-m-search?" + Theme.highlightColor - asynchronous: true + GlassItem { + id: pageStatus + width: Theme.itemSizeMedium + height: Theme.itemSizeMedium + color: "red" + falloffRadius: 0.1 + radius: 0.2 + cache: false } - visible: overviewPage.connectionState === TelegramAPI.ConnectionReady - onClicked: { - chatSearchField.focus = true; - chatSearchField.visible = true; - pageHeader.visible = false; - searchChatButton.visible = false; + + MouseArea { + anchors.fill: parent + onClicked: { + chatSearchField.focus = true; + chatSearchField.visible = true; + pageHeader.visible = false; + } } + } SearchField { @@ -298,7 +295,7 @@ Page { visible: false opacity: visible ? 1 : 0 Behavior on opacity { FadeAnimation {} } - width: visible ? ( parent.width - pageStatus.width ) : 0 + width: parent.width height: pageHeader.height placeholderText: qsTr("Filter your chats...") canHide: text === "" @@ -372,4 +369,22 @@ Page { } } } + + Timer { + id: interactionHintTimer + running: false + interval: 4000 + onTriggered: { + titleInteractionHint.visible = false; + } + } + + InteractionHintLabel { + id: titleInteractionHint + text: qsTr("Tap on the title bar to filter your chats") + visible: false + Behavior on opacity { FadeAnimation {} } + opacity: visible ? 1 : 0 + } + } diff --git a/src/appsettings.cpp b/src/appsettings.cpp index 0924a42..f71a5dd 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -29,6 +29,7 @@ namespace { const QString KEY_NOTIFICATION_TURNS_DISPLAY_ON("notificationTurnsDisplayOn"); const QString KEY_NOTIFICATION_FEEDBACK("notificationFeedback"); const QString KEY_STORAGE_OPTIMIZER("storageOptimizer"); + const QString KEY_REMAINING_INTERACTION_HINTS("remainingInteractionHints"); } AppSettings::AppSettings(QObject *parent) : QObject(parent), settings("harbour-fernschreiber", "settings") @@ -146,3 +147,17 @@ void AppSettings::setStorageOptimizer(bool enable) emit storageOptimizerChanged(); } } + +int AppSettings::remainingInteractionHints() const +{ + return settings.value(KEY_REMAINING_INTERACTION_HINTS, 3).toInt(); +} + +void AppSettings::setRemainingInteractionHints(int remainingHints) +{ + if (remainingInteractionHints() != remainingHints) { + LOG(KEY_REMAINING_INTERACTION_HINTS << remainingHints); + settings.setValue(KEY_REMAINING_INTERACTION_HINTS, remainingHints); + emit remainingInteractionHintsChanged(); + } +} diff --git a/src/appsettings.h b/src/appsettings.h index a040e60..bc840e6 100644 --- a/src/appsettings.h +++ b/src/appsettings.h @@ -31,6 +31,7 @@ class AppSettings : public QObject { Q_PROPERTY(bool notificationTurnsDisplayOn READ notificationTurnsDisplayOn WRITE setNotificationTurnsDisplayOn NOTIFY notificationTurnsDisplayOnChanged) Q_PROPERTY(NotificationFeedback notificationFeedback READ notificationFeedback WRITE setNotificationFeedback NOTIFY notificationFeedbackChanged) Q_PROPERTY(bool storageOptimizer READ storageOptimizer WRITE setStorageOptimizer NOTIFY storageOptimizerChanged) + Q_PROPERTY(int remainingInteractionHints READ remainingInteractionHints WRITE setRemainingInteractionHints NOTIFY remainingInteractionHintsChanged) public: enum NotificationFeedback { @@ -67,6 +68,9 @@ public: bool storageOptimizer() const; void setStorageOptimizer(bool enable); + int remainingInteractionHints() const; + void setRemainingInteractionHints(int remainingHints); + signals: void sendByEnterChanged(); void focusTextAreaAfterSendChanged(); @@ -76,6 +80,7 @@ signals: void notificationTurnsDisplayOnChanged(); void notificationFeedbackChanged(); void storageOptimizerChanged(); + void remainingInteractionHintsChanged(); private: QSettings settings; diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 7ee069f..6f48ced 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1080,6 +1080,10 @@ Download failed. Download fehlgeschlagen. + + Tap on the title bar to filter your chats + Tippen Sie auf die Titelleiste, um Ihre Chats zu filtern + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 71052b7..80176dd 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1080,6 +1080,10 @@ Download failed. Download failed. + + Tap on the title bar to filter your chats + Tap on the title bar to filter your chats + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index a1fa860..fb92263 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1069,6 +1069,10 @@ Download failed. Error al bajar + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 4e3d076..28a7e7b 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1081,6 +1081,10 @@ Download failed. Lataus epäonnistui. + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index a5019b4..8e8ae19 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1069,6 +1069,10 @@ Download failed. A letöltés nem sikerült. + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 36b4c54..a9da297 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1080,6 +1080,10 @@ Download failed. Download non riuscito. + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index ee55b91..efbb142 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1091,6 +1091,10 @@ Download failed. + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 7784a23..98cbd44 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1091,6 +1091,10 @@ Download failed. Ошибка скачивания. + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 03cbe8a..63861bb 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1080,6 +1080,10 @@ Download failed. Nerladdning misslyckades. + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 69b6f31..97d8fcd 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1069,6 +1069,10 @@ Download failed. 下载失败。 + + Tap on the title bar to filter your chats + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 14c006b..3e6ccf4 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1080,6 +1080,10 @@ Download failed. Download failed. + + Tap on the title bar to filter your chats + + PinnedMessageItem From 5213084fb1c641c1aa2d12031b880aba10d573e9 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 2 Jan 2021 17:22:09 +0100 Subject: [PATCH 11/59] Sending voice notes seems to work... --- qml/components/VoiceNoteOverlay.qml | 22 ++++++++++++++-- qml/pages/ChatPage.qml | 14 ++++++++--- src/fernschreiberutils.cpp | 23 +++++++++++------ src/fernschreiberutils.h | 5 +++- src/tdlibwrapper.cpp | 24 ++++++++++++++++++ src/tdlibwrapper.h | 1 + translations/harbour-fernschreiber-de.ts | 24 ++++++++++++------ translations/harbour-fernschreiber-en.ts | 28 +++++++++++++-------- translations/harbour-fernschreiber-es.ts | 16 +++++++++--- translations/harbour-fernschreiber-fi.ts | 16 +++++++++--- translations/harbour-fernschreiber-hu.ts | 16 +++++++++--- translations/harbour-fernschreiber-it.ts | 16 +++++++++--- translations/harbour-fernschreiber-pl.ts | 16 +++++++++--- translations/harbour-fernschreiber-ru.ts | 16 +++++++++--- translations/harbour-fernschreiber-sv.ts | 16 +++++++++--- translations/harbour-fernschreiber-zh_CN.ts | 16 +++++++++--- translations/harbour-fernschreiber.ts | 16 +++++++++--- 17 files changed, 218 insertions(+), 67 deletions(-) diff --git a/qml/components/VoiceNoteOverlay.qml b/qml/components/VoiceNoteOverlay.qml index 66dcb4f..423bdfb 100644 --- a/qml/components/VoiceNoteOverlay.qml +++ b/qml/components/VoiceNoteOverlay.qml @@ -29,14 +29,15 @@ Item { property int recordingState: fernschreiberUtils.getVoiceNoteRecordingState(); property int recordingDuration: 0; + property bool recordingDone: false; function handleRecordingState() { switch (recordingState) { case FernschreiberUtilities.Unavailable: recordingStateLabel.text = qsTr("Unavailable"); break; - case FernschreiberUtilities.Stopped: - recordingStateLabel.text = qsTr("Stopped"); + case FernschreiberUtilities.Ready: + recordingStateLabel.text = qsTr("Ready"); break; case FernschreiberUtilities.Starting: recordingStateLabel.text = qsTr("Starting"); @@ -167,6 +168,7 @@ Item { onClicked: { recordButton.visible = true; fernschreiberUtils.stopRecordingVoiceNote(); + recordingDone = true; } } } @@ -194,6 +196,22 @@ Item { } } + Button { + visible: recordingDone + anchors { + horizontalCenter: parent.horizontalCenter + } + text: qsTr("Use recording") + onClicked: { + attachmentOptionsRow.isNeeded = false; + attachmentPreviewRow.isVoiceNote = true; + attachmentPreviewRow.attachmentDescription = qsTr("Voice Note (%1)").arg(recordingDurationLabel.text); + attachmentPreviewRow.visible = true; + controlSendButton(); + voiceNoteOverlayLoader.active = false; + } + } + } } diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 0cdbb6f..b652072 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -211,14 +211,17 @@ Page { attachmentPreviewRow.isPicture = false; attachmentPreviewRow.isVideo = false; attachmentPreviewRow.isDocument = false; + attachmentPreviewRow.isVoiceNote = false; attachmentPreviewRow.fileProperties = {}; + attachmentPreviewRow.attachmentDescription = ""; } function controlSendButton() { if (newMessageTextField.text.length !== 0 || attachmentPreviewRow.isPicture || attachmentPreviewRow.isDocument - || attachmentPreviewRow.isVideo) { + || attachmentPreviewRow.isVideo + || attachmentPreviewRow.isVoiceNote) { newMessageSendButton.enabled = true; } else { newMessageSendButton.enabled = false; @@ -239,6 +242,9 @@ Page { if (attachmentPreviewRow.isDocument) { tdLibWrapper.sendDocumentMessage(chatInformation.id, attachmentPreviewRow.fileProperties.filePath, newMessageTextField.text, newMessageColumn.replyToMessageId); } + if (attachmentPreviewRow.isVoiceNote) { + tdLibWrapper.sendVoiceNoteMessage(chatInformation.id, fernschreiberUtils.voiceNotePath(), newMessageTextField.text, newMessageColumn.replyToMessageId); + } clearAttachmentPreviewRow(); } else { tdLibWrapper.sendTextMessage(chatInformation.id, newMessageTextField.text, newMessageColumn.replyToMessageId); @@ -1300,7 +1306,9 @@ Page { property bool isPicture: false; property bool isVideo: false; property bool isDocument: false; + property bool isVoiceNote: false; property var fileProperties:({}); + property string attachmentDescription: ""; IconButton { id: removeAttachmentsIconButton @@ -1327,13 +1335,13 @@ Page { Label { id: attachmentPreviewText font.pixelSize: Theme.fontSizeSmall - text: typeof attachmentPreviewRow.fileProperties !== "undefined" ? attachmentPreviewRow.fileProperties.fileName || "" : ""; + text: attachmentPreviewRow.isVoiceNote ? attachmentPreviewRow.attachmentDescription : ( typeof attachmentPreviewRow.fileProperties !== "undefined" ? attachmentPreviewRow.fileProperties.fileName || "" : "" ); anchors.verticalCenter: parent.verticalCenter maximumLineCount: 1 truncationMode: TruncationMode.Fade color: Theme.secondaryColor - visible: attachmentPreviewRow.isDocument + visible: attachmentPreviewRow.isDocument || attachmentPreviewRow.isVoiceNote } } diff --git a/src/fernschreiberutils.cpp b/src/fernschreiberutils.cpp index d079d59..0d56554 100644 --- a/src/fernschreiberutils.cpp +++ b/src/fernschreiberutils.cpp @@ -55,6 +55,11 @@ FernschreiberUtils::FernschreiberUtils(QObject *parent) : QObject(parent) } +FernschreiberUtils::~FernschreiberUtils() +{ + this->cleanUp(); +} + QString FernschreiberUtils::getMessageShortText(TDLibWrapper *tdLibWrapper, const QVariantMap &messageContent, const bool isChannel, const qlonglong currentUserId, const QVariantMap &messageSender) { if (messageContent.isEmpty()) { @@ -179,12 +184,7 @@ QString FernschreiberUtils::getUserName(const QVariantMap &userInformation) void FernschreiberUtils::startRecordingVoiceNote() { LOG("Start recording voice note..."); - QString voiceNotePath = this->voiceNotePath(); - LOG("Using temporary file at " << voiceNotePath); - if (QFile::exists(voiceNotePath)) { - LOG("Removing old temporary file..."); - QFile::remove(voiceNotePath); - } + this->cleanUp(); this->audioRecorder.setVolume(1); this->audioRecorder.record(); } @@ -216,7 +216,7 @@ void FernschreiberUtils::handleAudioRecorderStatusChanged(QMediaRecorder::Status break; case QMediaRecorder::LoadedStatus: case QMediaRecorder::PausedStatus: - this->voiceNoteRecordingState = VoiceNoteRecordingState::Stopped; + this->voiceNoteRecordingState = VoiceNoteRecordingState::Ready; break; case QMediaRecorder::StartingStatus: this->voiceNoteRecordingState = VoiceNoteRecordingState::Starting; @@ -230,3 +230,12 @@ void FernschreiberUtils::handleAudioRecorderStatusChanged(QMediaRecorder::Status } emit voiceNoteRecordingStateChanged(this->voiceNoteRecordingState); } + +void FernschreiberUtils::cleanUp() +{ + QString voiceNotePath = this->voiceNotePath(); + if (QFile::exists(voiceNotePath)) { + LOG("Removing old temporary file..."); + QFile::remove(voiceNotePath); + } +} diff --git a/src/fernschreiberutils.h b/src/fernschreiberutils.h index 16e80c3..74d7378 100644 --- a/src/fernschreiberutils.h +++ b/src/fernschreiberutils.h @@ -29,10 +29,11 @@ class FernschreiberUtils : public QObject Q_OBJECT public: explicit FernschreiberUtils(QObject *parent = nullptr); + ~FernschreiberUtils(); enum VoiceNoteRecordingState { Unavailable, - Stopped, + Ready, Starting, Recording, Stopping @@ -58,6 +59,8 @@ private: QAudioRecorder audioRecorder; VoiceNoteRecordingState voiceNoteRecordingState; + void cleanUp(); + }; #endif // FERNSCHREIBERUTILS_H diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index fe436c8..a791319 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -473,6 +473,30 @@ void TDLibWrapper::sendDocumentMessage(const QString &chatId, const QString &fil this->sendRequest(requestObject); } +void TDLibWrapper::sendVoiceNoteMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId) +{ + LOG("Sending voice note message" << chatId << filePath << message << replyToMessageId); + QVariantMap requestObject; + requestObject.insert(_TYPE, "sendMessage"); + requestObject.insert(CHAT_ID, chatId); + if (replyToMessageId != "0") { + requestObject.insert("reply_to_message_id", replyToMessageId); + } + QVariantMap inputMessageContent; + inputMessageContent.insert(_TYPE, "inputMessageVoiceNote"); + QVariantMap formattedText; + formattedText.insert("text", message); + formattedText.insert(_TYPE, "formattedText"); + inputMessageContent.insert("caption", formattedText); + QVariantMap documentInputFile; + documentInputFile.insert(_TYPE, "inputFileLocal"); + documentInputFile.insert("path", filePath); + inputMessageContent.insert("voice_note", documentInputFile); + + requestObject.insert("input_message_content", inputMessageContent); + this->sendRequest(requestObject); +} + void TDLibWrapper::sendStickerMessage(const QString &chatId, const QString &fileId, const QString &replyToMessageId) { LOG("Sending sticker message" << chatId << fileId << replyToMessageId); diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index c24941b..026bb69 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -139,6 +139,7 @@ public: Q_INVOKABLE void sendPhotoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendVideoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendDocumentMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); + Q_INVOKABLE void sendVoiceNoteMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendStickerMessage(const QString &chatId, const QString &fileId, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendPollMessage(const QString &chatId, const QString &question, const QVariantList &options, bool anonymous, int correctOption, bool multiple, const QString &replyToMessageId = "0"); Q_INVOKABLE void forwardMessages(const QString &chatId, const QString &fromChatId, const QVariantList &messageIds, bool sendCopy, bool removeCaption); diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 6894a9e..6f36201 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1436,31 +1436,39 @@ VoiceNoteOverlay Record a Voice Note - + Eine Sprachnachricht aufzeichnen Press the button to start recording - + Drücken Sie den Knopf, um die Aufzeichnung zu starten Unavailable - + Nicht verfügbar - Stopped - + Ready + Bereit Starting - + Startet Recording - + Zeichnet auf Stopping - + Stoppt + + + Use recording + Aufzeichnung verwenden + + + Voice Note (%1) + Sprachnachricht (%1) diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index e474f3f..d7e1769 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1436,31 +1436,39 @@ VoiceNoteOverlay Record a Voice Note - + Record a Voice Note Press the button to start recording - + Press the button to start recording Unavailable - - - - Stopped - + Unavailable Starting - + Starting Recording - + Recording Stopping - + Stopping + + + Use recording + Use recording + + + Voice Note (%1) + Voice Note (%1) + + + Ready + Ready diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 5f812e5..75b4911 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1425,10 +1425,6 @@ Unavailable - - Stopped - - Starting @@ -1441,6 +1437,18 @@ Stopping + + Use recording + + + + Voice Note (%1) + + + + Ready + + WebPagePreview diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index cb1004c..e2eaba2 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1447,10 +1447,6 @@ Unavailable - - Stopped - - Starting @@ -1463,6 +1459,18 @@ Stopping + + Use recording + + + + Voice Note (%1) + + + + Ready + + WebPagePreview diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index a160d2d..ed24a74 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1425,10 +1425,6 @@ Unavailable - - Stopped - - Starting @@ -1441,6 +1437,18 @@ Stopping + + Use recording + + + + Voice Note (%1) + + + + Ready + + WebPagePreview diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index d0319bc..7bc968a 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1446,10 +1446,6 @@ Unavailable - - Stopped - - Starting @@ -1462,6 +1458,18 @@ Stopping + + Use recording + + + + Voice Note (%1) + + + + Ready + + WebPagePreview diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index fc7f215..b6ba872 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1467,10 +1467,6 @@ Unavailable - - Stopped - - Starting @@ -1483,6 +1479,18 @@ Stopping + + Use recording + + + + Voice Note (%1) + + + + Ready + + WebPagePreview diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index d3b4699..68f8e57 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1467,10 +1467,6 @@ Unavailable - - Stopped - - Starting @@ -1483,6 +1479,18 @@ Stopping + + Use recording + + + + Voice Note (%1) + + + + Ready + + WebPagePreview diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 0bbb2e4..81e5a0a 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1446,10 +1446,6 @@ Unavailable - - Stopped - - Starting @@ -1462,6 +1458,18 @@ Stopping + + Use recording + + + + Voice Note (%1) + + + + Ready + + WebPagePreview diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 437b5d8..fa3ccfe 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1425,10 +1425,6 @@ Unavailable - - Stopped - - Starting @@ -1441,6 +1437,18 @@ Stopping + + Use recording + + + + Voice Note (%1) + + + + Ready + + WebPagePreview diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 5664771..74e0ed6 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1446,10 +1446,6 @@ Unavailable - - Stopped - - Starting @@ -1462,6 +1458,18 @@ Stopping + + Use recording + + + + Voice Note (%1) + + + + Ready + + WebPagePreview From be404d0e55eb6367c86338e37675afd848b3de22 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 2 Jan 2021 18:08:33 +0100 Subject: [PATCH 12/59] Put attachment row in a Flickable --- qml/components/VoiceNoteOverlay.qml | 2 +- qml/pages/ChatPage.qml | 211 +++++++++++++++------------- 2 files changed, 116 insertions(+), 97 deletions(-) diff --git a/qml/components/VoiceNoteOverlay.qml b/qml/components/VoiceNoteOverlay.qml index 423bdfb..aed1e53 100644 --- a/qml/components/VoiceNoteOverlay.qml +++ b/qml/components/VoiceNoteOverlay.qml @@ -203,7 +203,7 @@ Item { } text: qsTr("Use recording") onClicked: { - attachmentOptionsRow.isNeeded = false; + attachmentOptionsFlickable.isNeeded = false; attachmentPreviewRow.isVoiceNote = true; attachmentPreviewRow.attachmentDescription = qsTr("Voice Note (%1)").arg(recordingDurationLabel.text); attachmentPreviewRow.visible = true; diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index b652072..91a1c37 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -1120,7 +1120,7 @@ Page { Debug.log("Sticker picked: " + stickerId); tdLibWrapper.sendStickerMessage(chatInformation.id, stickerId); stickerPickerLoader.active = false; - attachmentOptionsRow.isNeeded = false; + attachmentOptionsFlickable.isNeeded = false; } } @@ -1197,104 +1197,123 @@ Page { visible: false } - Row { - id: attachmentOptionsRow + Flickable { + id: attachmentOptionsFlickable + property bool isNeeded: false - visible: height > 0 - height: isNeeded ? implicitHeight : 0 - anchors.right: parent.right + + onIsNeededChanged: { + console.log("HÖHE: " + attachmentOptionsRow.height); + } + width: parent.width - layoutDirection: Qt.RightToLeft - spacing: Theme.paddingMedium - clip: true + height: isNeeded ? attachmentOptionsRow.height : 0 Behavior on height { SmoothedAnimation { duration: 200 } } - IconButton { - visible: chatPage.hasSendPrivilege("can_send_media_messages") - icon.source: "image://theme/icon-m-image" - onClicked: { - var picker = pageStack.push("Sailfish.Pickers.ImagePickerPage", { - allowedOrientations: chatPage.allowedOrientations - }) - picker.selectedContentPropertiesChanged.connect(function(){ - attachmentOptionsRow.isNeeded = false; - Debug.log("Selected document: ", picker.selectedContentProperties.filePath ); - attachmentPreviewRow.fileProperties = picker.selectedContentProperties; - attachmentPreviewRow.isPicture = true; - attachmentPreviewRow.visible = true; - controlSendButton(); - }) - } - } - IconButton { - visible: chatPage.hasSendPrivilege("can_send_media_messages") - icon.source: "image://theme/icon-m-video" - onClicked: { - var picker = pageStack.push("Sailfish.Pickers.VideoPickerPage", { - allowedOrientations: chatPage.allowedOrientations - }) - picker.selectedContentPropertiesChanged.connect(function(){ - attachmentOptionsRow.isNeeded = false; - Debug.log("Selected video: ", picker.selectedContentProperties.filePath ); - attachmentPreviewRow.fileProperties = picker.selectedContentProperties; - attachmentPreviewRow.isVideo = true; - attachmentPreviewRow.visible = true; - controlSendButton(); - }) - } - } - IconButton { - visible: chatPage.hasSendPrivilege("can_send_media_messages") - icon.source: "image://theme/icon-m-mic" - icon.sourceSize { - width: Theme.iconSizeMedium - height: Theme.iconSizeMedium - } - highlighted: down || voiceNoteOverlayLoader.active - onClicked: { - voiceNoteOverlayLoader.active = !voiceNoteOverlayLoader.active; - stickerPickerLoader.active = false; - } - } - IconButton { - visible: chatPage.hasSendPrivilege("can_send_media_messages") - icon.source: "image://theme/icon-m-document" - onClicked: { - var picker = pageStack.push("Sailfish.Pickers.FilePickerPage", { - allowedOrientations: chatPage.allowedOrientations - }) - picker.selectedContentPropertiesChanged.connect(function(){ - attachmentOptionsRow.isNeeded = false; - Debug.log("Selected document: ", picker.selectedContentProperties.filePath ); - attachmentPreviewRow.fileProperties = picker.selectedContentProperties; - attachmentPreviewRow.isDocument = true; - attachmentPreviewRow.visible = true; - controlSendButton(); - }) - } - } - IconButton { - visible: chatPage.hasSendPrivilege("can_send_other_messages") - icon.source: "../../images/icon-m-sticker.svg" - icon.sourceSize { - width: Theme.iconSizeMedium - height: Theme.iconSizeMedium - } - highlighted: down || stickerPickerLoader.active - onClicked: { - stickerPickerLoader.active = !stickerPickerLoader.active; - voiceNoteOverlayLoader.active = false; - } - } - IconButton { - visible: !(chatPage.isPrivateChat || chatPage.isSecretChat) && chatPage.hasSendPrivilege("can_send_polls") - icon.source: "image://theme/icon-m-question" - onClicked: { - pageStack.push(Qt.resolvedUrl("../pages/PollCreationPage.qml"), { "chatId" : chatInformation.id, groupName: chatInformation.title}); - attachmentOptionsRow.isNeeded = false; + visible: height > 0 + contentHeight: attachmentOptionsRow.height + contentWidth: Math.max(parent.width, attachmentOptionsRow.width) + clip: true + + Row { + id: attachmentOptionsRow + + height: attachImageIconButton.height + + anchors.right: parent.right + layoutDirection: Qt.RightToLeft + spacing: Theme.paddingMedium + + IconButton { + id: attachImageIconButton + visible: chatPage.hasSendPrivilege("can_send_media_messages") + icon.source: "image://theme/icon-m-image" + onClicked: { + var picker = pageStack.push("Sailfish.Pickers.ImagePickerPage", { + allowedOrientations: chatPage.allowedOrientations + }) + picker.selectedContentPropertiesChanged.connect(function(){ + attachmentOptionsFlickable.isNeeded = false; + Debug.log("Selected document: ", picker.selectedContentProperties.filePath ); + attachmentPreviewRow.fileProperties = picker.selectedContentProperties; + attachmentPreviewRow.isPicture = true; + attachmentPreviewRow.visible = true; + controlSendButton(); + }) + } + } + IconButton { + visible: chatPage.hasSendPrivilege("can_send_media_messages") + icon.source: "image://theme/icon-m-video" + onClicked: { + var picker = pageStack.push("Sailfish.Pickers.VideoPickerPage", { + allowedOrientations: chatPage.allowedOrientations + }) + picker.selectedContentPropertiesChanged.connect(function(){ + attachmentOptionsFlickable.isNeeded = false; + Debug.log("Selected video: ", picker.selectedContentProperties.filePath ); + attachmentPreviewRow.fileProperties = picker.selectedContentProperties; + attachmentPreviewRow.isVideo = true; + attachmentPreviewRow.visible = true; + controlSendButton(); + }) + } + } + IconButton { + visible: chatPage.hasSendPrivilege("can_send_media_messages") + icon.source: "image://theme/icon-m-mic" + icon.sourceSize { + width: Theme.iconSizeMedium + height: Theme.iconSizeMedium + } + highlighted: down || voiceNoteOverlayLoader.active + onClicked: { + voiceNoteOverlayLoader.active = !voiceNoteOverlayLoader.active; + stickerPickerLoader.active = false; + } + } + IconButton { + visible: chatPage.hasSendPrivilege("can_send_media_messages") + icon.source: "image://theme/icon-m-document" + onClicked: { + var picker = pageStack.push("Sailfish.Pickers.FilePickerPage", { + allowedOrientations: chatPage.allowedOrientations + }) + picker.selectedContentPropertiesChanged.connect(function(){ + attachmentOptionsFlickable.isNeeded = false; + Debug.log("Selected document: ", picker.selectedContentProperties.filePath ); + attachmentPreviewRow.fileProperties = picker.selectedContentProperties; + attachmentPreviewRow.isDocument = true; + attachmentPreviewRow.visible = true; + controlSendButton(); + }) + } + } + IconButton { + visible: chatPage.hasSendPrivilege("can_send_other_messages") + icon.source: "../../images/icon-m-sticker.svg" + icon.sourceSize { + width: Theme.iconSizeMedium + height: Theme.iconSizeMedium + } + highlighted: down || stickerPickerLoader.active + onClicked: { + stickerPickerLoader.active = !stickerPickerLoader.active; + voiceNoteOverlayLoader.active = false; + } + } + IconButton { + visible: !(chatPage.isPrivateChat || chatPage.isSecretChat) && chatPage.hasSendPrivilege("can_send_polls") + icon.source: "image://theme/icon-m-question" + onClicked: { + pageStack.push(Qt.resolvedUrl("../pages/PollCreationPage.qml"), { "chatId" : chatInformation.id, groupName: chatInformation.title}); + attachmentOptionsFlickable.isNeeded = false; + } } } + } + Row { id: attachmentPreviewRow visible: false @@ -1564,17 +1583,17 @@ Page { IconButton { id: attachmentIconButton - icon.source: "image://theme/icon-m-attach?" + (attachmentOptionsRow.isNeeded ? Theme.highlightColor : Theme.primaryColor) + icon.source: "image://theme/icon-m-attach?" + (attachmentOptionsFlickable.isNeeded ? Theme.highlightColor : Theme.primaryColor) anchors.bottom: parent.bottom anchors.bottomMargin: Theme.paddingSmall enabled: !attachmentPreviewRow.visible onClicked: { - if (attachmentOptionsRow.isNeeded) { - attachmentOptionsRow.isNeeded = false; + if (attachmentOptionsFlickable.isNeeded) { + attachmentOptionsFlickable.isNeeded = false; stickerPickerLoader.active = false; voiceNoteOverlayLoader.active = false; } else { - attachmentOptionsRow.isNeeded = true; + attachmentOptionsFlickable.isNeeded = true; } } } From 1b83fddfe6166dc70e1406acd1b1c3ee27cdc548 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 2 Jan 2021 19:57:36 +0100 Subject: [PATCH 13/59] No strange debug logging ;) --- qml/pages/ChatPage.qml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 91a1c37..0cb5641 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -1202,10 +1202,6 @@ Page { property bool isNeeded: false - onIsNeededChanged: { - console.log("HÖHE: " + attachmentOptionsRow.height); - } - width: parent.width height: isNeeded ? attachmentOptionsRow.height : 0 Behavior on height { SmoothedAnimation { duration: 200 } } From f26820ef7594b5c857ee59753898e0a7db3ed937 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 2 Jan 2021 20:06:53 +0100 Subject: [PATCH 14/59] AboutPage: React properly if no profile pic is defined, fixes #264 --- qml/pages/AboutPage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qml/pages/AboutPage.qml b/qml/pages/AboutPage.qml index 539fc59..0ef2397 100644 --- a/qml/pages/AboutPage.qml +++ b/qml/pages/AboutPage.qml @@ -176,7 +176,7 @@ Page { } ProfileThumbnail { - photoData: aboutPage.userInformation.profile_photo.small + photoData: ((typeof aboutPage.userInformation.profile_photo !== "undefined") ? aboutPage.userInformation.profile_photo.small : {}) width: Theme.itemSizeExtraLarge height: Theme.itemSizeExtraLarge replacementStringHint: aboutPage.userInformation.first_name + " " + aboutPage.userInformation.last_name From 54602d8a6c1ed6fe9249b7f361ca3f7e5d3d08c0 Mon Sep 17 00:00:00 2001 From: John Gibbon Date: Sat, 2 Jan 2021 19:55:41 +0100 Subject: [PATCH 15/59] Remove obsolete Row; Enable animations; Change Hint --- qml/pages/OverviewPage.qml | 110 ++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 57 deletions(-) diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml index 178bc2c..7b3440a 100644 --- a/qml/pages/OverviewPage.qml +++ b/qml/pages/OverviewPage.qml @@ -70,7 +70,7 @@ Page { Debug.log("Remaining interaction hints: " + remainingInteractionHints); if (remainingInteractionHints > 0) { interactionHintTimer.start(); - titleInteractionHint.visible = true; + titleInteractionHint.opacity = 1.0; appSettings.remainingInteractionHints = remainingInteractionHints - 1; } } @@ -169,8 +169,8 @@ Page { function resetFocus() { if (chatSearchField.text === "") { - chatSearchField.visible = false; - pageHeader.visible = true; + chatSearchField.opacity = 0.0; + pageHeader.opacity = 1.0; } chatSearchField.focus = false; overviewPage.focus = true; @@ -258,68 +258,62 @@ Page { } } - Row { - id: headerRow - width: parent.width - - PageHeader { - id: pageHeader - title: qsTr("Fernschreiber") - leftMargin: Theme.itemSizeMedium - opacity: visible ? 1 : 0 - Behavior on opacity { FadeAnimation {} } - - GlassItem { - id: pageStatus - width: Theme.itemSizeMedium - height: Theme.itemSizeMedium - color: "red" - falloffRadius: 0.1 - radius: 0.2 - cache: false - } - - MouseArea { - anchors.fill: parent - onClicked: { - chatSearchField.focus = true; - chatSearchField.visible = true; - pageHeader.visible = false; - } - } + PageHeader { + id: pageHeader + title: qsTr("Fernschreiber") + leftMargin: Theme.itemSizeMedium + visible: opacity > 0 + Behavior on opacity { FadeAnimation {} } + GlassItem { + id: pageStatus + width: Theme.itemSizeMedium + height: Theme.itemSizeMedium + color: "red" + falloffRadius: 0.1 + radius: 0.2 + cache: false } - SearchField { - id: chatSearchField - visible: false - opacity: visible ? 1 : 0 - Behavior on opacity { FadeAnimation {} } - width: parent.width - height: pageHeader.height - placeholderText: qsTr("Filter your chats...") - canHide: text === "" - - onTextChanged: { - searchChatTimer.restart(); - } - - onHideClicked: { - resetFocus(); - } - - EnterKey.iconSource: "image://theme/icon-m-enter-close" - EnterKey.onClicked: { - resetFocus(); + MouseArea { + anchors.fill: parent + onClicked: { + chatSearchField.focus = true; + chatSearchField.opacity = 1.0; + pageHeader.opacity = 0.0; } } } + SearchField { + id: chatSearchField + visible: opacity > 0 + opacity: 0 + Behavior on opacity { FadeAnimation {} } + width: parent.width + height: pageHeader.height + placeholderText: qsTr("Filter your chats...") + canHide: text === "" + + onTextChanged: { + searchChatTimer.restart(); + } + + onHideClicked: { + resetFocus(); + } + + EnterKey.iconSource: "image://theme/icon-m-enter-close" + EnterKey.onClicked: { + resetFocus(); + } + } + SilicaListView { id: chatListView anchors { - top: headerRow.bottom + top: pageHeader.bottom bottom: parent.bottom left: parent.left right: parent.right @@ -375,16 +369,18 @@ Page { running: false interval: 4000 onTriggered: { - titleInteractionHint.visible = false; + titleInteractionHint.opacity = 0.0; } } InteractionHintLabel { id: titleInteractionHint text: qsTr("Tap on the title bar to filter your chats") - visible: false + visible: opacity > 0 + invert: true + anchors.fill: parent Behavior on opacity { FadeAnimation {} } - opacity: visible ? 1 : 0 + opacity: 0 } } From cc0cc94dc5c9d42a57e1e40bedcff35af973e37a Mon Sep 17 00:00:00 2001 From: John Gibbon Date: Sat, 2 Jan 2021 20:22:19 +0100 Subject: [PATCH 16/59] Add a different placeholder text for no filtered chats --- qml/pages/OverviewPage.qml | 3 ++- translations/harbour-fernschreiber-de.ts | 8 ++++++++ translations/harbour-fernschreiber-en.ts | 8 ++++++++ translations/harbour-fernschreiber-es.ts | 8 ++++++++ translations/harbour-fernschreiber-fi.ts | 8 ++++++++ translations/harbour-fernschreiber-hu.ts | 8 ++++++++ translations/harbour-fernschreiber-it.ts | 8 ++++++++ translations/harbour-fernschreiber-pl.ts | 8 ++++++++ translations/harbour-fernschreiber-ru.ts | 8 ++++++++ translations/harbour-fernschreiber-sv.ts | 8 ++++++++ translations/harbour-fernschreiber-zh_CN.ts | 8 ++++++++ translations/harbour-fernschreiber.ts | 8 ++++++++ 12 files changed, 90 insertions(+), 1 deletion(-) diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml index 7b3440a..3ad74a9 100644 --- a/qml/pages/OverviewPage.qml +++ b/qml/pages/OverviewPage.qml @@ -335,7 +335,8 @@ Page { ViewPlaceholder { enabled: chatListView.count === 0 - text: qsTr("You don't have any chats yet.") + text: chatSearchField.text === "" ? qsTr("You don't have any chats yet.") : qsTr("No matching chats found.") + hintText: qsTr("You can search public chats or create a new chat via the pull-down menu.") } VerticalScrollDecorator {} diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 6f48ced..adf42ac 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1084,6 +1084,14 @@ Tap on the title bar to filter your chats Tippen Sie auf die Titelleiste, um Ihre Chats zu filtern + + No matching chats found. + Keine passenden Chats gefunden. + + + You can search public chats or create a new chat via the pull-down menu. + Sie können über das Pull-Down-Menü öffentliche Chats finden oder einen Neuen erstellen. + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 80176dd..d27d1a6 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -1084,6 +1084,14 @@ Tap on the title bar to filter your chats Tap on the title bar to filter your chats + + No matching chats found. + No matching chats found. + + + You can search public chats or create a new chat via the pull-down menu. + You can search public chats or create a new chat via the pull-down menu. + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 5225a17..c939580 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1073,6 +1073,14 @@ Tap on the title bar to filter your chats + + No matching chats found. + + + + You can search public chats or create a new chat via the pull-down menu. + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 28a7e7b..0fabf73 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1085,6 +1085,14 @@ Tap on the title bar to filter your chats + + No matching chats found. + + + + You can search public chats or create a new chat via the pull-down menu. + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 8e8ae19..8d15c5f 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1073,6 +1073,14 @@ Tap on the title bar to filter your chats + + No matching chats found. + + + + You can search public chats or create a new chat via the pull-down menu. + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index a9da297..3656174 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1084,6 +1084,14 @@ Tap on the title bar to filter your chats + + No matching chats found. + + + + You can search public chats or create a new chat via the pull-down menu. + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index efbb142..cb9d964 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1095,6 +1095,14 @@ Tap on the title bar to filter your chats + + No matching chats found. + + + + You can search public chats or create a new chat via the pull-down menu. + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 98cbd44..085aa44 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1095,6 +1095,14 @@ Tap on the title bar to filter your chats + + No matching chats found. + + + + You can search public chats or create a new chat via the pull-down menu. + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 63861bb..29d1754 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1084,6 +1084,14 @@ Tap on the title bar to filter your chats + + No matching chats found. + + + + You can search public chats or create a new chat via the pull-down menu. + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 97d8fcd..ac29833 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1073,6 +1073,14 @@ Tap on the title bar to filter your chats + + No matching chats found. + + + + You can search public chats or create a new chat via the pull-down menu. + + PinnedMessageItem diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 3e6ccf4..2cf5900 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1084,6 +1084,14 @@ Tap on the title bar to filter your chats + + No matching chats found. + + + + You can search public chats or create a new chat via the pull-down menu. + + PinnedMessageItem From 2b634471dcf8bebef8a184473c4ed56ffecb7a1a Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 3 Jan 2021 01:22:30 +0100 Subject: [PATCH 17/59] Sending locations seems to work as well... --- harbour-fernschreiber.pro | 2 +- qml/pages/ChatPage.qml | 45 +++++++++++++++-- src/fernschreiberutils.cpp | 54 +++++++++++++++++++++ src/fernschreiberutils.h | 9 ++++ src/tdlibwrapper.cpp | 26 ++++++++++ src/tdlibwrapper.h | 1 + translations/harbour-fernschreiber-de.ts | 8 +++ translations/harbour-fernschreiber-en.ts | 8 +++ translations/harbour-fernschreiber-es.ts | 8 +++ translations/harbour-fernschreiber-fi.ts | 8 +++ translations/harbour-fernschreiber-hu.ts | 8 +++ translations/harbour-fernschreiber-it.ts | 8 +++ translations/harbour-fernschreiber-pl.ts | 8 +++ translations/harbour-fernschreiber-ru.ts | 8 +++ translations/harbour-fernschreiber-sv.ts | 8 +++ translations/harbour-fernschreiber-zh_CN.ts | 8 +++ translations/harbour-fernschreiber.ts | 8 +++ 17 files changed, 220 insertions(+), 5 deletions(-) diff --git a/harbour-fernschreiber.pro b/harbour-fernschreiber.pro index 5823b5a..a99ffc0 100644 --- a/harbour-fernschreiber.pro +++ b/harbour-fernschreiber.pro @@ -16,7 +16,7 @@ CONFIG += sailfishapp sailfishapp_i18n PKGCONFIG += nemonotifications-qt5 zlib -QT += core dbus sql multimedia +QT += core dbus sql multimedia positioning DEFINES += QT_STATICPLUGIN diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 77de0cb..c320ab5 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -212,8 +212,11 @@ Page { attachmentPreviewRow.isVideo = false; attachmentPreviewRow.isDocument = false; attachmentPreviewRow.isVoiceNote = false; + attachmentPreviewRow.isLocation = false; attachmentPreviewRow.fileProperties = {}; + attachmentPreviewRow.locationData = {}; attachmentPreviewRow.attachmentDescription = ""; + fernschreiberUtils.stopGeoLocationUpdates(); } function controlSendButton() { @@ -221,7 +224,8 @@ Page { || attachmentPreviewRow.isPicture || attachmentPreviewRow.isDocument || attachmentPreviewRow.isVideo - || attachmentPreviewRow.isVoiceNote) { + || attachmentPreviewRow.isVoiceNote + || attachmentPreviewRow.isLocation) { newMessageSendButton.enabled = true; } else { newMessageSendButton.enabled = false; @@ -245,6 +249,9 @@ Page { if (attachmentPreviewRow.isVoiceNote) { tdLibWrapper.sendVoiceNoteMessage(chatInformation.id, fernschreiberUtils.voiceNotePath(), newMessageTextField.text, newMessageColumn.replyToMessageId); } + if (attachmentPreviewRow.isLocation) { + tdLibWrapper.sendLocationMessage(chatInformation.id, attachmentPreviewRow.locationData.latitude, attachmentPreviewRow.locationData.longitude, attachmentPreviewRow.locationData.horizontalAccuracy, newMessageColumn.replyToMessageId); + } clearAttachmentPreviewRow(); } else { tdLibWrapper.sendTextMessage(chatInformation.id, newMessageTextField.text, newMessageColumn.replyToMessageId); @@ -257,6 +264,7 @@ Page { controlSendButton(); newMessageInReplyToRow.inReplyToMessage = null; newMessageColumn.editMessageId = "0"; + fernschreiberUtils.stopGeoLocationUpdates(); } function getWordBoundaries(text, cursorPosition) { @@ -386,6 +394,7 @@ Page { if (chatPage.canSendMessages) { tdLibWrapper.setChatDraftMessage(chatInformation.id, 0, newMessageColumn.replyToMessageId, newMessageTextField.text); } + fernschreiberUtils.stopGeoLocationUpdates(); tdLibWrapper.closeChat(chatInformation.id); } @@ -1201,7 +1210,6 @@ Page { id: attachmentOptionsFlickable property bool isNeeded: false - width: parent.width height: isNeeded ? attachmentOptionsRow.height : 0 Behavior on height { SmoothedAnimation { duration: 200 } } @@ -1305,6 +1313,22 @@ Page { attachmentOptionsFlickable.isNeeded = false; } } + IconButton { + visible: fernschreiberUtils.supportsGeoLocation() && newMessageTextField.text === "" + icon.source: "image://theme/icon-m-location" + icon.sourceSize { + width: Theme.iconSizeMedium + height: Theme.iconSizeMedium + } + onClicked: { + fernschreiberUtils.startGeoLocationUpdates(); + attachmentOptionsFlickable.isNeeded = false; + attachmentPreviewRow.isLocation = true; + attachmentPreviewRow.attachmentDescription = qsTr("Location: Obtaining position..."); + attachmentPreviewRow.visible = true; + controlSendButton(); + } + } } } @@ -1322,9 +1346,21 @@ Page { property bool isVideo: false; property bool isDocument: false; property bool isVoiceNote: false; + property bool isLocation: false; + property var locationData: ({}); property var fileProperties:({}); property string attachmentDescription: ""; + Connections { + target: fernschreiberUtils + onNewPositionInformation: { + attachmentPreviewRow.locationData = positionInformation; + if (attachmentPreviewRow.isLocation) { + attachmentPreviewRow.attachmentDescription = qsTr("Location (%1/%2)").arg(attachmentPreviewRow.locationData.latitude).arg(attachmentPreviewRow.locationData.longitude); + } + } + } + IconButton { id: removeAttachmentsIconButton icon.source: "image://theme/icon-m-clear" @@ -1350,13 +1386,13 @@ Page { Label { id: attachmentPreviewText font.pixelSize: Theme.fontSizeSmall - text: attachmentPreviewRow.isVoiceNote ? attachmentPreviewRow.attachmentDescription : ( typeof attachmentPreviewRow.fileProperties !== "undefined" ? attachmentPreviewRow.fileProperties.fileName || "" : "" ); + text: ( attachmentPreviewRow.isVoiceNote || attachmentPreviewRow.isLocation ) ? attachmentPreviewRow.attachmentDescription : ( typeof attachmentPreviewRow.fileProperties !== "undefined" ? attachmentPreviewRow.fileProperties.fileName || "" : "" ); anchors.verticalCenter: parent.verticalCenter maximumLineCount: 1 truncationMode: TruncationMode.Fade color: Theme.secondaryColor - visible: attachmentPreviewRow.isDocument || attachmentPreviewRow.isVoiceNote + visible: attachmentPreviewRow.isDocument || attachmentPreviewRow.isVoiceNote || attachmentPreviewRow.isLocation } } @@ -1558,6 +1594,7 @@ Page { labelVisible: false textLeftMargin: 0 textTopMargin: 0 + enabled: !attachmentPreviewRow.isLocation EnterKey.onClicked: { if (appSettings.sendByEnter) { sendMessage(); diff --git a/src/fernschreiberutils.cpp b/src/fernschreiberutils.cpp index 0d56554..5542cf4 100644 --- a/src/fernschreiberutils.cpp +++ b/src/fernschreiberutils.cpp @@ -25,6 +25,8 @@ #include #include #include +#include +#include #define DEBUG_MODULE FernschreiberUtils #include "debuglog.h" @@ -53,6 +55,14 @@ FernschreiberUtils::FernschreiberUtils(QObject *parent) : QObject(parent) connect(&audioRecorder, SIGNAL(durationChanged(qlonglong)), this, SIGNAL(voiceNoteDurationChanged(qlonglong))); connect(&audioRecorder, SIGNAL(statusChanged(QMediaRecorder::Status)), this, SLOT(handleAudioRecorderStatusChanged(QMediaRecorder::Status))); + this->geoPositionInfoSource = QGeoPositionInfoSource::createDefaultSource(this); + if (this->geoPositionInfoSource) { + LOG("Geolocation successfully initialized..."); + this->geoPositionInfoSource->setUpdateInterval(5000); + connect(geoPositionInfoSource, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(handleGeoPositionUpdated(QGeoPositionInfo))); + } else { + LOG("Unable to initialize geolocation!"); + } } FernschreiberUtils::~FernschreiberUtils() @@ -205,6 +215,25 @@ FernschreiberUtils::VoiceNoteRecordingState FernschreiberUtils::getVoiceNoteReco return this->voiceNoteRecordingState; } +void FernschreiberUtils::startGeoLocationUpdates() +{ + if (this->geoPositionInfoSource) { + this->geoPositionInfoSource->startUpdates(); + } +} + +void FernschreiberUtils::stopGeoLocationUpdates() +{ + if (this->geoPositionInfoSource) { + this->geoPositionInfoSource->stopUpdates(); + } +} + +bool FernschreiberUtils::supportsGeoLocation() +{ + return this->geoPositionInfoSource; +} + void FernschreiberUtils::handleAudioRecorderStatusChanged(QMediaRecorder::Status status) { LOG("Audio recorder status changed:" << status); @@ -231,8 +260,33 @@ void FernschreiberUtils::handleAudioRecorderStatusChanged(QMediaRecorder::Status emit voiceNoteRecordingStateChanged(this->voiceNoteRecordingState); } +void FernschreiberUtils::handleGeoPositionUpdated(const QGeoPositionInfo &info) +{ + LOG("Geo position was updated"); + QVariantMap positionInformation; + if (info.hasAttribute(QGeoPositionInfo::HorizontalAccuracy)) { + positionInformation.insert("horizontalAccuracy", info.attribute(QGeoPositionInfo::HorizontalAccuracy)); + } else { + positionInformation.insert("horizontalAccuracy", 0); + } + if (info.hasAttribute(QGeoPositionInfo::VerticalAccuracy)) { + positionInformation.insert("verticalAccuracy", info.attribute(QGeoPositionInfo::VerticalAccuracy)); + } else { + positionInformation.insert("verticalAccuracy", 0); + } + QGeoCoordinate geoCoordinate = info.coordinate(); + positionInformation.insert("latitude", geoCoordinate.latitude()); + positionInformation.insert("longitude", geoCoordinate.longitude()); + + + emit newPositionInformation(positionInformation); +} + void FernschreiberUtils::cleanUp() { + if (this->geoPositionInfoSource) { + this->geoPositionInfoSource->stopUpdates(); + } QString voiceNotePath = this->voiceNotePath(); if (QFile::exists(voiceNotePath)) { LOG("Removing old temporary file..."); diff --git a/src/fernschreiberutils.h b/src/fernschreiberutils.h index 74d7378..6c7f043 100644 --- a/src/fernschreiberutils.h +++ b/src/fernschreiberutils.h @@ -22,6 +22,8 @@ #include #include +#include +#include #include "tdlibwrapper.h" class FernschreiberUtils : public QObject @@ -47,18 +49,25 @@ public: Q_INVOKABLE void stopRecordingVoiceNote(); Q_INVOKABLE QString voiceNotePath(); Q_INVOKABLE VoiceNoteRecordingState getVoiceNoteRecordingState(); + Q_INVOKABLE void startGeoLocationUpdates(); + Q_INVOKABLE void stopGeoLocationUpdates(); + Q_INVOKABLE bool supportsGeoLocation(); signals: void voiceNoteDurationChanged(qlonglong duration); void voiceNoteRecordingStateChanged(VoiceNoteRecordingState state); + void newPositionInformation(const QVariantMap &positionInformation); private slots: void handleAudioRecorderStatusChanged(QMediaRecorder::Status status); + void handleGeoPositionUpdated(const QGeoPositionInfo &info); private: QAudioRecorder audioRecorder; VoiceNoteRecordingState voiceNoteRecordingState; + QGeoPositionInfoSource *geoPositionInfoSource; + void cleanUp(); }; diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index a791319..3ef9049 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -497,6 +497,32 @@ void TDLibWrapper::sendVoiceNoteMessage(const QString &chatId, const QString &fi this->sendRequest(requestObject); } +void TDLibWrapper::sendLocationMessage(const QString &chatId, double latitude, double longitude, double horizontalAccuracy, const QString &replyToMessageId) +{ + LOG("Sending location message" << chatId << latitude << longitude << horizontalAccuracy << replyToMessageId); + QVariantMap requestObject; + requestObject.insert(_TYPE, "sendMessage"); + requestObject.insert(CHAT_ID, chatId); + if (replyToMessageId != "0") { + requestObject.insert("reply_to_message_id", replyToMessageId); + } + QVariantMap inputMessageContent; + inputMessageContent.insert(_TYPE, "inputMessageLocation"); + QVariantMap location; + location.insert("latitude", latitude); + location.insert("longitude", longitude); + location.insert("horizontal_accuracy", horizontalAccuracy); + location.insert(_TYPE, "location"); + inputMessageContent.insert("location", location); + + inputMessageContent.insert("live_period", 0); + inputMessageContent.insert("heading", 0); + inputMessageContent.insert("proximity_alert_radius", 0); + + requestObject.insert("input_message_content", inputMessageContent); + this->sendRequest(requestObject); +} + void TDLibWrapper::sendStickerMessage(const QString &chatId, const QString &fileId, const QString &replyToMessageId) { LOG("Sending sticker message" << chatId << fileId << replyToMessageId); diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index 026bb69..efb0003 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -140,6 +140,7 @@ public: Q_INVOKABLE void sendVideoMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendDocumentMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendVoiceNoteMessage(const QString &chatId, const QString &filePath, const QString &message, const QString &replyToMessageId = "0"); + Q_INVOKABLE void sendLocationMessage(const QString &chatId, double latitude, double longitude, double horizontalAccuracy, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendStickerMessage(const QString &chatId, const QString &fileId, const QString &replyToMessageId = "0"); Q_INVOKABLE void sendPollMessage(const QString &chatId, const QString &question, const QVariantList &options, bool anonymous, int correctOption, bool multiple, const QString &replyToMessageId = "0"); Q_INVOKABLE void forwardMessages(const QString &chatId, const QString &fromChatId, const QVariantList &messageIds, bool sendCopy, bool removeCaption); diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 93b93ed..3df91af 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -411,6 +411,14 @@ Search in chat... Im Chat suchen... + + Location: Obtaining position... + Standort: Erlange Position... + + + Location (%1/%2) + Standort (%1/%2) + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index cc31755..2bf84b3 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -411,6 +411,14 @@ Search in chat... Search in chat... + + Location: Obtaining position... + Location: Obtaining position... + + + Location (%1/%2) + Location (%1/%2) + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index b0f503b..947c059 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -401,6 +401,14 @@ Search in chat... Buscar + + Location: Obtaining position... + + + + Location (%1/%2) + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 7dba3f2..ef90362 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -411,6 +411,14 @@ Search in chat... + + Location: Obtaining position... + + + + Location (%1/%2) + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 1fd9edd..4211f99 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -401,6 +401,14 @@ Search in chat... + + Location: Obtaining position... + + + + Location (%1/%2) + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index b6d15bf..2075ad3 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -411,6 +411,14 @@ Search in chat... + + Location: Obtaining position... + + + + Location (%1/%2) + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index 8ed7d43..c283ef8 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -421,6 +421,14 @@ Search in chat... + + Location: Obtaining position... + + + + Location (%1/%2) + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 204913c..c7d41d8 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -421,6 +421,14 @@ Search in chat... + + Location: Obtaining position... + + + + Location (%1/%2) + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 0833bb6..aac3e03 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -411,6 +411,14 @@ Search in chat... Sök i chatten... + + Location: Obtaining position... + + + + Location (%1/%2) + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 7f836e9..d7942a8 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -401,6 +401,14 @@ Search in chat... + + Location: Obtaining position... + + + + Location (%1/%2) + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index 5f03298..9390ff5 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -411,6 +411,14 @@ Search in chat... + + Location: Obtaining position... + + + + Location (%1/%2) + + ChatSelectionPage From 62805434f15ceef12dfa067c48bdd2ee98749bb8 Mon Sep 17 00:00:00 2001 From: dashinfantry <45334556+dashinfantry@users.noreply.github.com> Date: Sun, 3 Jan 2021 22:48:06 +0800 Subject: [PATCH 18/59] Update harbour-fernschreiber-zh_CN.ts --- translations/harbour-fernschreiber-zh_CN.ts | 62 ++++++++++----------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index ac29833..bf480b3 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -263,15 +263,15 @@ Mark chat as unread - + 标记此对话为未读 Draft - + Mark chat as read - + 标记为已读 @@ -395,11 +395,11 @@ Search in Chat - + 对话内搜索 Search in chat... - + 正在搜索对话内容… @@ -777,21 +777,21 @@ has added %1 to the chat - + 已加入 %1 到此对话 has removed %1 from the chat - + 已从此对话移除 %1 have added %1 to the chat myself - + 已加入 %1 到此对话 have removed %1 from the chat myself - + 已从此对话移除 %1 @@ -1055,11 +1055,11 @@ Filter your chats... - + 筛选你的对话… Search Chats - + 搜索对话 Download of %1 successful. @@ -1071,15 +1071,15 @@ Tap on the title bar to filter your chats - + 点击顶部状态栏即可筛选你的对话 No matching chats found. - + 没有找到匹配的对话。 You can search public chats or create a new chat via the pull-down menu. - + 你可以搜索公共对话或通过下拉菜单创建新对话。 @@ -1271,47 +1271,47 @@ SearchChatsPage No chats found. - + 没有找到对话。 Searching chats... - + 正在搜索对话… Private Chat - 个人对话 + 个人对话 Group - + 群组 Channel - + 频道 %1 members - + %1 位成员 %1 subscribers - + %1 位订阅者 Search Chats - + 搜索对话 Search a chat... - + 搜索对话… Enter your query to start searching (at least 5 characters needed) - + 输入你要搜索的内容(至少需要输入5个字符) @@ -1390,11 +1390,11 @@ Focus text input area after send - + 发送后聚焦文本输入区域 Focus the text input area after sending a message - + 发送消息后聚焦文本输入区域 @@ -1800,7 +1800,7 @@ Closed! - 已关闭! + 已关闭! Pending acknowledgement @@ -1808,21 +1808,21 @@ has added %1 to the chat - + 已加入 %1 到此对话 has removed %1 from the chat - + 已从此对话移除 %1 have added %1 to the chat myself - + 已加入 %1 到此对话 have removed %1 from the chat myself - + 已从此对话移除 %1 From e623635be5fe617f049063d858b87fbba8d37640 Mon Sep 17 00:00:00 2001 From: dashinfantry <45334556+dashinfantry@users.noreply.github.com> Date: Sun, 3 Jan 2021 22:52:00 +0800 Subject: [PATCH 19/59] Update harbour-fernschreiber-zh_CN.ts --- translations/harbour-fernschreiber-zh_CN.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index bf480b3..3981619 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -267,7 +267,7 @@ Draft - + 草稿 Mark chat as read From 4dc05e2e10713715bdd571da86e3f2460c75356b Mon Sep 17 00:00:00 2001 From: A Date: Sun, 3 Jan 2021 22:53:20 +0100 Subject: [PATCH 20/59] Update harbour-fernschreiber-pl.ts --- translations/harbour-fernschreiber-pl.ts | 70 ++++++++++++------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index cb9d964..9811d9b 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -269,15 +269,15 @@ Mark chat as unread - + Oznacz czat jako nieprzeczytany Draft - + Kopia robocza Mark chat as read - + Oznacz czat jako przeczytany @@ -415,11 +415,11 @@ Search in Chat - + Wyszukaj w czacie Search in chat... - + Wyszukaj w czacie @@ -797,21 +797,21 @@ has added %1 to the chat - + dodał %1 do czatu has removed %1 from the chat - + usunął %1 z czatu have added %1 to the chat myself - + dodsałem %1 do czatu have removed %1 from the chat myself - + usunąłem %1 z czatu @@ -950,11 +950,11 @@ Message unpinned - Wiadomość opięta + Wiadomość odpięta Unpin Message - + Odepnij wiadomość @@ -1077,27 +1077,27 @@ Filter your chats... - + Filtruj swoje czaty... Search Chats - + Wyszukaj czaty Download of %1 successful. - + Pobieranie %1 zakończone sukcesem Download failed. - + Nieudane pobranie Tap on the title bar to filter your chats - + Dotknij paska tytułowego, aby filtrować swoje czaty No matching chats found. - + Brak pasujących czatów You can search public chats or create a new chat via the pull-down menu. @@ -1309,51 +1309,51 @@ SearchChatsPage No chats found. - + Brak pasujących czatów Searching chats... - + Wyszukiwanie czatów... Private Chat - Prywatny czat + Prywatny czat Group - + Grupa Channel - + Kanał %1 members - + %1 członek - - + %1 członków + %1 członków %1 subscribers - + %1 subskrybent - - + %1 subskrybentów + %1 subskrybentów Search Chats - + Wyszukaj czaty Search a chat... - + Wyszukaj czat... Enter your query to start searching (at least 5 characters needed) - + Wprowadź zapytanie aby zacząć wyszukiwanie (minimum 5 znaków) @@ -1850,21 +1850,21 @@ has added %1 to the chat - + dodał %1 do czatu has removed %1 from the chat - + usunął %1 z czatu have added %1 to the chat myself - + dodałem %1 do czatu have removed %1 from the chat myself - + usunąłem %1 z czatu From 81ffb53062d2e3f8b42723760b4ece886083d1a2 Mon Sep 17 00:00:00 2001 From: John Gibbon Date: Sun, 3 Jan 2021 22:32:26 +0100 Subject: [PATCH 21/59] Use OpacityRamp to hint at scrollable attachmentsOptions --- qml/pages/ChatPage.qml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index c320ab5..6999863 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -1174,7 +1174,6 @@ Page { spacing: Theme.paddingSmall topPadding: Theme.paddingSmall anchors.horizontalCenter: parent.horizontalCenter - clip: true visible: height > 0 width: parent.width - ( 2 * Theme.horizontalPageMargin ) height: isNeeded ? implicitHeight : 0 @@ -1210,13 +1209,23 @@ Page { id: attachmentOptionsFlickable property bool isNeeded: false - width: parent.width + width: chatPage.width + x: -Theme.horizontalPageMargin height: isNeeded ? attachmentOptionsRow.height : 0 Behavior on height { SmoothedAnimation { duration: 200 } } visible: height > 0 contentHeight: attachmentOptionsRow.height - contentWidth: Math.max(parent.width, attachmentOptionsRow.width) - clip: true + contentWidth: Math.max(width, attachmentOptionsRow.width) + property bool fadeRight: (attachmentOptionsRow.width-contentX) > width + property bool fadeLeft: !fadeRight && contentX > 0 + layer.enabled: fadeRight || fadeLeft + layer.effect: OpacityRampEffectBase { + direction: attachmentOptionsFlickable.fadeRight ? OpacityRamp.LeftToRight : OpacityRamp.RightToLeft + source: attachmentOptionsFlickable + slope: 1 + 6 * (chatPage.width) / Screen.width + offset: 1 - 1 / slope + } + Row { id: attachmentOptionsRow @@ -1226,6 +1235,8 @@ Page { anchors.right: parent.right layoutDirection: Qt.RightToLeft spacing: Theme.paddingMedium + leftPadding: Theme.horizontalPageMargin + rightPadding: Theme.horizontalPageMargin IconButton { id: attachImageIconButton From e0b94a04878fa82394d481ee1b13d2c430edbc0d Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Mon, 4 Jan 2021 22:03:04 +0100 Subject: [PATCH 22/59] One dedicated file per voice note recording --- qml/components/VoiceNoteOverlay.qml | 3 +++ src/fernschreiberutils.cpp | 26 +++++++++++++++++++------- src/fernschreiberutils.h | 1 + 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/qml/components/VoiceNoteOverlay.qml b/qml/components/VoiceNoteOverlay.qml index aed1e53..cbec5a9 100644 --- a/qml/components/VoiceNoteOverlay.qml +++ b/qml/components/VoiceNoteOverlay.qml @@ -151,6 +151,9 @@ Item { anchors.fill: parent onClicked: { recordButton.visible = false; + recordingDone = false; + recordingDuration = 0; + handleRecordingDuration(); fernschreiberUtils.startRecordingVoiceNote(); } } diff --git a/src/fernschreiberutils.cpp b/src/fernschreiberutils.cpp index 5542cf4..3237982 100644 --- a/src/fernschreiberutils.cpp +++ b/src/fernschreiberutils.cpp @@ -23,8 +23,10 @@ #include #include #include +#include #include #include +#include #include #include @@ -35,7 +37,7 @@ FernschreiberUtils::FernschreiberUtils(QObject *parent) : QObject(parent) { LOG("Initializing audio recorder..."); - QString temporaryDirectoryPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + + "/harbour-fernschreiber"; + QString temporaryDirectoryPath = this->getTemporaryDirectoryPath(); QDir temporaryDirectory(temporaryDirectoryPath); if (!temporaryDirectory.exists()) { temporaryDirectory.mkpath(temporaryDirectoryPath); @@ -47,7 +49,6 @@ FernschreiberUtils::FernschreiberUtils(QObject *parent) : QObject(parent) encoderSettings.setQuality(QMultimedia::LowQuality); this->audioRecorder.setEncodingSettings(encoderSettings); this->audioRecorder.setContainerFormat("ogg"); - this->audioRecorder.setOutputLocation(QUrl::fromLocalFile(temporaryDirectoryPath + "/voicenote.ogg")); QMediaRecorder::Status audioRecorderStatus = this->audioRecorder.status(); this->handleAudioRecorderStatusChanged(audioRecorderStatus); @@ -194,7 +195,8 @@ QString FernschreiberUtils::getUserName(const QVariantMap &userInformation) void FernschreiberUtils::startRecordingVoiceNote() { LOG("Start recording voice note..."); - this->cleanUp(); + QDateTime thisIsNow = QDateTime::currentDateTime(); + this->audioRecorder.setOutputLocation(QUrl::fromLocalFile(this->getTemporaryDirectoryPath() + "/voicenote-" + thisIsNow.toString("yyyy-MM-dd-HH-mm-ss") + ".ogg")); this->audioRecorder.setVolume(1); this->audioRecorder.record(); } @@ -287,9 +289,19 @@ void FernschreiberUtils::cleanUp() if (this->geoPositionInfoSource) { this->geoPositionInfoSource->stopUpdates(); } - QString voiceNotePath = this->voiceNotePath(); - if (QFile::exists(voiceNotePath)) { - LOG("Removing old temporary file..."); - QFile::remove(voiceNotePath); + QString temporaryDirectoryPath = this->getTemporaryDirectoryPath(); + QDirIterator temporaryDirectoryIterator(temporaryDirectoryPath, QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks, QDirIterator::Subdirectories); + while (temporaryDirectoryIterator.hasNext()) { + QString nextFilePath = temporaryDirectoryIterator.next(); + if (QFile::remove(nextFilePath)) { + LOG("Temporary file removed " << nextFilePath); + } else { + LOG("Error removing temporary file " << nextFilePath); + } } } + +QString FernschreiberUtils::getTemporaryDirectoryPath() +{ + return QStandardPaths::writableLocation(QStandardPaths::TempLocation) + + "/harbour-fernschreiber"; +} diff --git a/src/fernschreiberutils.h b/src/fernschreiberutils.h index 6c7f043..ce3bc3b 100644 --- a/src/fernschreiberutils.h +++ b/src/fernschreiberutils.h @@ -69,6 +69,7 @@ private: QGeoPositionInfoSource *geoPositionInfoSource; void cleanUp(); + QString getTemporaryDirectoryPath(); }; From 4bcb96055b8d5173a6d6b5fe527ff52e654471a0 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Mon, 4 Jan 2021 22:19:49 +0100 Subject: [PATCH 23/59] Increase release number for next test build --- rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 9d2da62..b6e1964 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.6 -Release: 1 +Release: 2 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index a9e8967..7d51f36 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.6 -Release: 1 +Release: 2 # The contents of the Group field should be one of the groups listed here: # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS Group: Qt/Qt From 258c533ff09fafb827ec6f006f8c0a9e93e1a2bb Mon Sep 17 00:00:00 2001 From: Rustem Abzalov <79509494133@ya.ru> Date: Tue, 5 Jan 2021 13:31:46 +0300 Subject: [PATCH 24/59] Update harbour-fernschreiber-ru.ts --- translations/harbour-fernschreiber-ru.ts | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 518103e..8ac078e 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -415,11 +415,11 @@ Search in Chat - + Найти в Чате Search in chat... - + Поиск... Location: Obtaining position... @@ -1085,11 +1085,11 @@ Filter your chats... - + Выбрать чат... Search Chats - + Найти Чаты Download of %1 successful. @@ -1101,7 +1101,7 @@ Tap on the title bar to filter your chats - + Коснитесь строки заголовка, чтобы отфильтровать ваши чаты No matching chats found. @@ -1109,7 +1109,7 @@ You can search public chats or create a new chat via the pull-down menu. - + Вы можете искать публичные чаты или создать новый чат с помощью выпадающего меню @@ -1317,11 +1317,11 @@ SearchChatsPage No chats found. - + Чаты не найдены Searching chats... - + Идёт поиск чатов... Private Chat @@ -1329,11 +1329,11 @@ Group - + Группа Channel - + Канал %1 members @@ -1353,15 +1353,15 @@ Search Chats - + Найти Чаты Search a chat... - + Поиск... Enter your query to start searching (at least 5 characters needed) - + Введите не менее 5 символов, чтобы начать поиск From 3eb63a6dd73be42b88bbcce90384375246995369 Mon Sep 17 00:00:00 2001 From: Rustem Abzalov <79509494133@ya.ru> Date: Tue, 5 Jan 2021 14:14:19 +0300 Subject: [PATCH 25/59] Update harbour-fernschreiber-ru.ts --- translations/harbour-fernschreiber-ru.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 518103e..231617b 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -269,15 +269,15 @@ Mark chat as unread - + Отметить чат как непрочитанный Draft - + Черновик Mark chat as read - + Отметить чат как прочитанный From e2b99bafafa2dc6089ac66a122f369aebe3280d3 Mon Sep 17 00:00:00 2001 From: dashinfantry <45334556+dashinfantry@users.noreply.github.com> Date: Tue, 5 Jan 2021 19:51:52 +0800 Subject: [PATCH 26/59] Update harbour-fernschreiber-zh_CN.ts --- translations/harbour-fernschreiber-zh_CN.ts | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 56fb3a1..bb13a27 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -403,11 +403,11 @@ Location: Obtaining position... - + 位置:正在获取位置… Location (%1/%2) - + 位置 (%1/%2) @@ -1435,39 +1435,39 @@ VoiceNoteOverlay Record a Voice Note - + 录制语音消息 Press the button to start recording - + 按下按钮即可开始录音 Unavailable - + 不可用 Starting - + 正在启动 Recording - + 正在录音 Stopping - + 停止中 Use recording - + 使用录音 Voice Note (%1) - + 语言消息 (%1) Ready - + 就绪 From b7738e7fb8efbe9cdc358c4ec33daff6272a12a1 Mon Sep 17 00:00:00 2001 From: dashinfantry <45334556+dashinfantry@users.noreply.github.com> Date: Tue, 5 Jan 2021 19:54:57 +0800 Subject: [PATCH 27/59] Update harbour-fernschreiber-zh_CN.ts --- translations/harbour-fernschreiber-zh_CN.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index bb13a27..90c966d 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -574,7 +574,7 @@ sent a voice note - 发送语言消息 + 发送语音消息 sent a document @@ -1463,7 +1463,7 @@ Voice Note (%1) - 语言消息 (%1) + 语音消息 (%1) Ready From 1e89a4357a9a9975f8a4aace8a7e0cab89ed4f1b Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Tue, 5 Jan 2021 13:34:02 +0100 Subject: [PATCH 28/59] Changelog for 0.6 --- rpm/harbour-fernschreiber.changes | 24 ++++++++++++++++++++++++ rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/rpm/harbour-fernschreiber.changes b/rpm/harbour-fernschreiber.changes index 4af99be..50be412 100644 --- a/rpm/harbour-fernschreiber.changes +++ b/rpm/harbour-fernschreiber.changes @@ -12,6 +12,30 @@ # * date Author's Name version-release # - Summary of changes +* Tue Jan 5 2020 Sebastian J. Wolf 0.6 +- Filter chat list (tap on title bar to open search field) - thanks to the entire dev team for the great discussion and contributions to the layout :) +- Search for public chats (see pulley menu on overview page) +- Search for chat messages (see pulley menu on chat page) +- Support sending voice notes +- Support sending locations +- Add message draft support - thanks to jgibbon +- Basic bot messages support (reply markup) - thanks to jgibbon +- Add 'Mark chat as read/unread' option +- Add download option to audio messages (voice notes, music...) +- Introduce proper text if other people added/removed a person from a chat +- Tweaks to poll layout - thanks to monich +- New option to keep message input focused after message was sent - thanks to jgibbon +- Send message button now removed if Send-message-by-enter option is enabled (and no attachment is set) - thanks to santhoshmanikandan +- Performance and code optimizations (architecture, startup, JS components) - thanks to monich and jgibbon +- Improve readability in light ambiences +- Upgrade to TDLib 1.7 +- Fix: Only show reply to option for messages that can be replied to - thanks to monich +- Fix: Emoji positioning in multi-line texts - thanks to monich +- Fix: Left-over @-mention notifications when all messages in chat are read +- Fix: Occasional crashes on opening poll context menu - thanks to monich +- Fix: Don't display in-reply-to section if message wasn't found +- Several translations updated - thanks to all contributors + * Fri Dec 4 2020 Sebastian J. Wolf 0.5.1 - Add verification badge to verified chats - thanks to monich - Improve preview of wide images - thanks to monich diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index b6e1964..e9eab40 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.6 -Release: 2 +Release: 3 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 7d51f36..434c610 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.6 -Release: 2 +Release: 3 # The contents of the Group field should be one of the groups listed here: # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS Group: Qt/Qt From 58f154b3c3406575780674395ea4d5676049073a Mon Sep 17 00:00:00 2001 From: carlosgonz <45316884+GNUuser@users.noreply.github.com> Date: Tue, 5 Jan 2021 07:36:15 -0500 Subject: [PATCH 29/59] Update harbour-fernschreiber-es.ts --- translations/harbour-fernschreiber-es.ts | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 89ec7e6..01d3bc7 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -403,11 +403,11 @@ Location: Obtaining position... - + Ubicación: Recibiendo posición ... Location (%1/%2) - + Ubicación (%1/%2) @@ -1079,15 +1079,15 @@ Tap on the title bar to filter your chats - + Tocar la barra de título para filtrar las charlas No matching chats found. - + No hay coincidencias. You can search public chats or create a new chat via the pull-down menu. - + Puede buscar charlas públicas o crear un nueva charla a través de la polea de opciones. @@ -1435,39 +1435,39 @@ VoiceNoteOverlay Record a Voice Note - + Grabar una nota de voz Press the button to start recording - + Presionar el botón para iniciar a grabar Unavailable - + No diponible Starting - + Iniciando Recording - + Grabando Stopping - + Deteniendo Use recording - + Usar grabación Voice Note (%1) - + Nota de voz (%1) Ready - + Listo From 001b7bbef0dfa6c496ec18403f5873dfd61c9a07 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Tue, 5 Jan 2021 13:38:23 +0100 Subject: [PATCH 30/59] It's 2021, not 2020 anymore... --- rpm/harbour-fernschreiber.changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpm/harbour-fernschreiber.changes b/rpm/harbour-fernschreiber.changes index 50be412..898a4a7 100644 --- a/rpm/harbour-fernschreiber.changes +++ b/rpm/harbour-fernschreiber.changes @@ -12,7 +12,7 @@ # * date Author's Name version-release # - Summary of changes -* Tue Jan 5 2020 Sebastian J. Wolf 0.6 +* Tue Jan 5 2021 Sebastian J. Wolf 0.6 - Filter chat list (tap on title bar to open search field) - thanks to the entire dev team for the great discussion and contributions to the layout :) - Search for public chats (see pulley menu on overview page) - Search for chat messages (see pulley menu on chat page) From d34538a868fec989b50253625aed7659f6306449 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Tue, 5 Jan 2021 13:59:44 +0100 Subject: [PATCH 31/59] Mark some Russian translations as finished --- translations/harbour-fernschreiber-ru.ts | 76 ++++++++++++------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index d8e355c..dfc7cf0 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -115,59 +115,59 @@ Leave Chat - Выйти из чата + Выйти из чата Join Chat - Зайти в чат + Зайти в чат Leaving chat - Выход из чата + Выход из чата Unmute Chat - Включить уведомления + Включить уведомления Mute Chat - Выключить уведомления + Выключить уведомления Unknown - Неизвестный + Неизвестный Chat Title group title header - Заголовок чата + Заголовок чата Enter 1-128 characters - Введите 1-128 символов + Введите 1-128 символов There is no information text available, yet. - Информация отсутствует + Информация отсутствует Info group or user infotext header - Информация + Информация Phone Number user phone number header - Номер телефона + Номер телефона Invite Link header - Ссылка для приглашения + Ссылка для приглашения The Invite Link has been copied to the clipboard. - Ссылка для приглашения скопирована в буффер обмена + Ссылка для приглашения скопирована в буффер обмена %1, %2 @@ -220,17 +220,17 @@ Groups Button: groups in common (short) - Группы + Группы Members Button: Group Members - Участники группы + Участники группы Settings Button: Chat Settings - Настройки + Настройки @@ -269,15 +269,15 @@ Mark chat as unread - Отметить чат как непрочитанный + Отметить чат как непрочитанный Draft - Черновик + Черновик Mark chat as read - Отметить чат как прочитанный + Отметить чат как прочитанный @@ -415,11 +415,11 @@ Search in Chat - Найти в Чате + Найти в Чате Search in chat... - Поиск... + Поиск... Location: Obtaining position... @@ -438,7 +438,7 @@ You don't have any chats yet. - Тут пока ничего нет + Тут пока ничего нет @@ -958,7 +958,7 @@ Message unpinned - Сообщение откреплено + Сообщение откреплено Unpin Message @@ -991,7 +991,7 @@ You don't have any contacts. - У вас нет никаких контактов. + У вас нет никаких контактов. Private Chat @@ -1085,23 +1085,23 @@ Filter your chats... - Выбрать чат... + Выбрать чат... Search Chats - Найти Чаты + Найти Чаты Download of %1 successful. - Успешно скачано %1. + Успешно скачано %1. Download failed. - Ошибка скачивания. + Ошибка скачивания. Tap on the title bar to filter your chats - Коснитесь строки заголовка, чтобы отфильтровать ваши чаты + Коснитесь строки заголовка, чтобы отфильтровать ваши чаты No matching chats found. @@ -1109,7 +1109,7 @@ You can search public chats or create a new chat via the pull-down menu. - Вы можете искать публичные чаты или создать новый чат с помощью выпадающего меню + Вы можете искать публичные чаты или создать новый чат с помощью выпадающего меню @@ -1317,23 +1317,23 @@ SearchChatsPage No chats found. - Чаты не найдены + Чаты не найдены Searching chats... - Идёт поиск чатов... + Идёт поиск чатов... Private Chat - Приватный Чат + Приватный Чат Group - Группа + Группа Channel - Канал + Канал %1 members @@ -1353,15 +1353,15 @@ Search Chats - Найти Чаты + Найти Чаты Search a chat... - Поиск... + Поиск... Enter your query to start searching (at least 5 characters needed) - Введите не менее 5 символов, чтобы начать поиск + Введите не менее 5 символов, чтобы начать поиск From bdd6a8df277471ad944d52fa3177192097c2d4f6 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Tue, 5 Jan 2021 14:00:59 +0100 Subject: [PATCH 32/59] Yet another 0.6 test build --- rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index e9eab40..34b504a 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.6 -Release: 3 +Release: 4 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 434c610..aecae96 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.6 -Release: 3 +Release: 4 # The contents of the Group field should be one of the groups listed here: # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS Group: Qt/Qt From 39bbd111fa13eda6662ff1988b2bcb832853ed5a Mon Sep 17 00:00:00 2001 From: Rustem Abzalov <79509494133@ya.ru> Date: Tue, 5 Jan 2021 17:17:26 +0300 Subject: [PATCH 33/59] Update harbour-fernschreiber-ru.ts --- translations/harbour-fernschreiber-ru.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index dfc7cf0..cade192 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1440,11 +1440,11 @@ Focus text input area after send - + Приоритет фокусировки при разговоре в чате Focus the text input area after sending a message - + Сфокусироваться на поле ввода текста после отправки сообщения @@ -1477,39 +1477,39 @@ VoiceNoteOverlay Record a Voice Note - + Голосовое сообщение Press the button to start recording - + Коснитесь кнопки для записи Unavailable - + Недоступно Starting - + Пуск Recording - + Запись Stopping - + Стоп Use recording - + Использовать запись Voice Note (%1) - + Аудиозаметка (%1) Ready - + Готов From c4fd46212ef7b716a25a3f453ae4d094f3ca2478 Mon Sep 17 00:00:00 2001 From: dashinfantry <45334556+dashinfantry@users.noreply.github.com> Date: Tue, 5 Jan 2021 22:21:16 +0800 Subject: [PATCH 34/59] Update harbour-fernschreiber-zh_CN.ts --- translations/harbour-fernschreiber-zh_CN.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 90c966d..a0c6e8d 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -425,7 +425,8 @@ CoverPage unread message - 未读消息 + 未读 +消息 unread messages @@ -1455,7 +1456,7 @@ Stopping - 停止中 + 正在停止 Use recording From 3250ebae5c189b03661583a0eb5690653502c814 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Tue, 5 Jan 2021 15:46:00 +0100 Subject: [PATCH 35/59] Mark new Russian translation strings as finished --- translations/harbour-fernschreiber-ru.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index cade192..8bd7bff 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1440,11 +1440,11 @@ Focus text input area after send - Приоритет фокусировки при разговоре в чате + Приоритет фокусировки при разговоре в чате Focus the text input area after sending a message - Сфокусироваться на поле ввода текста после отправки сообщения + Сфокусироваться на поле ввода текста после отправки сообщения @@ -1477,39 +1477,39 @@ VoiceNoteOverlay Record a Voice Note - Голосовое сообщение + Голосовое сообщение Press the button to start recording - Коснитесь кнопки для записи + Коснитесь кнопки для записи Unavailable - Недоступно + Недоступно Starting - Пуск + Пуск Recording - Запись + Запись Stopping - Стоп + Стоп Use recording - Использовать запись + Использовать запись Voice Note (%1) - Аудиозаметка (%1) + Аудиозаметка (%1) Ready - Готов + Готов From 18371912e58bd61b45d1ab0648498cb26128ced9 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Tue, 5 Jan 2021 21:47:51 +0100 Subject: [PATCH 36/59] Release 0.6 - it's a wrap! --- rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 34b504a..06ce70a 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.6 -Release: 4 +Release: 66 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index aecae96..88ed463 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.6 -Release: 4 +Release: 66 # The contents of the Group field should be one of the groups listed here: # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS Group: Qt/Qt From 07798dae02619231393cc760a883bf3fe9e22d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Engelbrektson?= Date: Wed, 6 Jan 2021 08:09:04 +0100 Subject: [PATCH 37/59] Update harbour-fernschreiber-sv.ts Update Swedish translation --- translations/harbour-fernschreiber-sv.ts | 42 ++++++++++++------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 6addfab..1299738 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -270,7 +270,7 @@ Draft - + Utkast Mark chat as read @@ -413,11 +413,11 @@ Location: Obtaining position... - + Plats: Hämtar position... Location (%1/%2) - + Plats (%1/%2) @@ -1090,15 +1090,15 @@ Tap on the title bar to filter your chats - + Tryck på titelfältet för att filtrera dina chattar No matching chats found. - + Ingen passande chatt hittades. You can search public chats or create a new chat via the pull-down menu. - + Du kan söka efter allmänna chattar eller skapa en ny chatt via toppmenyn. @@ -1318,16 +1318,16 @@ %1 members - + + %1 medlem %1 medlemmar - %1 subscribers - + + %1 prenumerant %1 prenumeranter - @@ -1419,11 +1419,11 @@ Focus text input area after send - + Fokusera textinmatningsfältet efter sändning Focus the text input area after sending a message - + Fokusera textinmatningsfältet efter att ett meddelande skickats @@ -1456,39 +1456,39 @@ VoiceNoteOverlay Record a Voice Note - + Spela in ett röstmeddelande Press the button to start recording - + Tryck på knappen för att starta inspelning Unavailable - + Ej tillgänglig Starting - + Startar Recording - + Spelar in Stopping - + Stoppar Use recording - + Använd inspelning Voice Note (%1) - + Röstmeddelande (%1) Ready - + Klar From 3334f487d7f0873f14811f32a0d9b64f94b4c8a0 Mon Sep 17 00:00:00 2001 From: Miikka Jormanainen Date: Wed, 6 Jan 2021 11:06:28 +0200 Subject: [PATCH 38/59] Update harbour-fernschreiber-fi.ts --- translations/harbour-fernschreiber-fi.ts | 94 ++++++++++++------------ 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index ebacf7b..5004959 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -266,15 +266,15 @@ Mark chat as unread - + Merkitse keskustelu lukemattomaksi Draft - + Luonnos Mark chat as read - + Merkitse keskustelu luetuksi @@ -405,19 +405,19 @@ Search in Chat - + Etsi keskustelusta Search in chat... - + Etsi keskustelusta... Location: Obtaining position... - + Sijainti: Paikannetaan... Location (%1/%2) - + Sijainti (%1/%2) @@ -796,21 +796,21 @@ has added %1 to the chat - + lisäsi käyttäjän %1 keskusteluun has removed %1 from the chat - + posit käyttäjän %1 keskustelusta have added %1 to the chat myself - + lisäsit käyttäjän %1 keskusteluun have removed %1 from the chat myself - + poistit käyttäjän %1 keskustelusta @@ -949,11 +949,11 @@ Message unpinned - Viestin kiinnitys poistettu + Viestin kiinnitys poistettu Unpin Message - + Poista viestin kiinnitys @@ -1075,31 +1075,31 @@ Filter your chats... - + Suodata keskustelujasi... Search Chats - + Etsi keskusteluista Download of %1 successful. - + Tiedoston %1 lataus onnistui. Download failed. - Lataus epäonnistui. + Lataus epäonnistui. Tap on the title bar to filter your chats - + Kosketa otsikkopalkkia suodattaaksesi keskusteluja No matching chats found. - + Hakua vastaavia keskusteluja ei löytynyt, You can search public chats or create a new chat via the pull-down menu. - + Voit etsiä julkisia keskusteluja tai luoda uuden keskustelun alasvetovalikosta. @@ -1299,49 +1299,49 @@ SearchChatsPage No chats found. - + Keskusteluja ei löytynyt Searching chats... - + Etsitään keskusteluja... Private Chat - Yksityinen keskustelu + Yksityinen keskustelu Group - + Ryhmä Channel - + Kanava %1 members - + %1 jäsen - + %1 jäsentä %1 subscribers - + %1 tilaaja - + %1 tilaajaa Search Chats - + Etsi keskusteluja Search a chat... - + Etsi keskustelua... Enter your query to start searching (at least 5 characters needed) - + Syötä hakusanasi etsiäksesi (vähintään 5 merkkiä tarvitaan) @@ -1420,11 +1420,11 @@ Focus text input area after send - + Kohdista tekstinsyöttökenttä lähetyksen jälkeen Focus the text input area after sending a message - + Kohdista tekstinsyöttökenttä viestin lähetyksen jälkeen @@ -1457,39 +1457,39 @@ VoiceNoteOverlay Record a Voice Note - + Nauhoita ääniviesti Press the button to start recording - + Paina nappia aloittaaksesi nauhoituksen Unavailable - + Ei saatavilla Starting - + Aloitetaan Recording - + Nauhoitetaan Stopping - + Lopetetaan Use recording - + Käytä nauhoitusta Voice Note (%1) - + Ääniviesti (%1) Ready - + Valmis @@ -1877,21 +1877,21 @@ has added %1 to the chat - + lisäsi käyttäjä %1 keskusteluun has removed %1 from the chat - + posit käyttäjän %1 keskustelusta have added %1 to the chat myself - + lisäsit käyttäjän %1 keskusteluun have removed %1 from the chat myself - + poistit käyttäjän %1 keskustelusta From 9299205379acd47084f1d8d09a31e995882359e9 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Wed, 6 Jan 2021 10:42:12 +0100 Subject: [PATCH 39/59] Show pinned chat icon in list --- qml/components/ChatListViewItem.qml | 1 + qml/components/PhotoTextsListItem.qml | 19 +++++++++++++++++ qml/pages/AboutPage.qml | 2 +- rpm/harbour-fernschreiber.spec | 4 ++-- rpm/harbour-fernschreiber.yaml | 4 ++-- src/chatlistmodel.cpp | 30 +++++++++++++++++++++++++++ src/chatlistmodel.h | 2 ++ src/tdlibreceiver.cpp | 8 +++++-- src/tdlibreceiver.h | 1 + src/tdlibwrapper.cpp | 3 ++- src/tdlibwrapper.h | 1 + 11 files changed, 67 insertions(+), 8 deletions(-) diff --git a/qml/components/ChatListViewItem.qml b/qml/components/ChatListViewItem.qml index b01c487..4090989 100644 --- a/qml/components/ChatListViewItem.qml +++ b/qml/components/ChatListViewItem.qml @@ -25,6 +25,7 @@ PhotoTextsListItem { unreadCount: unread_count isSecret: ( chat_type === TelegramAPI.ChatTypeSecret ) isMarkedAsUnread: is_marked_as_unread + isPinned: is_pinned openMenuOnPressAndHold: true//chat_id != overviewPage.ownUserId diff --git a/qml/components/PhotoTextsListItem.qml b/qml/components/PhotoTextsListItem.qml index a728053..248cd50 100644 --- a/qml/components/PhotoTextsListItem.qml +++ b/qml/components/PhotoTextsListItem.qml @@ -14,6 +14,7 @@ ListItem { property bool isSecret: false property bool isVerified: false property bool isMarkedAsUnread: false + property bool isPinned: false property alias pictureThumbnail: pictureThumbnail contentHeight: mainRow.height + separator.height + 2 * Theme.paddingMedium @@ -49,6 +50,24 @@ ListItem { height: parent.width } + Rectangle { + id: chatPinnedBackground + color: Theme.overlayBackgroundColor + width: Theme.fontSizeExtraLarge + height: Theme.fontSizeExtraLarge + anchors.top: parent.top + radius: parent.width / 2 + visible: chatListViewItem.isPinned + } + + Image { + source: "image://theme/icon-s-favorite" + height: Theme.fontSizeMedium + width: Theme.fontSizeMedium + anchors.centerIn: chatPinnedBackground + visible: chatListViewItem.isPinned + } + Rectangle { id: chatSecretBackground color: Theme.overlayBackgroundColor diff --git a/qml/pages/AboutPage.qml b/qml/pages/AboutPage.qml index 0ef2397..59a3a4d 100644 --- a/qml/pages/AboutPage.qml +++ b/qml/pages/AboutPage.qml @@ -58,7 +58,7 @@ Page { } Label { - text: "Fernschreiber 0.6" + text: "Fernschreiber 0.6.1" horizontalAlignment: Text.AlignHCenter font.pixelSize: Theme.fontSizeExtraLarge anchors { diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 06ce70a..08b197b 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -11,8 +11,8 @@ Name: harbour-fernschreiber # << macros Summary: Fernschreiber is a Telegram client for Sailfish OS -Version: 0.6 -Release: 66 +Version: 0.6.1 +Release: 1 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 88ed463..7c49528 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS -Version: 0.6 -Release: 66 +Version: 0.6.1 +Release: 1 # The contents of the Group field should be one of the groups listed here: # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS Group: Qt/Qt diff --git a/src/chatlistmodel.cpp b/src/chatlistmodel.cpp index a3b9d23..3c7bd56 100644 --- a/src/chatlistmodel.cpp +++ b/src/chatlistmodel.cpp @@ -48,6 +48,7 @@ namespace { const QString IS_CHANNEL("is_channel"); const QString IS_VERIFIED("is_verified"); const QString IS_MARKED_AS_UNREAD("is_marked_as_unread"); + const QString IS_PINNED("is_pinned"); const QString PINNED_MESSAGE_ID("pinned_message_id"); const QString _TYPE("@type"); const QString SECRET_CHAT_ID("secret_chat_id"); @@ -77,6 +78,7 @@ public: bool isChannel() const; bool isHidden() const; bool isMarkedAsUnread() const; + bool isPinned() const; bool updateUnreadCount(int unreadCount); bool updateLastReadInboxMessageId(qlonglong messageId); QVector updateLastMessage(const QVariantMap &message); @@ -272,6 +274,11 @@ bool ChatListModel::ChatData::isMarkedAsUnread() const return chatData.value(IS_MARKED_AS_UNREAD).toBool(); } +bool ChatListModel::ChatData::isPinned() const +{ + return chatData.value(IS_PINNED).toBool(); +} + bool ChatListModel::ChatData::updateUnreadCount(int count) { const int prevUnreadCount(unreadCount()); @@ -364,6 +371,7 @@ ChatListModel::ChatListModel(TDLibWrapper *tdLibWrapper) : showHiddenChats(false connect(tdLibWrapper, SIGNAL(secretChatReceived(qlonglong, QVariantMap)), this, SLOT(handleSecretChatUpdated(qlonglong, QVariantMap))); connect(tdLibWrapper, SIGNAL(chatTitleUpdated(QString, QString)), this, SLOT(handleChatTitleUpdated(QString, QString))); connect(tdLibWrapper, SIGNAL(chatIsMarkedAsUnreadUpdated(qlonglong, bool)), this, SLOT(handleChatIsMarkedAsUnreadUpdated(qlonglong, bool))); + connect(tdLibWrapper, SIGNAL(chatPinnedUpdated(qlonglong, bool)), this, SLOT(handleChatPinnedUpdated(qlonglong, bool))); connect(tdLibWrapper, SIGNAL(chatDraftMessageUpdated(qlonglong, QVariantMap, QString)), this, SLOT(handleChatDraftMessageUpdated(qlonglong, QVariantMap, QString))); // Don't start the timer until we have at least one chat @@ -399,6 +407,7 @@ QHash ChatListModel::roleNames() const roles.insert(ChatListModel::RoleIsVerified, "is_verified"); roles.insert(ChatListModel::RoleIsChannel, "is_channel"); roles.insert(ChatListModel::RoleIsMarkedAsUnread, "is_marked_as_unread"); + roles.insert(ChatListModel::RoleIsPinned, "is_pinned"); roles.insert(ChatListModel::RoleFilter, "filter"); roles.insert(ChatListModel::RoleDraftMessageDate, "draft_message_date"); roles.insert(ChatListModel::RoleDraftMessageText, "draft_message_text"); @@ -432,6 +441,7 @@ QVariant ChatListModel::data(const QModelIndex &index, int role) const case ChatListModel::RoleIsVerified: return data->verified; case ChatListModel::RoleIsChannel: return data->isChannel(); case ChatListModel::RoleIsMarkedAsUnread: return data->isMarkedAsUnread(); + case ChatListModel::RoleIsPinned: return data->isPinned(); case ChatListModel::RoleFilter: return QString(data->title() + " " + data->senderMessageText()).trimmed(); case ChatListModel::RoleDraftMessageText: return data->draftMessageText(); case ChatListModel::RoleDraftMessageDate: return data->draftMessageDate(); @@ -850,6 +860,26 @@ void ChatListModel::handleChatTitleUpdated(const QString &chatId, const QString } } +void ChatListModel::handleChatPinnedUpdated(qlonglong chatId, bool chatIsPinned) +{ + if (chatIndexMap.contains(chatId)) { + LOG("Updating chat is pinned for" << chatId << chatIsPinned); + const int chatIndex = chatIndexMap.value(chatId); + ChatData *chat = chatList.at(chatIndex); + chat->chatData.insert(IS_PINNED, chatIsPinned); + QVector changedRoles; + changedRoles.append(ChatListModel::RoleIsPinned); + const QModelIndex modelIndex(index(chatIndex)); + emit dataChanged(modelIndex, modelIndex, changedRoles); + } else { + ChatData *chat = hiddenChats.value(chatId); + if (chat) { + LOG("Updating chat is pinned for hidden chat" << chatId); + chat->chatData.insert(IS_PINNED, chatIsPinned); + } + } +} + void ChatListModel::handleChatIsMarkedAsUnreadUpdated(qlonglong chatId, bool chatIsMarkedAsUnread) { if (chatIndexMap.contains(chatId)) { diff --git a/src/chatlistmodel.h b/src/chatlistmodel.h index 51b8ce0..f70b64a 100644 --- a/src/chatlistmodel.h +++ b/src/chatlistmodel.h @@ -47,6 +47,7 @@ public: RoleIsVerified, RoleIsChannel, RoleIsMarkedAsUnread, + RoleIsPinned, RoleFilter, RoleDraftMessageText, RoleDraftMessageDate @@ -79,6 +80,7 @@ private slots: void handleGroupUpdated(qlonglong groupId); void handleSecretChatUpdated(qlonglong secretChatId, const QVariantMap &secretChat); void handleChatTitleUpdated(const QString &chatId, const QString &title); + void handleChatPinnedUpdated(qlonglong chatId, bool chatIsPinned); void handleChatIsMarkedAsUnreadUpdated(qlonglong chatId, bool chatIsMarkedAsUnread); void handleChatDraftMessageUpdated(qlonglong chatId, const QVariantMap &draftMessage, const QString &order); void handleRelativeTimeRefreshTimer(); diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp index a367937..d05e395 100644 --- a/src/tdlibreceiver.cpp +++ b/src/tdlibreceiver.cpp @@ -38,6 +38,7 @@ namespace { const QString POSITIONS("positions"); const QString PHOTO("photo"); const QString ORDER("order"); + const QString IS_PINNED("is_pinned"); const QString BASIC_GROUP("basic_group"); const QString SUPERGROUP("supergroup"); const QString LAST_MESSAGE("last_message"); @@ -287,9 +288,12 @@ void TDLibReceiver::processUpdateChatOrder(const QVariantMap &receivedInformatio void TDLibReceiver::processUpdateChatPosition(const QVariantMap &receivedInformation) { const QString chat_id(receivedInformation.value(CHAT_ID).toString()); - const QString order(receivedInformation.value(POSITION).toMap().value(ORDER).toString()); - LOG("Chat position updated for ID" << chat_id << "new order" << order); + QVariantMap positionMap = receivedInformation.value(POSITION).toMap(); + const QString order(positionMap.value(ORDER).toString()); + bool is_pinned = positionMap.value(IS_PINNED).toBool(); + LOG("Chat position updated for ID" << chat_id << "new order" << order << "is pinned" << is_pinned); emit chatOrderUpdated(chat_id, order); + emit chatPinnedUpdated(chat_id.toLongLong(), is_pinned); } void TDLibReceiver::processUpdateChatReadInbox(const QVariantMap &receivedInformation) diff --git a/src/tdlibreceiver.h b/src/tdlibreceiver.h index 311610b..7eb8b99 100644 --- a/src/tdlibreceiver.h +++ b/src/tdlibreceiver.h @@ -49,6 +49,7 @@ signals: void unreadChatCountUpdated(const QVariantMap &chatCountInformation); void chatLastMessageUpdated(const QString &chatId, const QString &order, const QVariantMap &lastMessage); void chatOrderUpdated(const QString &chatId, const QString &order); + void chatPinnedUpdated(qlonglong chatId, bool isPinned); void chatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount); void chatReadOutboxUpdated(const QString &chatId, const QString &lastReadOutboxMessageId); void basicGroupUpdated(qlonglong groupId, const QVariantMap &groupInformation); diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 3ef9049..6d2a9a3 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -120,6 +120,7 @@ TDLibWrapper::TDLibWrapper(AppSettings *appSettings, MceInterface *mceInterface, connect(this->tdLibReceiver, SIGNAL(chatPermissionsUpdated(QString, QVariantMap)), this, SIGNAL(chatPermissionsUpdated(QString, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(chatPhotoUpdated(qlonglong, QVariantMap)), this, SIGNAL(chatPhotoUpdated(qlonglong, QVariantMap))); connect(this->tdLibReceiver, SIGNAL(chatTitleUpdated(QString, QString)), this, SIGNAL(chatTitleUpdated(QString, QString))); + connect(this->tdLibReceiver, SIGNAL(chatPinnedUpdated(qlonglong, bool)), this, SIGNAL(chatPinnedUpdated(qlonglong, bool))); connect(this->tdLibReceiver, SIGNAL(chatPinnedMessageUpdated(qlonglong, qlonglong)), this, SIGNAL(chatPinnedMessageUpdated(qlonglong, qlonglong))); connect(this->tdLibReceiver, SIGNAL(messageIsPinnedUpdated(qlonglong, qlonglong, bool)), this, SLOT(handleMessageIsPinnedUpdated(qlonglong, qlonglong, bool))); connect(this->tdLibReceiver, SIGNAL(usersReceived(QString, QVariantList, int)), this, SIGNAL(usersReceived(QString, QVariantList, int))); @@ -1467,7 +1468,7 @@ void TDLibWrapper::setInitialParameters() QSettings hardwareSettings("/etc/hw-release", QSettings::NativeFormat); initialParameters.insert("device_model", hardwareSettings.value("NAME", "Unknown Mobile Device").toString()); initialParameters.insert("system_version", QSysInfo::prettyProductName()); - initialParameters.insert("application_version", "0.6"); + initialParameters.insert("application_version", "0.6.1"); initialParameters.insert("enable_storage_optimizer", appSettings->storageOptimizer()); // initialParameters.insert("use_test_dc", true); requestObject.insert("parameters", initialParameters); diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index efb0003..c777c60 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -210,6 +210,7 @@ signals: void unreadChatCountUpdated(const QVariantMap &chatCountInformation); void chatLastMessageUpdated(const QString &chatId, const QString &order, const QVariantMap &lastMessage); void chatOrderUpdated(const QString &chatId, const QString &order); + void chatPinnedUpdated(qlonglong chatId, bool isPinned); void chatReadInboxUpdated(const QString &chatId, const QString &lastReadInboxMessageId, int unreadCount); void chatReadOutboxUpdated(const QString &chatId, const QString &lastReadOutboxMessageId); void userUpdated(const QString &userId, const QVariantMap &userInformation); From 7e6c8712613a4105eb83d20bd58d9dfafac7abf0 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Wed, 6 Jan 2021 12:58:16 +0100 Subject: [PATCH 40/59] Make VideoPage work again --- qml/components/VideoPreview.qml | 37 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/qml/components/VideoPreview.qml b/qml/components/VideoPreview.qml index a17fae1..7854c2c 100644 --- a/qml/components/VideoPreview.qml +++ b/qml/components/VideoPreview.qml @@ -27,7 +27,7 @@ Item { property ListItem messageListItem property MessageOverlayFlickable overlayFlickable - property var rawMessage: messageListItem ? messageListItem.myMessage : overlayFlickable.overlayMessage + property var rawMessage: messageListItem ? messageListItem.myMessage : ( overlayFlickable ? overlayFlickable.overlayMessage : undefined ) property var videoData: ( rawMessage.content['@type'] === "messageVideo" ) ? rawMessage.content.video : ( ( rawMessage.content['@type'] === "messageAnimation" ) ? rawMessage.content.animation : rawMessage.content.video_note ) property string videoUrl; @@ -89,7 +89,7 @@ Item { videoMessageComponent.videoType = videoMessageComponent.isVideoNote ? "video" : videoData['@type']; videoFileId = videoData[videoType].id; - if (rawMessage.content['@type'] === "messageAnimation") { + if (typeof rawMessage !== "undefined" && rawMessage.content['@type'] === "messageAnimation") { playButton.visible = true; fullscreenButton.visible = !videoMessageComponent.fullscreen; handlePlay(); @@ -294,21 +294,6 @@ Item { } } - Connections { - target: videoMessageComponent - onClicked: { - if (messageVideo.playbackState === MediaPlayer.PlayingState) { - enableScreensaver(); - messageVideo.pause(); - timeLeftItem.visible = true; - } else { - disableScreensaver(); - messageVideo.play(); - timeLeftTimer.start(); - } - } - } - Video { id: messageVideo @@ -367,7 +352,7 @@ Item { height: parent.height source: videoUrl layer.enabled: videoMessageComponent.highlighted - layer.effect: PressEffect { source: singleImage } + layer.effect: PressEffect { source: messageVideo } onStopped: { enableScreensaver(); messageVideo.visible = false; @@ -376,6 +361,21 @@ Item { videoComponentLoader.active = false; fullscreenItem.visible = !videoMessageComponent.fullscreen; } + + MouseArea { + anchors.fill: parent + onClicked: { + if (messageVideo.playbackState === MediaPlayer.PlayingState) { + enableScreensaver(); + messageVideo.pause(); + timeLeftItem.visible = true; + } else { + disableScreensaver(); + messageVideo.play(); + timeLeftTimer.start(); + } + } + } } BusyIndicator { @@ -514,7 +514,6 @@ Item { } - } } From 5ca6dd1ca0d24ee48091281832fb14adc33df37c Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Wed, 6 Jan 2021 13:24:37 +0100 Subject: [PATCH 41/59] Use dedicated pin icon, thanks to @jgibbon --- images/icon-s-pin.svg | 26 ++++++++++++++++++++++++++ qml/components/PhotoTextsListItem.qml | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 images/icon-s-pin.svg diff --git a/images/icon-s-pin.svg b/images/icon-s-pin.svg new file mode 100644 index 0000000..80dfab8 --- /dev/null +++ b/images/icon-s-pin.svg @@ -0,0 +1,26 @@ + +image/svg+xml \ No newline at end of file diff --git a/qml/components/PhotoTextsListItem.qml b/qml/components/PhotoTextsListItem.qml index 248cd50..05cc9cb 100644 --- a/qml/components/PhotoTextsListItem.qml +++ b/qml/components/PhotoTextsListItem.qml @@ -61,7 +61,7 @@ ListItem { } Image { - source: "image://theme/icon-s-favorite" + source: "../../images/icon-s-pin.svg" height: Theme.fontSizeMedium width: Theme.fontSizeMedium anchors.centerIn: chatPinnedBackground From 348b26d6ec84de1ee4de123374bf6d651afc825b Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Wed, 6 Jan 2021 13:29:51 +0100 Subject: [PATCH 42/59] Add build requirements to Qt Multimedia and Positioning --- rpm/harbour-fernschreiber.spec | 2 ++ rpm/harbour-fernschreiber.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 08b197b..25d0960 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -25,6 +25,8 @@ BuildRequires: pkgconfig(Qt5Qml) BuildRequires: pkgconfig(Qt5Quick) BuildRequires: pkgconfig(Qt5DBus) BuildRequires: pkgconfig(Qt5Sql) +BuildRequires: pkgconfig(Qt5Multimedia) +BuildRequires: pkgconfig(Qt5Positioning) BuildRequires: pkgconfig(nemonotifications-qt5) BuildRequires: pkgconfig(ngf-qt5) BuildRequires: desktop-file-utils diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 7c49528..62a1e5d 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -25,6 +25,8 @@ PkgConfigBR: - Qt5Quick - Qt5DBus - Qt5Sql + - Qt5Multimedia + - Qt5Positioning - nemonotifications-qt5 - ngf-qt5 From cc65c694c03bcf74c0906b6fdaefd4b2ea3cdd56 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Wed, 6 Jan 2021 14:01:55 +0100 Subject: [PATCH 43/59] Use highlightBackgroundColor consistently for all chat attributes --- qml/components/PhotoTextsListItem.qml | 4 ++-- qml/pages/ChatPage.qml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/qml/components/PhotoTextsListItem.qml b/qml/components/PhotoTextsListItem.qml index 05cc9cb..68287a6 100644 --- a/qml/components/PhotoTextsListItem.qml +++ b/qml/components/PhotoTextsListItem.qml @@ -52,7 +52,7 @@ ListItem { Rectangle { id: chatPinnedBackground - color: Theme.overlayBackgroundColor + color: Theme.highlightBackgroundColor width: Theme.fontSizeExtraLarge height: Theme.fontSizeExtraLarge anchors.top: parent.top @@ -70,7 +70,7 @@ ListItem { Rectangle { id: chatSecretBackground - color: Theme.overlayBackgroundColor + color: Theme.highlightBackgroundColor width: Theme.fontSizeExtraLarge height: Theme.fontSizeExtraLarge anchors.bottom: parent.bottom diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 6999863..01c8e55 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -749,7 +749,7 @@ Page { Rectangle { id: chatSecretBackground - color: Theme.overlayBackgroundColor + color: Theme.highlightBackgroundColor width: chatPage.isPortrait ? Theme.fontSizeLarge : Theme.fontSizeMedium height: width anchors.left: parent.left From de51bbffc0afd339c9f154fa5e4c488c05afb2f1 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Wed, 6 Jan 2021 16:07:23 +0100 Subject: [PATCH 44/59] Harmonize chat attribute bubble sizes --- qml/components/PhotoTextsListItem.qml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/qml/components/PhotoTextsListItem.qml b/qml/components/PhotoTextsListItem.qml index 68287a6..7aabfaa 100644 --- a/qml/components/PhotoTextsListItem.qml +++ b/qml/components/PhotoTextsListItem.qml @@ -53,8 +53,8 @@ ListItem { Rectangle { id: chatPinnedBackground color: Theme.highlightBackgroundColor - width: Theme.fontSizeExtraLarge - height: Theme.fontSizeExtraLarge + width: Theme.fontSizeLarge + height: Theme.fontSizeLarge anchors.top: parent.top radius: parent.width / 2 visible: chatListViewItem.isPinned @@ -62,8 +62,8 @@ ListItem { Image { source: "../../images/icon-s-pin.svg" - height: Theme.fontSizeMedium - width: Theme.fontSizeMedium + height: Theme.fontSizeSmall + width: Theme.fontSizeSmall anchors.centerIn: chatPinnedBackground visible: chatListViewItem.isPinned } @@ -71,8 +71,8 @@ ListItem { Rectangle { id: chatSecretBackground color: Theme.highlightBackgroundColor - width: Theme.fontSizeExtraLarge - height: Theme.fontSizeExtraLarge + width: Theme.fontSizeLarge + height: Theme.fontSizeLarge anchors.bottom: parent.bottom radius: parent.width / 2 visible: chatListViewItem.isSecret @@ -80,8 +80,8 @@ ListItem { Image { source: "image://theme/icon-s-secure" - height: Theme.fontSizeMedium - width: Theme.fontSizeMedium + height: Theme.fontSizeSmall + width: Theme.fontSizeSmall anchors.centerIn: chatSecretBackground visible: chatListViewItem.isSecret } From fb161f3d24b5416531d286d261c684d5c09ecd5a Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Wed, 6 Jan 2021 16:54:23 +0100 Subject: [PATCH 45/59] Take chat list type into account when receiving new chat positions --- src/tdlibreceiver.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp index d05e395..045e27e 100644 --- a/src/tdlibreceiver.cpp +++ b/src/tdlibreceiver.cpp @@ -289,11 +289,19 @@ void TDLibReceiver::processUpdateChatPosition(const QVariantMap &receivedInforma { const QString chat_id(receivedInformation.value(CHAT_ID).toString()); QVariantMap positionMap = receivedInformation.value(POSITION).toMap(); + + QString updateForChatList = positionMap.value(LIST).toMap().value(TYPE).toString(); const QString order(positionMap.value(ORDER).toString()); bool is_pinned = positionMap.value(IS_PINNED).toBool(); - LOG("Chat position updated for ID" << chat_id << "new order" << order << "is pinned" << is_pinned); - emit chatOrderUpdated(chat_id, order); - emit chatPinnedUpdated(chat_id.toLongLong(), is_pinned); + + // We are only processing main chat list updates at the moment... + if (updateForChatList == "chatListMain") { + LOG("Chat position updated for ID" << chat_id << "new order" << order << "is pinned" << is_pinned); + emit chatOrderUpdated(chat_id, order); + emit chatPinnedUpdated(chat_id.toLongLong(), is_pinned); + } else { + LOG("Received chat position update for uninteresting list" << updateForChatList << "ID" << chat_id << "new order" << order << "is pinned" << is_pinned); + } } void TDLibReceiver::processUpdateChatReadInbox(const QVariantMap &receivedInformation) From 68f60f5b8a6fe3c632357fe8f71c9606d146bc2b Mon Sep 17 00:00:00 2001 From: carlosgonz <45316884+GNUuser@users.noreply.github.com> Date: Wed, 6 Jan 2021 15:23:11 -0500 Subject: [PATCH 46/59] Update harbour-fernschreiber-es.ts --- translations/harbour-fernschreiber-es.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 01d3bc7..1983615 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1311,15 +1311,15 @@ Search Chats - Buscar charlas + Buscar charla Search a chat... - Buscar una charla... + A b c Enter your query to start searching (at least 5 characters needed) - Introducir la consulta para iniciar la búsqueda (se necesitan al menos 5 caracteres) + Para iniciar la búsqueda se necesitan al menos 5 caracteres @@ -1354,15 +1354,15 @@ Notification feedback - Notificaciones + Notificar en All events - Todos los eventos + Eventos Only new events - Sólo nuevos eventos + Nuevos eventos None @@ -1398,11 +1398,11 @@ Focus text input area after send - Enfocar el área de entrada de texto después de enviar + Enfocar área de entrada de texto Focus the text input area after sending a message - Enfocar el área de entrada de texto después de enviar un mensaje + Enfoca el área de entrada de texto después de enviar un mensaje @@ -1435,7 +1435,7 @@ VoiceNoteOverlay Record a Voice Note - Grabar una nota de voz + Nota de voz Press the button to start recording From a30dd23ed82b1233f47f3e3abacaae9777dc0494 Mon Sep 17 00:00:00 2001 From: Rustem Abzalov <79509494133@ya.ru> Date: Wed, 6 Jan 2021 23:31:11 +0300 Subject: [PATCH 47/59] Update harbour-fernschreiber-ru.ts --- translations/harbour-fernschreiber-ru.ts | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 8bd7bff..a38f538 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -423,11 +423,11 @@ Location: Obtaining position... - + Определение координат... Location (%1/%2) - + Местоположение (%1/%2) @@ -445,11 +445,11 @@ CoverPage unread message - непрочитанное сообщение + сообщение unread messages - непрочитанных сообщений + сообщений in @@ -469,7 +469,7 @@ Connected - Подключен + В сети Updating content... @@ -477,11 +477,11 @@ chat - чат + чате chats - чаты + чатах @@ -805,21 +805,21 @@ has added %1 to the chat - + %1 добавлен в чат has removed %1 from the chat - + %1 удалён из чата have added %1 to the chat myself - + %1 добавлены в чат have removed %1 from the chat myself - + %1 удалены из чата @@ -962,7 +962,7 @@ Unpin Message - + Открепить сообщение @@ -1105,7 +1105,7 @@ No matching chats found. - + Совпадающих чатов не найдено. You can search public chats or create a new chat via the pull-down menu. @@ -1897,21 +1897,21 @@ has added %1 to the chat - + %1 добавлен в чат has removed %1 from the chat - + %1 удалён из чата have added %1 to the chat myself - + %1 добавлены в чат have removed %1 from the chat myself - + %1 удалены из чата From f104ac0cab0424c51aee214cdc8b9ffeeff2423d Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Wed, 6 Jan 2021 21:50:53 +0100 Subject: [PATCH 48/59] Changelog for 0.6.1 --- rpm/harbour-fernschreiber.changes | 8 ++++++++ rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/rpm/harbour-fernschreiber.changes b/rpm/harbour-fernschreiber.changes index 898a4a7..7df474a 100644 --- a/rpm/harbour-fernschreiber.changes +++ b/rpm/harbour-fernschreiber.changes @@ -12,6 +12,14 @@ # * date Author's Name version-release # - Summary of changes +* Wed Jan 6 2021 Sebastian J. Wolf 0.6.1 +- Show indicator for pinned chats +- Use highlightBackgroundColor and align size for all chat attributes (unread messages, secret chat, pinned chat) +- Fix: Chat list order of sequence was wrong in some circumstances +- Fix: Make video (fullscreen) page work again +- Fix: Add build requirements for Qt Multimedia and Qt Positioning +- Updated translations for Finnish and Swedish - thanks to jorm1s and eson57 + * Tue Jan 5 2021 Sebastian J. Wolf 0.6 - Filter chat list (tap on title bar to open search field) - thanks to the entire dev team for the great discussion and contributions to the layout :) - Search for public chats (see pulley menu on overview page) diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 25d0960..759cc3b 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.6.1 -Release: 1 +Release: 3 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 62a1e5d..ec0ce64 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.6.1 -Release: 1 +Release: 3 # The contents of the Group field should be one of the groups listed here: # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS Group: Qt/Qt From d64ab2f7ea70eaef9eeb6e9ed1ff65d5dabf1615 Mon Sep 17 00:00:00 2001 From: A Date: Thu, 7 Jan 2021 10:32:35 +0100 Subject: [PATCH 49/59] Update harbour-fernschreiber-pl.ts --- translations/harbour-fernschreiber-pl.ts | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index fb88482..8170d55 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -423,11 +423,11 @@ Location: Obtaining position... - + Lokalizacja: Uzyskanie pozycji ... Location (%1/%2) - + Lokalizacja (%1/%2) @@ -1109,7 +1109,7 @@ You can search public chats or create a new chat via the pull-down menu. - + Możesz przeszukiwać czaty publiczne lub utworzyć nowy czat za pomocą menu rozwijanego z góry. @@ -1440,11 +1440,11 @@ Focus text input area after send - + Po wysłaniu zaznacz pole wprowadzania tekstu Focus the text input area after sending a message - + Po wysłaniu wiadomości zaznacz pole wprowadzania tekstu @@ -1477,39 +1477,39 @@ VoiceNoteOverlay Record a Voice Note - + Nagraj notatkę głosową Press the button to start recording - + Naciśnij przycisk, aby zacząć nagrywać Unavailable - + Niedostepne Starting - + Uruchamianie Recording - + Nagrywanie Stopping - + Zatrzymywanie Use recording - + Użyj nagrywania Voice Note (%1) - + Notatka głosowa (%1) Ready - + Gotowy From 7453c60052c5010924df84c4c2396f7c89e6ecbd Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Thu, 7 Jan 2021 21:52:26 +0100 Subject: [PATCH 50/59] Add sourceSize to pin icon --- qml/components/PhotoTextsListItem.qml | 1 + qml/pages/AboutPage.qml | 2 +- rpm/harbour-fernschreiber.spec | 4 ++-- rpm/harbour-fernschreiber.yaml | 4 ++-- src/tdlibwrapper.cpp | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/qml/components/PhotoTextsListItem.qml b/qml/components/PhotoTextsListItem.qml index 7aabfaa..1be2fdf 100644 --- a/qml/components/PhotoTextsListItem.qml +++ b/qml/components/PhotoTextsListItem.qml @@ -64,6 +64,7 @@ ListItem { source: "../../images/icon-s-pin.svg" height: Theme.fontSizeSmall width: Theme.fontSizeSmall + sourceSize: Qt.size(Theme.iconSizeSmall, Theme.iconSizeSmall) anchors.centerIn: chatPinnedBackground visible: chatListViewItem.isPinned } diff --git a/qml/pages/AboutPage.qml b/qml/pages/AboutPage.qml index 59a3a4d..87af291 100644 --- a/qml/pages/AboutPage.qml +++ b/qml/pages/AboutPage.qml @@ -58,7 +58,7 @@ Page { } Label { - text: "Fernschreiber 0.6.1" + text: "Fernschreiber 0.7" horizontalAlignment: Text.AlignHCenter font.pixelSize: Theme.fontSizeExtraLarge anchors { diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 759cc3b..d1f9180 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -11,8 +11,8 @@ Name: harbour-fernschreiber # << macros Summary: Fernschreiber is a Telegram client for Sailfish OS -Version: 0.6.1 -Release: 3 +Version: 0.7 +Release: 1 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index ec0ce64..935a55c 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS -Version: 0.6.1 -Release: 3 +Version: 0.7 +Release: 1 # The contents of the Group field should be one of the groups listed here: # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS Group: Qt/Qt diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index 6d2a9a3..f3e3329 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -1468,7 +1468,7 @@ void TDLibWrapper::setInitialParameters() QSettings hardwareSettings("/etc/hw-release", QSettings::NativeFormat); initialParameters.insert("device_model", hardwareSettings.value("NAME", "Unknown Mobile Device").toString()); initialParameters.insert("system_version", QSysInfo::prettyProductName()); - initialParameters.insert("application_version", "0.6.1"); + initialParameters.insert("application_version", "0.7"); initialParameters.insert("enable_storage_optimizer", appSettings->storageOptimizer()); // initialParameters.insert("use_test_dc", true); requestObject.insert("parameters", initialParameters); From e3370bf73e06b0420ad2cb366246be0100584357 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Thu, 7 Jan 2021 22:47:42 +0100 Subject: [PATCH 51/59] Add chat list menu option to pin/unpin chat --- qml/components/ChatListViewItem.qml | 13 ++++--- src/tdlibwrapper.cpp | 20 +++++++++-- src/tdlibwrapper.h | 1 + translations/harbour-fernschreiber-de.ts | 40 ++++++++++++--------- translations/harbour-fernschreiber-en.ts | 40 ++++++++++++--------- translations/harbour-fernschreiber-es.ts | 40 ++++++++++++--------- translations/harbour-fernschreiber-fi.ts | 40 ++++++++++++--------- translations/harbour-fernschreiber-hu.ts | 40 ++++++++++++--------- translations/harbour-fernschreiber-it.ts | 40 ++++++++++++--------- translations/harbour-fernschreiber-pl.ts | 40 ++++++++++++--------- translations/harbour-fernschreiber-ru.ts | 40 ++++++++++++--------- translations/harbour-fernschreiber-sv.ts | 40 ++++++++++++--------- translations/harbour-fernschreiber-zh_CN.ts | 40 ++++++++++++--------- translations/harbour-fernschreiber.ts | 40 ++++++++++++--------- 14 files changed, 289 insertions(+), 185 deletions(-) diff --git a/qml/components/ChatListViewItem.qml b/qml/components/ChatListViewItem.qml index 4090989..b05f364 100644 --- a/qml/components/ChatListViewItem.qml +++ b/qml/components/ChatListViewItem.qml @@ -55,19 +55,18 @@ PhotoTextsListItem { } MenuItem { - visible: unread_count === 0 && !is_marked_as_unread + visible: unread_count === 0 onClicked: { - tdLibWrapper.toggleChatIsMarkedAsUnread(chat_id, true); + tdLibWrapper.toggleChatIsMarkedAsUnread(chat_id, !is_marked_as_unread); } - text: qsTr("Mark chat as unread") + text: is_marked_as_unread ? qsTr("Mark chat as read") : qsTr("Mark chat as unread") } MenuItem { - visible: unread_count === 0 && is_marked_as_unread onClicked: { - tdLibWrapper.toggleChatIsMarkedAsUnread(chat_id, false); + tdLibWrapper.toggleChatIsPinned(chat_id, !is_pinned); } - text: qsTr("Mark chat as read") + text: is_pinned ? qsTr("Unpin chat") : qsTr("Pin chat") } MenuItem { @@ -82,7 +81,7 @@ PhotoTextsListItem { newNotificationSettings.use_default_mute_for = false; tdLibWrapper.setChatNotificationSettings(chat_id, newNotificationSettings); } - text: display.notification_settings.mute_for > 0 ? qsTr("Unmute Chat") : qsTr("Mute Chat") + text: display.notification_settings.mute_for > 0 ? qsTr("Unmute chat") : qsTr("Mute chat") } MenuItem { diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index f3e3329..ffa0b5e 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -47,8 +47,10 @@ namespace { const QString USERNAME("username"); const QString THREAD_ID("thread_id"); const QString VALUE("value"); + const QString CHAT_LIST_TYPE("chat_list_type"); const QString _TYPE("@type"); const QString _EXTRA("@extra"); + const QString CHAT_LIST_MAIN("chatListMain"); } TDLibWrapper::TDLibWrapper(AppSettings *appSettings, MceInterface *mceInterface, QObject *parent) : QObject(parent), joinChatRequested(false) @@ -1035,6 +1037,20 @@ void TDLibWrapper::toggleChatIsMarkedAsUnread(qlonglong chatId, bool isMarkedAsU this->sendRequest(requestObject); } +void TDLibWrapper::toggleChatIsPinned(qlonglong chatId, bool isPinned) +{ + LOG("Toggle chat is pinned" << chatId << isPinned); + QVariantMap requestObject; + requestObject.insert(_TYPE, "toggleChatIsPinned"); + QVariantMap chatListMap; + chatListMap.insert(_TYPE, CHAT_LIST_MAIN); + requestObject.insert("chat_list", chatListMap); + requestObject.insert(CHAT_ID, chatId); + requestObject.insert("is_pinned", isPinned); + requestObject.insert("is_marked_as_unread", isPinned); + this->sendRequest(requestObject); +} + void TDLibWrapper::setChatDraftMessage(qlonglong chatId, qlonglong threadId, qlonglong replyToMessageId, const QString &draft) { LOG("Set Draft Message" << chatId); @@ -1345,7 +1361,7 @@ void TDLibWrapper::handleChatReceived(const QVariantMap &chatInformation) void TDLibWrapper::handleUnreadMessageCountUpdated(const QVariantMap &messageCountInformation) { - if (messageCountInformation.value("chat_list_type").toString() == "chatListMain") { + if (messageCountInformation.value(CHAT_LIST_TYPE).toString() == CHAT_LIST_MAIN) { this->unreadMessageInformation = messageCountInformation; emit unreadMessageCountUpdated(messageCountInformation); } @@ -1353,7 +1369,7 @@ void TDLibWrapper::handleUnreadMessageCountUpdated(const QVariantMap &messageCou void TDLibWrapper::handleUnreadChatCountUpdated(const QVariantMap &chatCountInformation) { - if (chatCountInformation.value("chat_list_type").toString() == "chatListMain") { + if (chatCountInformation.value(CHAT_LIST_TYPE).toString() == CHAT_LIST_MAIN) { this->unreadChatInformation = chatCountInformation; emit unreadChatCountUpdated(chatCountInformation); } diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h index c777c60..c07c761 100644 --- a/src/tdlibwrapper.h +++ b/src/tdlibwrapper.h @@ -185,6 +185,7 @@ public: Q_INVOKABLE void searchPublicChats(const QString &query); Q_INVOKABLE void readAllChatMentions(qlonglong chatId); Q_INVOKABLE void toggleChatIsMarkedAsUnread(qlonglong chatId, bool isMarkedAsUnread); + Q_INVOKABLE void toggleChatIsPinned(qlonglong chatId, bool isPinned); Q_INVOKABLE void setChatDraftMessage(qlonglong chatId, qlonglong threadId, qlonglong replyToMessageId, const QString &draft); // Others (candidates for extraction ;)) diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 1408d84..4e85e52 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -123,14 +123,6 @@ Leaving chat Verlasse Chat - - Unmute Chat - Stummschaltung des Chats aufheben - - - Mute Chat - Chat stummschalten - Unknown Unbekannt @@ -183,6 +175,14 @@ New Secret Chat Neuer geheimer Chat + + Unmute Chat + Stummschaltung des Chats aufheben + + + Mute Chat + Chat stummschalten + ChatInformationTabItemMembersGroups @@ -240,14 +240,6 @@ You Sie - - Unmute Chat - Stummschaltung des Chats aufheben - - - Mute Chat - Chat stummschalten - User Info Benutzerinfos @@ -276,6 +268,22 @@ Draft Entwurf + + Unpin chat + Chat losheften + + + Pin chat + Chat anheften + + + Unmute chat + Stummschaltung des Chats aufheben + + + Mute chat + Chat stummschalten + ChatPage diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 45f24f0..76ae152 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -123,14 +123,6 @@ Leaving chat Leaving chat - - Unmute Chat - Unmute Chat - - - Mute Chat - Mute Chat - Unknown Unknown @@ -183,6 +175,14 @@ New Secret Chat New Secret Chat + + Unmute Chat + Unmute Chat + + + Mute Chat + Mute Chat + ChatInformationTabItemMembersGroups @@ -240,14 +240,6 @@ You You - - Unmute Chat - Unmute Chat - - - Mute Chat - Mute Chat - User Info User Info @@ -276,6 +268,22 @@ Draft Draft + + Unpin chat + Unpin chat + + + Pin chat + Pin chat + + + Unmute chat + Unmute chat + + + Mute chat + Mute chat + ChatPage diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 1983615..4eaa586 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -121,14 +121,6 @@ Leaving chat Saliendo de la charla - - Unmute Chat - Notificar - - - Mute Chat - No notificar - Unknown Desconocido @@ -180,6 +172,14 @@ New Secret Chat Charla secreta + + Unmute Chat + Notificar + + + Mute Chat + No notificar + ChatInformationTabItemMembersGroups @@ -237,14 +237,6 @@ You Usted - - Unmute Chat - Notificar - - - Mute Chat - No notificar - User Info Usuario @@ -273,6 +265,22 @@ Mark chat as read Marcar como leído + + Unpin chat + + + + Pin chat + + + + Unmute chat + Notificar + + + Mute chat + No notificar + ChatPage diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 5004959..478b93f 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -123,14 +123,6 @@ Leaving chat Poistutaan keskustelusta - - Unmute Chat - Poista keskustelun vaimennus - - - Mute Chat - Vaimenna keskustelu - Unknown Tuntematon @@ -183,6 +175,14 @@ New Secret Chat Uusi salattu keskustelu + + Unmute Chat + Poista keskustelun vaimennus + + + Mute Chat + Vaimenna keskustelu + ChatInformationTabItemMembersGroups @@ -240,14 +240,6 @@ You Sinä - - Unmute Chat - Poista keskustelun vaimennus - - - Mute Chat - Vaimenna keskustelu - User Info Käyttäjän tiedot @@ -276,6 +268,22 @@ Mark chat as read Merkitse keskustelu luetuksi + + Unpin chat + + + + Pin chat + + + + Unmute chat + Poista keskustelun vaimennus + + + Mute chat + Vaimenna keskustelu + ChatPage diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 2abc351..7dcd524 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -121,14 +121,6 @@ Leaving chat - - Unmute Chat - Csevegés némítás feloldása - - - Mute Chat - Csevegés némítása - Unknown Ismeretlen @@ -180,6 +172,14 @@ New Secret Chat + + Unmute Chat + Csevegés némítás feloldása + + + Mute Chat + Csevegés némítása + ChatInformationTabItemMembersGroups @@ -237,14 +237,6 @@ You Te - - Unmute Chat - Csevegés némítás feloldása - - - Mute Chat - Csevegés némítása - User Info @@ -273,6 +265,22 @@ Mark chat as read + + Unpin chat + + + + Pin chat + + + + Unmute chat + Csevegés némítás feloldása + + + Mute chat + Csevegés némítása + ChatPage diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 8c71667..47d99df 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -123,14 +123,6 @@ Leaving chat Lascia chat - - Unmute Chat - Riattiva suoni chat - - - Mute Chat - Silenzia chat - Unknown Sconosciuto @@ -183,6 +175,14 @@ New Secret Chat Nuova chat segreta + + Unmute Chat + Riattiva suoni chat + + + Mute Chat + Silenzia chat + ChatInformationTabItemMembersGroups @@ -240,14 +240,6 @@ You Tu - - Unmute Chat - Riattiva suoni chat - - - Mute Chat - Silenzia chat - User Info Info utente @@ -276,6 +268,22 @@ Mark chat as read + + Unpin chat + + + + Pin chat + + + + Unmute chat + Riattiva suoni chat + + + Mute chat + Silenzia chat + ChatPage diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index 8170d55..e1b9901 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -97,14 +97,6 @@ ChatInformationPageContent - - Unmute Chat - Wyłącz wyciszenie czatu - - - Mute Chat - Wycisz czat - Unknown Nieznany @@ -186,6 +178,14 @@ New Secret Chat Nowy tajny czat + + Unmute Chat + Wyłącz wyciszenie czatu + + + Mute Chat + Wycisz czat + ChatInformationTabItemMembersGroups @@ -243,14 +243,6 @@ You Ty - - Unmute Chat - Wyłącz wyciszenie czatu - - - Mute Chat - Wycisz czat - User Info Informacje o użytkowniku @@ -279,6 +271,22 @@ Mark chat as read Oznacz czat jako przeczytany + + Unpin chat + + + + Pin chat + + + + Unmute chat + Wyłącz wyciszenie czatu + + + Mute chat + Wycisz czat + ChatPage diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index a38f538..cc00fbd 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -125,14 +125,6 @@ Leaving chat Выход из чата - - Unmute Chat - Включить уведомления - - - Mute Chat - Выключить уведомления - Unknown Неизвестный @@ -186,6 +178,14 @@ New Secret Chat Новый секретный чат + + Unmute Chat + Включить уведомления + + + Mute Chat + Выключить уведомления + ChatInformationTabItemMembersGroups @@ -243,14 +243,6 @@ You Вы - - Unmute Chat - Включить уведомления - - - Mute Chat - Выключить уведомления - User Info Информация о пользователе @@ -279,6 +271,22 @@ Mark chat as read Отметить чат как прочитанный + + Unpin chat + + + + Pin chat + + + + Unmute chat + Включить уведомления + + + Mute chat + Выключить уведомления + ChatPage diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 1299738..4c290f1 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -123,14 +123,6 @@ Leaving chat Lämnar chatten - - Unmute Chat - Slå på chatten - - - Mute Chat - Stäng av chatten - Unknown Okänd @@ -183,6 +175,14 @@ New Secret Chat Ny hemlig chatt + + Unmute Chat + Slå på chatten + + + Mute Chat + Stäng av chatten + ChatInformationTabItemMembersGroups @@ -240,14 +240,6 @@ You Du - - Unmute Chat - Slå på chatten - - - Mute Chat - Stäng av chatten - User Info Användarinfo @@ -276,6 +268,22 @@ Mark chat as read Markera chatten som läst + + Unpin chat + + + + Pin chat + + + + Unmute chat + Slå på chatten + + + Mute chat + Stäng av chatten + ChatPage diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index a0c6e8d..c2559d8 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -121,14 +121,6 @@ Leaving chat 正在离开对话 - - Unmute Chat - 取消对话静音 - - - Mute Chat - 静音对话 - Unknown 未知 @@ -180,6 +172,14 @@ New Secret Chat 新加密对话 + + Unmute Chat + 取消对话静音 + + + Mute Chat + 静音对话 + ChatInformationTabItemMembersGroups @@ -237,14 +237,6 @@ You - - Unmute Chat - 取消对话静音 - - - Mute Chat - 静音对话 - User Info 用户信息 @@ -273,6 +265,22 @@ Mark chat as read 标记为已读 + + Unpin chat + + + + Pin chat + + + + Unmute chat + 取消对话静音 + + + Mute chat + 静音对话 + ChatPage diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index da64793..f3bb1d2 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -123,14 +123,6 @@ Leaving chat Leaving chat - - Unmute Chat - Unmute Chat - - - Mute Chat - Mute Chat - Unknown Unknown @@ -183,6 +175,14 @@ New Secret Chat + + Unmute Chat + Unmute Chat + + + Mute Chat + Mute Chat + ChatInformationTabItemMembersGroups @@ -240,14 +240,6 @@ You You - - Unmute Chat - Unmute Chat - - - Mute Chat - Mute Chat - User Info User Info @@ -276,6 +268,22 @@ Draft + + Unpin chat + + + + Pin chat + + + + Unmute chat + Unmute chat + + + Mute chat + Mute chat + ChatPage From 7f9166d1ae861eb8f0bbc95aeabb4adf3d7adaa4 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Fri, 8 Jan 2021 01:01:43 +0200 Subject: [PATCH 52/59] Initialize ChatModel::searchModeActive --- src/chatmodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index a89a74a..4086d9a 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -105,7 +105,8 @@ bool ChatModel::MessageData::lessThan(const MessageData *message1, const Message ChatModel::ChatModel(TDLibWrapper *tdLibWrapper) : chatId(0), inReload(false), - inIncrementalUpdate(false) + inIncrementalUpdate(false), + searchModeActive(false) { this->tdLibWrapper = tdLibWrapper; connect(this->tdLibWrapper, SIGNAL(messagesReceived(QVariantList, int)), this, SLOT(handleMessagesReceived(QVariantList, int))); From 4f275a540551b84b85ceeb64b464c8530b8c4b52 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Fri, 8 Jan 2021 02:44:18 +0200 Subject: [PATCH 53/59] Don't retry downloading too often --- src/tdlibfile.cpp | 38 +++++++++++++++++++++++++++++++++----- src/tdlibfile.h | 9 ++++++++- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/tdlibfile.cpp b/src/tdlibfile.cpp index 232fa9a..dece939 100644 --- a/src/tdlibfile.cpp +++ b/src/tdlibfile.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2020 Slava Monich at al. + Copyright (C) 2020-2021 Slava Monich at al. This file is part of Fernschreiber. @@ -107,6 +107,7 @@ void TDLibFile::init() queuedSignals = 0; firstQueuedSignal = SignalCount; autoLoad = false; + downloadHoldOffTimer = 0; id = 0; expected_size = 0; size = 0; @@ -174,7 +175,7 @@ void TDLibFile::updateTDLibWrapper(TDLibWrapper* tdlib) if (tdlib) { connect(tdlib, SIGNAL(fileUpdated(int,QVariantMap)), SLOT(handleFileUpdated(int,QVariantMap))); if (autoLoad) { - load(); + downloadFile(); } } queueSignal(SignalTdLibChanged); @@ -187,7 +188,7 @@ void TDLibFile::setAutoLoad(bool enableAutoLoad) autoLoad = enableAutoLoad; queueSignal(SignalAutoLoadChanged); if (autoLoad) { - load(); + downloadFile(); } emitQueuedSignals(); } @@ -195,7 +196,19 @@ void TDLibFile::setAutoLoad(bool enableAutoLoad) bool TDLibFile::load() { - if (id && tdLibWrapper && !is_downloading_active && !is_downloading_completed && can_be_downloaded) { + // Manual load ignores hold-off timer + if (downloadHoldOffTimer) { + killTimer(downloadHoldOffTimer); + downloadHoldOffTimer = 0; + } + return downloadFile(); +} + +bool TDLibFile::downloadFile() +{ + if (id && tdLibWrapper && !downloadHoldOffTimer && + !is_downloading_active && !is_downloading_completed && can_be_downloaded) { + downloadHoldOffTimer = startTimer(DownloadHoldOffMs); tdLibWrapper->downloadFile(id); return true; } @@ -205,12 +218,26 @@ bool TDLibFile::load() void TDLibFile::setFileInfo(const QVariantMap &fileInfo) { updateFileInfo(fileInfo); + if (is_downloading_completed && downloadHoldOffTimer) { + // Don't need this timer anymore + killTimer(downloadHoldOffTimer); + downloadHoldOffTimer = 0; + } if (autoLoad) { - load(); + downloadFile(); } emitQueuedSignals(); } +void TDLibFile::timerEvent(QTimerEvent *) +{ + killTimer(downloadHoldOffTimer); + downloadHoldOffTimer = 0; + if (autoLoad) { + downloadFile(); + } +} + void TDLibFile::handleFileUpdated(int fileId, const QVariantMap &fileInfo) { if (id == fileId) { @@ -256,6 +283,7 @@ void TDLibFile::updateFileInfo(const QVariantMap &file) bool b, fileChanged = false; int i = file.value(ID).toInt(); if (id != i) { + LOG("File id has changed" << id << "=>" << i); id = i; fileChanged = true; queueSignal(SignalIdChanged); diff --git a/src/tdlibfile.h b/src/tdlibfile.h index 9a16af4..0616271 100644 --- a/src/tdlibfile.h +++ b/src/tdlibfile.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2020 Slava Monich at al. + Copyright (C) 2020-2021 Slava Monich at al. This file is part of Fernschreiber. @@ -45,6 +45,8 @@ class TDLibFile : public QObject Q_PROPERTY(bool isUploadingActive READ isUploadingActive NOTIFY uploadingActiveChanged) Q_PROPERTY(bool isUploadingCompleted READ isUploadingCompleted NOTIFY uploadingCompletedChanged) + enum { DownloadHoldOffMs = 1000 }; + public: TDLibFile(); TDLibFile(TDLibWrapper *tdlib); @@ -102,10 +104,14 @@ signals: private slots: void handleFileUpdated(int fileId, const QVariantMap &fileInfo); +protected: + void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE; + private: void init(); void updateTDLibWrapper(TDLibWrapper* tdlib); void updateFileInfo(const QVariantMap &fileInfo); + bool downloadFile(); void queueSignal(uint signal); void emitQueuedSignals(); @@ -114,6 +120,7 @@ private: uint queuedSignals; uint firstQueuedSignal; bool autoLoad; + int downloadHoldOffTimer; // file QVariantMap infoMap; int id; From 92655b44172fc2827ca0db6594db698353e4c989 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Fri, 8 Jan 2021 04:14:31 +0200 Subject: [PATCH 54/59] Update webPage photo id when message gets updated --- qml/components/MessageListViewItem.qml | 17 +++--- qml/components/WebPagePreview.qml | 9 +++- qml/pages/ChatPage.qml | 1 + src/chatmodel.cpp | 73 ++++++++++++++++++++------ 4 files changed, 74 insertions(+), 26 deletions(-) diff --git a/qml/components/MessageListViewItem.qml b/qml/components/MessageListViewItem.qml index 2a3e32e..bc306e7 100644 --- a/qml/components/MessageListViewItem.qml +++ b/qml/components/MessageListViewItem.qml @@ -27,6 +27,7 @@ ListItem { contentHeight: messageBackground.height + Theme.paddingMedium property var chatId property var messageId + property int messageIndex property var myMessage property bool canReplyToMessage readonly property bool isAnonymous: myMessage.sender["@type"] === "messageSenderChat" @@ -159,13 +160,6 @@ ListItem { Debug.log("[ChatModel] Messages in this chat were read, new last read: ", lastReadSentIndex, ", updating description for index ", index, ", status: ", (index <= lastReadSentIndex)); messageDateText.text = getMessageStatusText(myMessage, index, lastReadSentIndex, messageDateText.useElapsed); } - onMessageUpdated: { - if (index === modelIndex) { - Debug.log("[ChatModel] This message was updated, index ", index, ", updating content..."); - messageDateText.text = getMessageStatusText(myMessage, index, chatView.lastReadSentIndex, messageDateText.useElapsed); - messageText.text = Emoji.emojify(Functions.getMessageText(myMessage, false, page.myUserId, false), messageText.font.pixelSize); - } - } } Connections { @@ -190,6 +184,15 @@ ListItem { } } + onMyMessageChanged: { + Debug.log("[ChatModel] This message was updated, index", messageIndex, ", updating content...") + messageDateText.text = getMessageStatusText(myMessage, messageIndex, chatView.lastReadSentIndex, messageDateText.useElapsed) + messageText.text = Emoji.emojify(Functions.getMessageText(myMessage, false, page.myUserId, false), messageText.font.pixelSize) + if (webPagePreviewLoader.item) { + webPagePreviewLoader.item.webPageData = myMessage.content.web_page + } + } + Timer { id: delegateComponentLoadingTimer interval: 500 diff --git a/qml/components/WebPagePreview.qml b/qml/components/WebPagePreview.qml index b1c9275..a814b73 100644 --- a/qml/components/WebPagePreview.qml +++ b/qml/components/WebPagePreview.qml @@ -33,7 +33,11 @@ Column { spacing: Theme.paddingSmall - Component.onCompleted: { + Component.onCompleted: updatePhoto() + + onWebPageDataChanged: updatePhoto() + + function updatePhoto() { if (webPageData) { if (webPageData.photo) { // Check first which size fits best... @@ -134,9 +138,10 @@ Column { } BackgroundImage { + id: backgroundImage visible: hasImage && singleImage.status !== Image.Ready layer.enabled: webPagePreviewColumn.highlighted - layer.effect: PressEffect { source: singleImage } + layer.effect: PressEffect { source: backgroundImage } } } diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 01c8e55..4db6a78 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -1029,6 +1029,7 @@ Page { chatId: chatModel.chatId myMessage: model.display messageId: model.message_id + messageIndex: model.index extraContentComponentName: chatView.contentComponentNames[model.content_type] || "" canReplyToMessage: chatPage.canSendMessages onReplyToMessage: { diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index a89a74a..8eea5f6 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -54,8 +54,10 @@ public: MessageData(const QVariantMap &data, qlonglong msgid); static bool lessThan(const MessageData *message1, const MessageData *message2); - void setContent(const QVariantMap &content); - void setReplyMarkup(const QVariantMap &replyMarkup); + QVector diff(const MessageData *message) const; + QVector setMessageData(const QVariantMap &data); + QVector setContent(const QVariantMap &content); + QVector setReplyMarkup(const QVariantMap &replyMarkup); int senderUserId() const; qlonglong senderChatId() const; bool senderIsChat() const; @@ -63,7 +65,7 @@ public: public: QVariantMap messageData; const qlonglong messageId; - const QString messageContentType; + QString messageContentType; }; ChatModel::MessageData::MessageData(const QVariantMap &data, qlonglong msgid) : @@ -88,13 +90,48 @@ bool ChatModel::MessageData::senderIsChat() const return messageData.value(SENDER).toMap().value(_TYPE).toString() == "messageSenderChat"; } -void ChatModel::MessageData::setContent(const QVariantMap &content) +QVector ChatModel::MessageData::diff(const MessageData *message) const { - messageData.insert(CONTENT, content); + QVector roles; + if (message != this) { + roles.append(RoleDisplay); + if (message->messageId != messageId) { + roles.append(RoleMessageId); + } + if (message->messageContentType != messageContentType) { + roles.append(RoleMessageContentType); + } + } + return roles; } -void ChatModel::MessageData::setReplyMarkup(const QVariantMap &replyMarkup) + +QVector ChatModel::MessageData::setMessageData(const QVariantMap &data) +{ + messageData = data; + QVector changedRoles; + changedRoles.append(RoleDisplay); + return changedRoles; +} + +QVector ChatModel::MessageData::setContent(const QVariantMap &content) +{ + const QString oldContentType(messageContentType); + messageData.insert(CONTENT, content); + messageContentType = content.value(_TYPE).toString(); + QVector changedRoles; + if (oldContentType != messageContentType) { + changedRoles.append(RoleMessageContentType); + } + changedRoles.append(RoleDisplay); + return changedRoles; +} + +QVector ChatModel::MessageData::setReplyMarkup(const QVariantMap &replyMarkup) { messageData.insert(REPLY_MARKUP, replyMarkup); + QVector changedRoles; + changedRoles.append(RoleDisplay); + return changedRoles; } bool ChatModel::MessageData::lessThan(const MessageData *message1, const MessageData *message2) @@ -370,11 +407,10 @@ void ChatModel::handleMessageReceived(qlonglong chatId, qlonglong messageId, con if (chatId == this->chatId && messageIndexMap.contains(messageId)) { LOG("Received a message that we already know, let's update it!"); const int position = messageIndexMap.value(messageId); - MessageData *messageData = messages.at(position); - messageData->messageData = message; + const QVector changedRoles(messages.at(position)->setMessageData(message)); LOG("Message was updated at index" << position); const QModelIndex messageIndex(index(position)); - emit dataChanged(messageIndex, messageIndex); + emit dataChanged(messageIndex, messageIndex, changedRoles); } } @@ -405,11 +441,14 @@ void ChatModel::handleMessageSendSucceeded(qlonglong messageId, qlonglong oldMes if (this->messageIndexMap.contains(oldMessageId)) { LOG("Message was successfully sent" << oldMessageId); const int pos = messageIndexMap.take(oldMessageId); - delete messages.at(pos); - messages.replace(pos, new MessageData(message, messageId)); + MessageData* oldMessage = messages.at(pos); + MessageData* newMessage = new MessageData(message, messageId); + messages.replace(pos, newMessage); + const QVector changedRoles(newMessage->diff(oldMessage)); + delete oldMessage; LOG("Message was replaced at index" << pos); const QModelIndex messageIndex(index(pos)); - emit dataChanged(messageIndex, messageIndex); + emit dataChanged(messageIndex, messageIndex, changedRoles); emit lastReadSentMessageUpdated(calculateLastReadSentMessageId()); } } @@ -448,10 +487,10 @@ void ChatModel::handleMessageContentUpdated(qlonglong chatId, qlonglong messageI LOG("We know the message that was updated" << messageId); const int pos = messageIndexMap.value(messageId, -1); if (pos >= 0) { - messages.at(pos)->setContent(newContent); - LOG("Message was replaced at index" << pos); + const QVector changedRoles(messages.at(pos)->setContent(newContent)); + LOG("Message was updated at index" << pos); const QModelIndex messageIndex(index(pos)); - emit dataChanged(messageIndex, messageIndex); + emit dataChanged(messageIndex, messageIndex, changedRoles); emit messageUpdated(pos); } } @@ -464,10 +503,10 @@ void ChatModel::handleMessageEditedUpdated(qlonglong chatId, qlonglong messageId LOG("We know the message that was updated" << messageId); const int pos = messageIndexMap.value(messageId, -1); if (pos >= 0) { - messages.at(pos)->setReplyMarkup(replyMarkup); + const QVector changedRoles(messages.at(pos)->setReplyMarkup(replyMarkup)); LOG("Message was edited at index" << pos); const QModelIndex messageIndex(index(pos)); - emit dataChanged(messageIndex, messageIndex); + emit dataChanged(messageIndex, messageIndex, changedRoles); emit messageUpdated(pos); } } From 01ffec0a0cc444b3561fcc95e26b99f3e5c3e45a Mon Sep 17 00:00:00 2001 From: iamnomeutente <72705765+iamnomeutente@users.noreply.github.com> Date: Fri, 8 Jan 2021 20:19:00 +0100 Subject: [PATCH 55/59] Update harbour-fernschreiber-it.ts --- translations/harbour-fernschreiber-it.ts | 98 ++++++++++++------------ 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 47d99df..297ddd5 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -258,23 +258,23 @@ Mark chat as unread - + Segna chat come non letta Draft - + Bozza Mark chat as read - + Segna chat come letta Unpin chat - + Togli chat in evidenza Pin chat - + Metti chat in evidenza Unmute chat @@ -413,19 +413,19 @@ Search in Chat - + Cerca nella chat Search in chat... - + Cerca nella chat... Location: Obtaining position... - + Posizione: ottengo posizione... Location (%1/%2) - + Posizione(%1/%2) @@ -803,21 +803,21 @@ has added %1 to the chat - + ha aggiunto %1 alla chat has removed %1 from the chat - + ha rimosso %1 dalla chat have added %1 to the chat myself - + hai aggiunto %1 alla chat have removed %1 from the chat myself - + hai rimosso %1 dalla chat @@ -956,11 +956,11 @@ Message unpinned - Messaggio non più in evidenza + Messaggio non più in evidenza Unpin Message - + Togli messaggio in evidenza @@ -1082,31 +1082,31 @@ Filter your chats... - + Filtra le chat... Search Chats - + Ricerca chat Download of %1 successful. - Download di %1 completato. + Download di %1 completato. Download failed. - Download non riuscito. + Download non riuscito. Tap on the title bar to filter your chats - + Clicca sulla barra del titolo per filtrare le tue chat No matching chats found. - + Nessuna chat corrispondente. You can search public chats or create a new chat via the pull-down menu. - + Puoi creare una nuova chat o cercare chat pubbliche dal menu a trascinamento. @@ -1306,49 +1306,49 @@ SearchChatsPage No chats found. - + Nessuna chat trovata. Searching chats... - + Ricerca chat... Private Chat - Chat privata + Chat privata Group - + Gruppo Channel - + Canale %1 members - + %1 membro - + %1 membri %1 subscribers - + %1 abbonato - + %1 abbonati Search Chats - + Cerca chat Search a chat... - + Cerca chat... Enter your query to start searching (at least 5 characters needed) - + Scrivi il testo che vuoi cercare (almeno 5 caratteri) @@ -1427,11 +1427,11 @@ Focus text input area after send - + Tastiera in primo piano dopo invio Focus the text input area after sending a message - + Mantieni la tastiera in primo piano dopo aver inviato un messaggio @@ -1464,39 +1464,39 @@ VoiceNoteOverlay Record a Voice Note - + Registra una nota vocale Press the button to start recording - + Premi il pulsante per iniziare la registrazione Unavailable - + Non disponibile Starting - + Inizia Recording - + In registrazione Stopping - + Stop Use recording - + Usa registrazione Voice Note (%1) - + Nota vocale (%1) Ready - + Pronto @@ -1884,21 +1884,21 @@ has added %1 to the chat - + ha aggiunto %1 alla chat has removed %1 from the chat - + ha rimosso %1 dalla chat have added %1 to the chat myself - + hai aggiunto %1 alla chat have removed %1 from the chat myself - + hai rimosso %1 dalla chat From 1523d623623ee28d656683616970b93efb4b4d53 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sat, 9 Jan 2021 22:25:58 +0100 Subject: [PATCH 56/59] Chat List: Muted icon now always visible, fixes #156 --- qml/components/ChatListViewItem.qml | 3 ++- qml/components/PhotoTextsListItem.qml | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/qml/components/ChatListViewItem.qml b/qml/components/ChatListViewItem.qml index b05f364..30f2435 100644 --- a/qml/components/ChatListViewItem.qml +++ b/qml/components/ChatListViewItem.qml @@ -15,7 +15,7 @@ PhotoTextsListItem { property string previewText: showDraft ? draft_message_text : last_message_text // chat title - primaryText.text: title ? Emoji.emojify(title + ( display.notification_settings.mute_for > 0 ? " 🔇" : "" ), Theme.fontSizeMedium) : qsTr("Unknown") + primaryText.text: title ? Emoji.emojify(title, Theme.fontSizeMedium) : qsTr("Unknown") // last user prologSecondaryText.text: showDraft ? ""+qsTr("Draft")+"" : (is_channel ? "" : ( last_message_sender_id ? ( last_message_sender_id !== ownUserId ? Emoji.emojify(Functions.getUserName(tdLibWrapper.getUserInformation(last_message_sender_id)), primaryText.font.pixelSize) : qsTr("You") ) : "" )) // last message @@ -26,6 +26,7 @@ PhotoTextsListItem { isSecret: ( chat_type === TelegramAPI.ChatTypeSecret ) isMarkedAsUnread: is_marked_as_unread isPinned: is_pinned + isMuted: display.notification_settings.mute_for > 0 openMenuOnPressAndHold: true//chat_id != overviewPage.ownUserId diff --git a/qml/components/PhotoTextsListItem.qml b/qml/components/PhotoTextsListItem.qml index 1be2fdf..5c69d39 100644 --- a/qml/components/PhotoTextsListItem.qml +++ b/qml/components/PhotoTextsListItem.qml @@ -15,6 +15,7 @@ ListItem { property bool isVerified: false property bool isMarkedAsUnread: false property bool isPinned: false + property bool isMuted: false property alias pictureThumbnail: pictureThumbnail contentHeight: mainRow.height + separator.height + 2 * Theme.paddingMedium @@ -125,15 +126,26 @@ ListItem { font.pixelSize: Theme.fontSizeMedium truncationMode: TruncationMode.Fade anchors.verticalCenter: parent.verticalCenter - width: Math.min(contentColumn.width - (verifiedImage.visible ? (verifiedImage.width + primaryTextRow.spacing) : 0), implicitWidth) + width: Math.min(contentColumn.width - (verifiedImage.visible ? (verifiedImage.width + primaryTextRow.spacing) : 0) - (mutedImage.visible ? (mutedImage.width + primaryTextRow.spacing) : 0), implicitWidth) } Image { id: verifiedImage anchors.verticalCenter: parent.verticalCenter source: chatListViewItem.isVerified ? "../../images/icon-verified.svg" : "" - sourceSize.width: Theme.iconSizeExtraSmall - width: Theme.iconSizeExtraSmall + sourceSize: Qt.size(Theme.iconSizeExtraSmall, Theme.iconSizeExtraSmall) + width: Theme.iconSizeSmall + height: Theme.iconSizeSmall + visible: status === Image.Ready + } + + Image { + id: mutedImage + anchors.verticalCenter: parent.verticalCenter + source: chatListViewItem.isMuted ? "../js/emoji/1f507.svg" : "" + sourceSize: Qt.size(Theme.iconSizeExtraSmall, Theme.iconSizeExtraSmall) + width: Theme.iconSizeSmall + height: Theme.iconSizeSmall visible: status === Image.Ready } } From b70a4427e0baf2950621830832851adf93481e2c Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sun, 10 Jan 2021 04:25:02 +0200 Subject: [PATCH 57/59] Apply press effect to profile thumbnail in chat list --- qml/components/ChatListViewItem.qml | 1 + qml/components/ProfileThumbnail.qml | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/qml/components/ChatListViewItem.qml b/qml/components/ChatListViewItem.qml index 30f2435..684f02a 100644 --- a/qml/components/ChatListViewItem.qml +++ b/qml/components/ChatListViewItem.qml @@ -9,6 +9,7 @@ PhotoTextsListItem { id: listItem pictureThumbnail { photoData: photo_small || ({}) + highlighted: listItem.highlighted && !listItem.menuOpen } property int ownUserId property bool showDraft: !!draft_message_text && draft_message_date > last_message_date diff --git a/qml/components/ProfileThumbnail.qml b/qml/components/ProfileThumbnail.qml index 04f7cf9..555cc1c 100644 --- a/qml/components/ProfileThumbnail.qml +++ b/qml/components/ProfileThumbnail.qml @@ -22,7 +22,6 @@ import Sailfish.Silica 1.0 import WerkWolf.Fernschreiber 1.0 Item { - id: profileThumbnail property alias photoData: file.fileInformation @@ -30,6 +29,10 @@ Item { property int radius: width / 2 property int imageStatus: -1 property bool optimizeImageSize: true + property bool highlighted + + layer.enabled: highlighted + layer.effect: PressEffect { source: profileThumbnail } function getReplacementString() { if (replacementStringHint.length > 2) { From d4935a49683079bd38a92dae71d5cb37c915e251 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 10 Jan 2021 13:35:34 +0100 Subject: [PATCH 58/59] Introduce online-only mode as non-default option, fixes #77 --- qml/pages/CoverPage.qml | 11 ++++++++- qml/pages/OverviewPage.qml | 5 +++++ qml/pages/SettingsPage.qml | 10 +++++++++ src/appsettings.cpp | 15 +++++++++++++ src/appsettings.h | 5 +++++ src/chatlistmodel.cpp | 25 ++++++++++++++++++++- src/chatlistmodel.h | 6 ++++- src/harbour-fernschreiber.cpp | 2 +- src/tdlibwrapper.cpp | 7 +++--- translations/harbour-fernschreiber-de.ts | 8 +++++++ translations/harbour-fernschreiber-en.ts | 12 ++++++++-- translations/harbour-fernschreiber-es.ts | 8 +++++++ translations/harbour-fernschreiber-fi.ts | 8 +++++++ translations/harbour-fernschreiber-hu.ts | 8 +++++++ translations/harbour-fernschreiber-it.ts | 8 +++++++ translations/harbour-fernschreiber-pl.ts | 8 +++++++ translations/harbour-fernschreiber-ru.ts | 8 +++++++ translations/harbour-fernschreiber-sv.ts | 8 +++++++ translations/harbour-fernschreiber-zh_CN.ts | 8 +++++++ translations/harbour-fernschreiber.ts | 8 +++++++ 20 files changed, 169 insertions(+), 9 deletions(-) diff --git a/qml/pages/CoverPage.qml b/qml/pages/CoverPage.qml index 9e5df33..1a29b8d 100644 --- a/qml/pages/CoverPage.qml +++ b/qml/pages/CoverPage.qml @@ -67,7 +67,7 @@ CoverBackground { coverPage.authenticated = (tdLibWrapper.getAuthorizationState() === TelegramAPI.AuthorizationReady); coverPage.connectionState = tdLibWrapper.getConnectionState(); coverPage.unreadMessages = tdLibWrapper.getUnreadMessageInformation().unread_count || 0; - coverPage.unreadChats = tdLibWrapper.getUnreadChatInformation().unread_count; + coverPage.unreadChats = tdLibWrapper.getUnreadChatInformation().unread_count || 0; setUnreadInfoText(); } @@ -91,6 +91,15 @@ CoverBackground { } } + Connections { + target: chatListModel + onUnreadStateChanged: { + coverPage.unreadMessages = unreadMessagesCount; + coverPage.unreadChats = unreadChatsCount; + setUnreadInfoText(); + } + } + BackgroundImage { id: backgroundImage width: parent.height - Theme.paddingLarge diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml index 3ad74a9..f9abc67 100644 --- a/qml/pages/OverviewPage.qml +++ b/qml/pages/OverviewPage.qml @@ -87,6 +87,7 @@ Page { id: updateSecondaryContentTimer interval: 600 onTriggered: { + chatListModel.calculateUnreadState(); tdLibWrapper.getRecentStickers(); tdLibWrapper.getInstalledStickerSets(); tdLibWrapper.getContacts(); @@ -192,11 +193,15 @@ Page { onChatLastMessageUpdated: { if (!overviewPage.chatListCreated) { chatListCreatedTimer.restart(); + } else { + chatListModel.calculateUnreadState(); } } onChatOrderUpdated: { if (!overviewPage.chatListCreated) { chatListCreatedTimer.restart(); + } else { + chatListModel.calculateUnreadState(); } } onChatsReceived: { diff --git a/qml/pages/SettingsPage.qml b/qml/pages/SettingsPage.qml index 800d5ef..b91691e 100644 --- a/qml/pages/SettingsPage.qml +++ b/qml/pages/SettingsPage.qml @@ -172,6 +172,16 @@ Page { } } + TextSwitch { + checked: appSettings.onlineOnlyMode + text: qsTr("Enable online-only mode") + description: qsTr("Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect.") + automaticCheck: false + onClicked: { + appSettings.onlineOnlyMode = !checked + } + } + Item { width: 1 height: Theme.paddingLarge // Some space at the bottom diff --git a/src/appsettings.cpp b/src/appsettings.cpp index f71a5dd..d9239a9 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -30,6 +30,7 @@ namespace { const QString KEY_NOTIFICATION_FEEDBACK("notificationFeedback"); const QString KEY_STORAGE_OPTIMIZER("storageOptimizer"); const QString KEY_REMAINING_INTERACTION_HINTS("remainingInteractionHints"); + const QString KEY_ONLINE_ONLY_MODE("onlineOnlyMode"); } AppSettings::AppSettings(QObject *parent) : QObject(parent), settings("harbour-fernschreiber", "settings") @@ -161,3 +162,17 @@ void AppSettings::setRemainingInteractionHints(int remainingHints) emit remainingInteractionHintsChanged(); } } + +bool AppSettings::onlineOnlyMode() const +{ + return settings.value(KEY_ONLINE_ONLY_MODE, false).toBool(); +} + +void AppSettings::setOnlineOnlyMode(bool enable) +{ + if (onlineOnlyMode() != enable) { + LOG(KEY_ONLINE_ONLY_MODE << enable); + settings.setValue(KEY_ONLINE_ONLY_MODE, enable); + emit onlineOnlyModeChanged(); + } +} diff --git a/src/appsettings.h b/src/appsettings.h index bc840e6..373d3df 100644 --- a/src/appsettings.h +++ b/src/appsettings.h @@ -32,6 +32,7 @@ class AppSettings : public QObject { Q_PROPERTY(NotificationFeedback notificationFeedback READ notificationFeedback WRITE setNotificationFeedback NOTIFY notificationFeedbackChanged) Q_PROPERTY(bool storageOptimizer READ storageOptimizer WRITE setStorageOptimizer NOTIFY storageOptimizerChanged) Q_PROPERTY(int remainingInteractionHints READ remainingInteractionHints WRITE setRemainingInteractionHints NOTIFY remainingInteractionHintsChanged) + Q_PROPERTY(bool onlineOnlyMode READ onlineOnlyMode WRITE setOnlineOnlyMode NOTIFY onlineOnlyModeChanged) public: enum NotificationFeedback { @@ -71,6 +72,9 @@ public: int remainingInteractionHints() const; void setRemainingInteractionHints(int remainingHints); + bool onlineOnlyMode() const; + void setOnlineOnlyMode(bool enable); + signals: void sendByEnterChanged(); void focusTextAreaAfterSendChanged(); @@ -81,6 +85,7 @@ signals: void notificationFeedbackChanged(); void storageOptimizerChanged(); void remainingInteractionHintsChanged(); + void onlineOnlyModeChanged(); private: QSettings settings; diff --git a/src/chatlistmodel.cpp b/src/chatlistmodel.cpp index 3c7bd56..f6de2be 100644 --- a/src/chatlistmodel.cpp +++ b/src/chatlistmodel.cpp @@ -19,6 +19,7 @@ #include "chatlistmodel.h" #include "fernschreiberutils.h" +#include #define DEBUG_MODULE ChatListModel #include "debuglog.h" @@ -353,9 +354,10 @@ QVector ChatListModel::ChatData::updateSecretChat(const QVariantMap &secret return changedRoles; } -ChatListModel::ChatListModel(TDLibWrapper *tdLibWrapper) : showHiddenChats(false) +ChatListModel::ChatListModel(TDLibWrapper *tdLibWrapper, AppSettings *appSettings) : showHiddenChats(false) { this->tdLibWrapper = tdLibWrapper; + this->appSettings = appSettings; connect(tdLibWrapper, SIGNAL(newChatDiscovered(QString, QVariantMap)), this, SLOT(handleChatDiscovered(QString, QVariantMap))); connect(tdLibWrapper, SIGNAL(chatLastMessageUpdated(QString, QString, QVariantMap)), this, SLOT(handleChatLastMessageUpdated(QString, QString, QVariantMap))); connect(tdLibWrapper, SIGNAL(chatOrderUpdated(QString, QString)), this, SLOT(handleChatOrderUpdated(QString, QString))); @@ -519,6 +521,26 @@ int ChatListModel::updateChatOrder(int chatIndex) return newIndex; } +void ChatListModel::calculateUnreadState() +{ + if (this->appSettings->onlineOnlyMode()) { + LOG("Online-only mode: Calculating unread state on my own..."); + int unreadMessages = 0; + int unreadChats = 0; + QListIterator chatIterator(this->chatList); + while (chatIterator.hasNext()) { + ChatData *currentChat = chatIterator.next(); + int unreadCount = currentChat->unreadCount(); + if (unreadCount > 0) { + unreadChats++; + unreadMessages += unreadCount; + } + } + LOG("Online-only mode: New unread state:" << unreadMessages << unreadChats); + emit unreadStateChanged(unreadMessages, unreadChats); + } +} + void ChatListModel::addVisibleChat(ChatData *chat) { const int n = chatList.size(); @@ -719,6 +741,7 @@ void ChatListModel::handleChatReadInboxUpdated(const QString &id, const QString } const QModelIndex modelIndex(index(chatIndex)); emit dataChanged(modelIndex, modelIndex, changedRoles); + this->calculateUnreadState(); } else { ChatData *chat = hiddenChats.value(chatId); if (chat) { diff --git a/src/chatlistmodel.h b/src/chatlistmodel.h index f70b64a..91fd8a0 100644 --- a/src/chatlistmodel.h +++ b/src/chatlistmodel.h @@ -22,6 +22,7 @@ #include #include "tdlibwrapper.h" +#include "appsettings.h" class ChatListModel : public QAbstractListModel { @@ -53,7 +54,7 @@ public: RoleDraftMessageDate }; - ChatListModel(TDLibWrapper *tdLibWrapper); + ChatListModel(TDLibWrapper *tdLibWrapper, AppSettings *appSettings); ~ChatListModel() override; virtual QHash roleNames() const override; @@ -63,6 +64,7 @@ public: Q_INVOKABLE void redrawModel(); Q_INVOKABLE QVariantMap get(int row); Q_INVOKABLE QVariantMap getById(qlonglong chatId); + Q_INVOKABLE void calculateUnreadState(); bool showAllChats() const; void setShowAllChats(bool showAll); @@ -89,6 +91,7 @@ signals: void showAllChatsChanged(); void chatChanged(const qlonglong &changedChatId); void chatJoined(const qlonglong &chatId, const QString &chatTitle); + void unreadStateChanged(int unreadMessagesCount, int unreadChatsCount); private: class ChatData; @@ -99,6 +102,7 @@ private: private: TDLibWrapper *tdLibWrapper; + AppSettings *appSettings; QTimer *relativeTimeRefreshTimer; QList chatList; QHash chatIndexMap; diff --git a/src/harbour-fernschreiber.cpp b/src/harbour-fernschreiber.cpp index 0852fea..51febb6 100644 --- a/src/harbour-fernschreiber.cpp +++ b/src/harbour-fernschreiber.cpp @@ -87,7 +87,7 @@ int main(int argc, char *argv[]) DBusAdaptor *dBusAdaptor = tdLibWrapper->getDBusAdaptor(); context->setContextProperty("dBusAdaptor", dBusAdaptor); - ChatListModel chatListModel(tdLibWrapper); + ChatListModel chatListModel(tdLibWrapper, appSettings); context->setContextProperty("chatListModel", &chatListModel); QSortFilterProxyModel chatListProxyModel(view.data()); chatListProxyModel.setSourceModel(&chatListModel); diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp index ffa0b5e..80d8520 100644 --- a/src/tdlibwrapper.cpp +++ b/src/tdlibwrapper.cpp @@ -1476,9 +1476,10 @@ void TDLibWrapper::setInitialParameters() initialParameters.insert("api_id", TDLIB_API_ID); initialParameters.insert("api_hash", TDLIB_API_HASH); initialParameters.insert("database_directory", QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/tdlib"); - initialParameters.insert("use_file_database", true); - initialParameters.insert("use_chat_info_database", true); - initialParameters.insert("use_message_database", true); + bool onlineOnlyMode = this->appSettings->onlineOnlyMode(); + initialParameters.insert("use_file_database", !onlineOnlyMode); + initialParameters.insert("use_chat_info_database", !onlineOnlyMode); + initialParameters.insert("use_message_database", !onlineOnlyMode); initialParameters.insert("use_secret_chats", true); initialParameters.insert("system_language_code", QLocale::system().name()); QSettings hardwareSettings("/etc/hw-release", QSettings::NativeFormat); diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 4e85e52..242205e 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -1433,6 +1433,14 @@ Focus the text input area after sending a message Fokussiert die Texteingabe nach Senden einer Nachricht + + Enable online-only mode + Nur-Online-Modus einschalten + + + Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. + Schaltet das Offline-Caching aus. Bestimmte Features können in diesem Modus eingeschränkt sein oder fehlen. Änderungen erfordern einen Neustart von Fernschreiber, um in Kraft zu treten. + StickerPicker diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 76ae152..92d3ed7 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -177,11 +177,11 @@ Unmute Chat - Unmute Chat + Unmute Chat Mute Chat - Mute Chat + Mute Chat @@ -1433,6 +1433,14 @@ Focus the text input area after sending a message Focus the text input area after sending a message + + Enable online-only mode + Enable online-only mode + + + Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. + Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. + StickerPicker diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 4eaa586..f9c2938 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -1412,6 +1412,14 @@ Focus the text input area after sending a message Enfoca el área de entrada de texto después de enviar un mensaje + + Enable online-only mode + + + + Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. + + StickerPicker diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index 478b93f..e336b49 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -1434,6 +1434,14 @@ Focus the text input area after sending a message Kohdista tekstinsyöttökenttä viestin lähetyksen jälkeen + + Enable online-only mode + + + + Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. + + StickerPicker diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 7dcd524..04bc2c7 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -1412,6 +1412,14 @@ Focus the text input area after sending a message + + Enable online-only mode + + + + Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. + + StickerPicker diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 297ddd5..7ef5901 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -1433,6 +1433,14 @@ Focus the text input area after sending a message Mantieni la tastiera in primo piano dopo aver inviato un messaggio + + Enable online-only mode + + + + Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. + + StickerPicker diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index e1b9901..35ce4ee 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -1454,6 +1454,14 @@ Focus the text input area after sending a message Po wysłaniu wiadomości zaznacz pole wprowadzania tekstu + + Enable online-only mode + + + + Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. + + StickerPicker diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index cc00fbd..715b035 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -1454,6 +1454,14 @@ Focus the text input area after sending a message Сфокусироваться на поле ввода текста после отправки сообщения + + Enable online-only mode + + + + Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. + + StickerPicker diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 4c290f1..72292c0 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -1433,6 +1433,14 @@ Focus the text input area after sending a message Fokusera textinmatningsfältet efter att ett meddelande skickats + + Enable online-only mode + + + + Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. + + StickerPicker diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index c2559d8..8f1e00d 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -1413,6 +1413,14 @@ Focus the text input area after sending a message 发送消息后聚焦文本输入区域 + + Enable online-only mode + + + + Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. + + StickerPicker diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index f3bb1d2..a99ac10 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -1433,6 +1433,14 @@ Focus the text input area after sending a message + + Enable online-only mode + + + + Disables offline caching. Certain features may be limited or missing in this mode. Changes require a restart of Fernschreiber to take effect. + + StickerPicker From be2f08553bb0d0fb7288c8baa68c4c5f3473cb96 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Sun, 10 Jan 2021 20:26:29 +0100 Subject: [PATCH 59/59] Add button to copy document to Downloads folder --- qml/components/DocumentPreview.qml | 47 +++++++++++++++------ translations/harbour-fernschreiber-de.ts | 4 ++ translations/harbour-fernschreiber-en.ts | 4 ++ translations/harbour-fernschreiber-es.ts | 4 ++ translations/harbour-fernschreiber-fi.ts | 4 ++ translations/harbour-fernschreiber-hu.ts | 4 ++ translations/harbour-fernschreiber-it.ts | 4 ++ translations/harbour-fernschreiber-pl.ts | 4 ++ translations/harbour-fernschreiber-ru.ts | 4 ++ translations/harbour-fernschreiber-sv.ts | 4 ++ translations/harbour-fernschreiber-zh_CN.ts | 4 ++ translations/harbour-fernschreiber.ts | 4 ++ 12 files changed, 79 insertions(+), 12 deletions(-) diff --git a/qml/components/DocumentPreview.qml b/qml/components/DocumentPreview.qml index df5a6f1..fa1e7cf 100644 --- a/qml/components/DocumentPreview.qml +++ b/qml/components/DocumentPreview.qml @@ -41,9 +41,9 @@ Item { if (documentData) { if (documentData.document.local.is_downloading_completed) { downloadDocumentButton.visible = false; - openDocumentButton.visible = true; + openDocumentArea.visible = true; } else { - openDocumentButton.visible = false; + openDocumentArea.visible = false; downloadDocumentButton.visible = true; } } @@ -57,7 +57,7 @@ Item { downloadingProgressBar.visible = false; documentData.document = fileInformation; downloadDocumentButton.visible = false; - openDocumentButton.visible = true; + openDocumentArea.visible = true; if (documentPreviewItem.openRequested) { documentPreviewItem.openRequested = false; tdLibWrapper.openFileOnDevice(documentData.document.local.path); @@ -95,17 +95,40 @@ Item { anchors.centerIn: parent } - Button { - id: openDocumentButton - preferredWidth: Theme.buttonWidthMedium - anchors.centerIn: parent - text: qsTr("Open Document") + Column { + id: openDocumentArea visible: false - highlighted: documentPreviewItem.highlighted || down - onClicked: { - documentPreviewItem.openRequested = true; - tdLibWrapper.openFileOnDevice(documentData.document.local.path); + spacing: Theme.paddingMedium + width: parent.width + + onVisibleChanged: { + visible ? (documentPreviewItem.height = openDocumentArea.height) : (documentPreviewItem.height = Theme.itemSizeLarge); + } + + Button { + id: openDocumentButton + preferredWidth: Theme.buttonWidthMedium + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Open Document") + highlighted: documentPreviewItem.highlighted || down + onClicked: { + documentPreviewItem.openRequested = true; + tdLibWrapper.openFileOnDevice(documentData.document.local.path); + } + } + + Button { + id: copyDocumentButton + preferredWidth: Theme.buttonWidthMedium + anchors.horizontalCenter: parent.horizontalCenter + text: qsTr("Copy Document to Downloads") + highlighted: documentPreviewItem.highlighted || down + onClicked: { + tdLibWrapper.copyFileToDownloads(documentData.document.local.path); + } } } + + } diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index 242205e..ced219c 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -492,6 +492,10 @@ Open Document Dokument öffnen + + Copy Document to Downloads + Dokument zu Downloads kopieren + EditGroupChatPermissionsColumn diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 92d3ed7..a4bdfce 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -492,6 +492,10 @@ Open Document Open Document + + Copy Document to Downloads + Copy Document to Downloads + EditGroupChatPermissionsColumn diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index f9c2938..7391c64 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -482,6 +482,10 @@ Open Document Abrir Documento + + Copy Document to Downloads + + EditGroupChatPermissionsColumn diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index e336b49..1be7379 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -493,6 +493,10 @@ Open Document Avaa dokumentti + + Copy Document to Downloads + + EditGroupChatPermissionsColumn diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 04bc2c7..ea3bdcf 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -482,6 +482,10 @@ Open Document Dokumentum megyitása + + Copy Document to Downloads + + EditGroupChatPermissionsColumn diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 7ef5901..4585d13 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -492,6 +492,10 @@ Open Document Apri documento + + Copy Document to Downloads + + EditGroupChatPermissionsColumn diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index 35ce4ee..17d3b8e 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -502,6 +502,10 @@ Open Document Otwórz dokument + + Copy Document to Downloads + + EditGroupChatPermissionsColumn diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 715b035..2dd92ea 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -502,6 +502,10 @@ Open Document Открыть документ + + Copy Document to Downloads + + EditGroupChatPermissionsColumn diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index 72292c0..ad35d9e 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -492,6 +492,10 @@ Open Document Öppna dokument + + Copy Document to Downloads + + EditGroupChatPermissionsColumn diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 8f1e00d..c74a8a5 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -483,6 +483,10 @@ Open Document 打开文档 + + Copy Document to Downloads + + EditGroupChatPermissionsColumn diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index a99ac10..acf72ba 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -492,6 +492,10 @@ Open Document Open Document + + Copy Document to Downloads + + EditGroupChatPermissionsColumn