From 9662df3c74f9708fb9558b9842aadfeb12fb3cd7 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Thu, 31 Dec 2020 19:12:50 +0100 Subject: [PATCH] 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