Separate out a base MessageContentModel.

Separate out a base `MessageContentModel` that can be extended to get the component types from different places. This is used currently for `EventMessageContentModel` but will be used later as part of the rich chat bar.

All display text is now in the text component so it never needs special casing. This also cleans up some of the model parameters so more things come from attributes including location and file data (which was already a qvariantmap anyway).

Also cleaned up the itinerary and file enhancement views,
This commit is contained in:
James Graham
2025-08-01 12:15:51 +01:00
parent 501f14fead
commit b4e1740cad
24 changed files with 874 additions and 789 deletions

View File

@@ -30,18 +30,9 @@ Video {
required property string display
/**
* @brief The media info for the event.
*
* This should consist of the following:
* - source - The mxc URL for the media.
* - mimeType - The MIME type of the media (should be image/xxx for this delegate).
* - mimeIcon - The MIME icon name (should be image-xxx).
* - size - The file size in bytes.
* - width - The width 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.
* @brief The attributes of the component.
*/
required property var mediaInfo
required property var componentAttributes
/**
* @brief FileTransferInfo for any downloading files.
@@ -206,7 +197,7 @@ Video {
anchors.fill: parent
visible: false
source: visible ? root.mediaInfo.tempInfo.source : ""
source: visible ? root.componentAttributes.tempInfo.source : ""
fillMode: Image.PreserveAspectFit
}
@@ -437,8 +428,8 @@ Video {
MediaSizeHelper {
id: mediaSizeHelper
contentMaxWidth: root.Message.maxContentWidth
mediaWidth: root.mediaInfo.width
mediaHeight: root.mediaInfo.height
mediaWidth: root.componentAttributes.width
mediaHeight: root.componentAttributes.height
}
function downloadAndPlay() {