Improve AudioBubble && fix flathub issue.

square-messages
Black Hat 2018-08-17 19:46:46 +08:00
parent 6e79bf6495
commit 6752791f5e
3 changed files with 12 additions and 10 deletions

4
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "include/SortFilterProxyModel"] [submodule "include/SortFilterProxyModel"]
path = include/SortFilterProxyModel path = include/SortFilterProxyModel
url = https://gitlab.com/b0/SortFilterProxyModel url = https://gitlab.com/b0/SortFilterProxyModel.git
[submodule "include/libqmatrixclient"] [submodule "include/libqmatrixclient"]
path = include/libqmatrixclient path = include/libqmatrixclient
url = https://github.com/QMatrixClient/libqmatrixclient url = https://github.com/QMatrixClient/libqmatrixclient.git

View File

@ -12,10 +12,7 @@ AvatarContainer {
id: messageRow id: messageRow
Audio { Audio { id: audioPlayer }
id: audioPlayer
source: progressInfo.localPath
}
DownloadableContent { DownloadableContent {
id: downloadable id: downloadable
@ -29,7 +26,7 @@ AvatarContainer {
maximumWidth: messageListView.width maximumWidth: messageListView.width
highlighted: !sentByMe highlighted: !sentByMe
timeLabelVisible: false timeLabelVisible: false
authorLabelVisible: messageRow.avatarVisible authorLabelVisible: false
displayText: content.info.duration / 1000 + '"' displayText: content.info.duration / 1000 + '"'
@ -40,7 +37,7 @@ AvatarContainer {
onClicked: { onClicked: {
if (downloadable.downloaded) if (downloadable.downloaded)
audioPlayer.play() play()
else else
{ {
playOnFinished = true playOnFinished = true
@ -49,6 +46,11 @@ AvatarContainer {
} }
} }
} }
onDownloadedChanged: downloaded && playOnFinished ? audioPlayer.play() : {} onDownloadedChanged: downloaded && playOnFinished ? play() : {}
}
function play() {
audioPlayer.source = progressInfo.localPath
audioPlayer.play()
} }
} }

View File

@ -20,7 +20,7 @@ AvatarContainer {
maximumWidth: messageListView.width maximumWidth: messageListView.width
highlighted: !sentByMe highlighted: !sentByMe
timeLabelVisible: false timeLabelVisible: false
authorLabelVisible: messageRow.avatarVisible authorLabelVisible: false
displayText: "<b>File: </b>" + content.body displayText: "<b>File: </b>" + content.body
} }