Fix ImageDelegate

Restore the animated mediaInfo to eventHandler and make sure ImageDelegate uses the media helper size for the sourceSize.
This commit is contained in:
James Graham
2023-09-10 16:22:14 +00:00
parent 2fbf659eb4
commit 33ca72efd9
3 changed files with 7 additions and 3 deletions

View File

@@ -3,6 +3,8 @@
#include "eventhandler.h" #include "eventhandler.h"
#include <QMovie>
#include <KLocalizedString> #include <KLocalizedString>
#include <Quotient/eventitem.h> #include <Quotient/eventitem.h>
@@ -667,6 +669,9 @@ QVariantMap EventHandler::getMediaInfoFromFileInfo(const EventContent::FileInfo
mediaInfo["width"_ls] = castInfo->imageSize.width(); mediaInfo["width"_ls] = castInfo->imageSize.width();
mediaInfo["height"_ls] = castInfo->imageSize.height(); mediaInfo["height"_ls] = castInfo->imageSize.height();
// TODO: Images in certain formats (e.g. WebP) will be erroneously marked as animated, even if they are static.
mediaInfo["animated"_ls] = QMovie::supportedFormats().contains(mimeType.preferredSuffix().toUtf8());
if (!isThumbnail) { if (!isThumbnail) {
QVariantMap tempInfo; QVariantMap tempInfo;
auto thumbnailInfo = getMediaInfoFromFileInfo(castInfo->thumbnailInfo(), eventId, true); auto thumbnailInfo = getMediaInfoFromFileInfo(castInfo->thumbnailInfo(), eventId, true);

View File

@@ -14,7 +14,6 @@
#include <QDebug> #include <QDebug>
#include <QGuiApplication> #include <QGuiApplication>
#include <QMovie>
#include <QTimeZone> #include <QTimeZone>
#include <KLocalizedString> #include <KLocalizedString>

View File

@@ -73,8 +73,8 @@ TimelineContainer {
active: !root.mediaInfo.animated active: !root.mediaInfo.animated
sourceComponent: Image { sourceComponent: Image {
source: root.mediaInfo.source source: root.mediaInfo.source
sourceSize.width: imageContainer.maxSize.width * Screen.devicePixelRatio sourceSize.width: mediaSizeHelper.currentSize.width * Screen.devicePixelRatio
sourceSize.height: imageContainer.maxSize.height * Screen.devicePixelRatio sourceSize.height: mediaSizeHelper.currentSize.height * Screen.devicePixelRatio
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
} }