From e8633b7a13de9fcb56ee29a9fc36d5520c2514a9 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 13 Mar 2021 18:53:42 +0300 Subject: Add support for audio and voice messages --- qml/Message.qml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'qml') diff --git a/qml/Message.qml b/qml/Message.qml index a217bc8..9134a72 100644 --- a/qml/Message.qml +++ b/qml/Message.qml @@ -3,6 +3,7 @@ import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 import QtQml.Models 2.1 import QtQuick.Dialogs 1.1 +import QtMultimedia 5.8 import org.kde.kirigami 2.12 as Kirigami import DeltaChat 1.0 @@ -45,6 +46,26 @@ RowLayout { } } + Component { + id: audioMessageView + + ColumnLayout { + MediaPlayer { + id: player + source: Qt.resolvedUrl("file:" + messageObject.message.file) + } + Label { + font.bold: true + text: "Audio" + textFormat: Text.PlainText + } + Button { + text: "play" + onPressed: player.play() + } + } + } + Component { id: textMessageView @@ -99,7 +120,8 @@ RowLayout { Loader { - sourceComponent: messageObject.message.viewtype == 20 ? imageMessageView : textMessageView + sourceComponent: [20, 21, 23].includes(messageObject.message.viewtype) ? imageMessageView + : [40, 41].includes(messageObject.message.viewtype) ? audioMessageView : textMessageView } TextEdit { -- cgit v1.2.3-70-g09d2