Don't Maximize Stickers
Make sure that sticker don't open the maximize component as they aren't in the media model BUG: 482701
This commit is contained in:
@@ -656,6 +656,7 @@ QVariantMap EventHandler::getMediaInfoForEvent(const Quotient::RoomEvent *event)
|
|||||||
|
|
||||||
// Get the file info for the event.
|
// Get the file info for the event.
|
||||||
const EventContent::FileInfo *fileInfo;
|
const EventContent::FileInfo *fileInfo;
|
||||||
|
bool isSticker = false;
|
||||||
if (event->is<RoomMessageEvent>()) {
|
if (event->is<RoomMessageEvent>()) {
|
||||||
auto roomMessageEvent = eventCast<const RoomMessageEvent>(event);
|
auto roomMessageEvent = eventCast<const RoomMessageEvent>(event);
|
||||||
if (!roomMessageEvent->hasFileContent()) {
|
if (!roomMessageEvent->hasFileContent()) {
|
||||||
@@ -665,14 +666,15 @@ QVariantMap EventHandler::getMediaInfoForEvent(const Quotient::RoomEvent *event)
|
|||||||
} else if (event->is<StickerEvent>()) {
|
} else if (event->is<StickerEvent>()) {
|
||||||
auto stickerEvent = eventCast<const StickerEvent>(event);
|
auto stickerEvent = eventCast<const StickerEvent>(event);
|
||||||
fileInfo = &stickerEvent->image();
|
fileInfo = &stickerEvent->image();
|
||||||
|
isSticker = true;
|
||||||
} else {
|
} else {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return getMediaInfoFromFileInfo(fileInfo, eventId);
|
return getMediaInfoFromFileInfo(fileInfo, eventId, false, isSticker);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap EventHandler::getMediaInfoFromFileInfo(const EventContent::FileInfo *fileInfo, const QString &eventId, bool isThumbnail) const
|
QVariantMap EventHandler::getMediaInfoFromFileInfo(const EventContent::FileInfo *fileInfo, const QString &eventId, bool isThumbnail, bool isSticker) const
|
||||||
{
|
{
|
||||||
QVariantMap mediaInfo;
|
QVariantMap mediaInfo;
|
||||||
|
|
||||||
@@ -699,6 +701,8 @@ QVariantMap EventHandler::getMediaInfoFromFileInfo(const EventContent::FileInfo
|
|||||||
// Add media size if available.
|
// Add media size if available.
|
||||||
mediaInfo["size"_ls] = fileInfo->payloadSize;
|
mediaInfo["size"_ls] = fileInfo->payloadSize;
|
||||||
|
|
||||||
|
mediaInfo["isSticker"_ls] = isSticker;
|
||||||
|
|
||||||
// Add parameter depending on media type.
|
// Add parameter depending on media type.
|
||||||
if (mimeType.name().contains(QStringLiteral("image"))) {
|
if (mimeType.name().contains(QStringLiteral("image"))) {
|
||||||
if (auto castInfo = static_cast<const EventContent::ImageContent *>(fileInfo)) {
|
if (auto castInfo = static_cast<const EventContent::ImageContent *>(fileInfo)) {
|
||||||
|
|||||||
@@ -229,6 +229,7 @@ public:
|
|||||||
* - 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.
|
||||||
|
* - isSticker - Whether the image is a sticker or not
|
||||||
*/
|
*/
|
||||||
QVariantMap getMediaInfo() const;
|
QVariantMap getMediaInfo() const;
|
||||||
|
|
||||||
@@ -320,6 +321,7 @@ public:
|
|||||||
* - 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.
|
||||||
|
* - isSticker - Whether the image is a sticker or not
|
||||||
*/
|
*/
|
||||||
QVariantMap getReplyMediaInfo() const;
|
QVariantMap getReplyMediaInfo() const;
|
||||||
|
|
||||||
@@ -405,5 +407,6 @@ private:
|
|||||||
QString getMessageBody(const Quotient::RoomMessageEvent &event, Qt::TextFormat format, bool stripNewlines) const;
|
QString getMessageBody(const Quotient::RoomMessageEvent &event, Qt::TextFormat format, bool stripNewlines) const;
|
||||||
|
|
||||||
QVariantMap getMediaInfoForEvent(const Quotient::RoomEvent *event) const;
|
QVariantMap getMediaInfoForEvent(const Quotient::RoomEvent *event) const;
|
||||||
QVariantMap getMediaInfoFromFileInfo(const Quotient::EventContent::FileInfo *fileInfo, const QString &eventId, bool isThumbnail = false) const;
|
QVariantMap
|
||||||
|
getMediaInfoFromFileInfo(const Quotient::EventContent::FileInfo *fileInfo, const QString &eventId, bool isThumbnail = false, bool isSticker = false) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ Item {
|
|||||||
* - 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.
|
||||||
|
* - isSticker - Whether the image is a sticker or not
|
||||||
*/
|
*/
|
||||||
required property var mediaInfo
|
required property var mediaInfo
|
||||||
|
|
||||||
@@ -139,11 +140,13 @@ Item {
|
|||||||
_private.imageItem.paused = true;
|
_private.imageItem.paused = true;
|
||||||
}
|
}
|
||||||
root.timeline.interactive = false;
|
root.timeline.interactive = false;
|
||||||
// We need to make sure the index is that of the MediaMessageFilterModel.
|
if (!root.mediaInfo.isSticker) {
|
||||||
if (root.timeline.model instanceof MessageFilterModel) {
|
// We need to make sure the index is that of the MediaMessageFilterModel.
|
||||||
RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index));
|
if (root.timeline.model instanceof MessageFilterModel) {
|
||||||
} else {
|
RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index));
|
||||||
RoomManager.maximizeMedia(root.index);
|
} else {
|
||||||
|
RoomManager.maximizeMedia(root.index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user