Spectral/qml/component/AudioBubble.qml

51 lines
1.4 KiB
QML
Raw Normal View History

2018-07-16 14:05:34 +00:00
import QtQuick 2.9
import QtQuick.Controls 2.2
2018-08-17 07:58:08 +00:00
import QtQuick.Controls.Material 2.2
import QtMultimedia 5.9
import Qt.labs.platform 1.0
2018-07-16 14:05:34 +00:00
AvatarContainer {
2018-08-17 07:58:08 +00:00
readonly property var downloadAndOpen: downloadable.downloadAndOpen
readonly property var saveFileAs: downloadable.saveFileAs
2018-07-16 14:05:34 +00:00
2018-08-17 07:58:08 +00:00
property bool playOnFinished: false
2018-07-16 14:05:34 +00:00
2018-08-17 07:58:08 +00:00
id: messageRow
2018-07-16 14:05:34 +00:00
2018-08-17 07:58:08 +00:00
DownloadableContent {
id: downloadable
width: downloadDelegate.width
height: downloadDelegate.height
TextDelegate {
id: downloadDelegate
maximumWidth: messageListView.width
highlighted: !sentByMe
timeLabelVisible: false
authorLabelVisible: false
2018-08-17 07:58:08 +00:00
displayText: content.info.duration / 1000 + '"'
MouseArea {
anchors.fill: parent
propagateComposedEvents: true
onClicked: {
if (downloadable.downloaded)
matriqueController.playAudio(progressInfo.localPath)
2018-08-17 07:58:08 +00:00
else
{
playOnFinished = true
currentRoom.downloadFile(eventId, StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + eventId.replace(":", "_") + ".tmp")
}
}
}
2018-07-16 14:05:34 +00:00
}
onDownloadedChanged: downloaded && playOnFinished ? matriqueController.playAudio(progressInfo.localPath) : {}
}
2018-07-16 14:05:34 +00:00
}