Audio filename, caption and seeking
- display caption independent of filename (consistancy to File) - fix audio seeking not working - change two comments and a variable name
This commit is contained in:
@@ -246,9 +246,9 @@ QString EventHandler::rawMessageBody(const Quotient::RoomMessageEvent &event)
|
|||||||
if (event.hasFileContent()) {
|
if (event.hasFileContent()) {
|
||||||
// if filename is given or body is equal to filename,
|
// if filename is given or body is equal to filename,
|
||||||
// then body is a caption
|
// then body is a caption
|
||||||
QString fileName = event.content()->fileInfo()->originalName;
|
QString filename = event.content()->fileInfo()->originalName;
|
||||||
QString body = event.plainBody();
|
QString body = event.plainBody();
|
||||||
if (fileName.isEmpty() || fileName == body) {
|
if (filename.isEmpty() || filename == body) {
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
return body;
|
return body;
|
||||||
|
|||||||
@@ -482,6 +482,7 @@ QList<MessageComponent> MessageContentModel::componentsForType(MessageComponentT
|
|||||||
return components;
|
return components;
|
||||||
}
|
}
|
||||||
case MessageComponentType::Image:
|
case MessageComponentType::Image:
|
||||||
|
case MessageComponentType::Audio:
|
||||||
case MessageComponentType::Video: {
|
case MessageComponentType::Video: {
|
||||||
if (!m_event->is<StickerEvent>()) {
|
if (!m_event->is<StickerEvent>()) {
|
||||||
const auto event = eventCast<const Quotient::RoomMessageEvent>(m_event);
|
const auto event = eventCast<const Quotient::RoomMessageEvent>(m_event);
|
||||||
|
|||||||
@@ -28,11 +28,6 @@ ColumnLayout {
|
|||||||
*/
|
*/
|
||||||
required property string eventId
|
required property string eventId
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The display text of the message.
|
|
||||||
*/
|
|
||||||
required property string display
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The media info for the event.
|
* @brief The media info for the event.
|
||||||
*
|
*
|
||||||
@@ -44,6 +39,7 @@ ColumnLayout {
|
|||||||
* - width - The width in pixels of the audio media.
|
* - width - The width in pixels of the audio media.
|
||||||
* - height - The height in pixels of the audio media.
|
* - height - The height in pixels of the audio media.
|
||||||
* - tempInfo - mediaInfo (with the same properties as this except no tempInfo) for a temporary image while the file downloads.
|
* - tempInfo - mediaInfo (with the same properties as this except no tempInfo) for a temporary image while the file downloads.
|
||||||
|
* - filename - original filename of the media
|
||||||
*/
|
*/
|
||||||
required property var mediaInfo
|
required property var mediaInfo
|
||||||
|
|
||||||
@@ -138,7 +134,7 @@ ColumnLayout {
|
|||||||
id: playButton
|
id: playButton
|
||||||
}
|
}
|
||||||
QQC2.Label {
|
QQC2.Label {
|
||||||
text: root.display
|
text: root.mediaInfo.filename
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
@@ -159,7 +155,7 @@ ColumnLayout {
|
|||||||
from: 0
|
from: 0
|
||||||
to: audio.duration
|
to: audio.duration
|
||||||
value: audio.position
|
value: audio.position
|
||||||
onMoved: audio.seek(value)
|
onMoved: audio.setPosition(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.Label {
|
QQC2.Label {
|
||||||
|
|||||||
@@ -29,11 +29,6 @@ ColumnLayout {
|
|||||||
*/
|
*/
|
||||||
required property string eventId
|
required property string eventId
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The display text of the message.
|
|
||||||
*/
|
|
||||||
required property string display
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The media info for the event.
|
* @brief The media info for the event.
|
||||||
*
|
*
|
||||||
@@ -45,7 +40,7 @@ ColumnLayout {
|
|||||||
* - width - The width in pixels of the audio media.
|
* - width - The width in pixels of the audio media.
|
||||||
* - height - The height in pixels of the audio media.
|
* - height - The height in pixels of the audio media.
|
||||||
* - tempInfo - mediaInfo (with the same properties as this except no tempInfo) for a temporary image while the file downloads.
|
* - tempInfo - mediaInfo (with the same properties as this except no tempInfo) for a temporary image while the file downloads.
|
||||||
* - filename
|
* - filename - original filename of the media
|
||||||
*/
|
*/
|
||||||
required property var mediaInfo
|
required property var mediaInfo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user