┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/information/pixmapviewer.h
diff options
context:
space:
mode:
authorIsmael Asensio <[email protected]>2019-09-21 16:15:04 +0200
committerElvis Angelaccio <[email protected]>2019-09-21 16:25:50 +0200
commitc0ca8f2c79c9b0e9f6db47dd86a1434d4e3de5bb (patch)
treeb2f34287b75881831c82a7729f2a61d0513981b6 /src/panels/information/pixmapviewer.h
parent96e84bef52099dcee5f62f85ee22d01d08bef2be (diff)
[dolphin] Animate gifs on preview
Summary: Adds the capability to view animated images on the preview in the information panel. This was a request from a user back in 2009 (https://bugs.kde.org/show_bug.cgi?id=182257), but I think nowadays with stickers/memes and what not, it's even more useful. It keeps the size default transition of the preview viewer before starting the animation, so that the visual integration is smoother. {F7289110} FEATURE: 182257 FIXED-IN: 19.11.80 Test Plan: Open the information panel and hover over some animated images (gif/webp/mng) Reviewers: #dolphin, #vdg, ngraham, elvisangelaccio Reviewed By: #vdg, ngraham Subscribers: pino, fuksitter, meven, broulik, kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D23538
Diffstat (limited to 'src/panels/information/pixmapviewer.h')
-rw-r--r--src/panels/information/pixmapviewer.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/panels/information/pixmapviewer.h b/src/panels/information/pixmapviewer.h
index 46e5cf5fc..37071045f 100644
--- a/src/panels/information/pixmapviewer.h
+++ b/src/panels/information/pixmapviewer.h
@@ -26,6 +26,7 @@
#include <QWidget>
class QPaintEvent;
+class QMovie;
/**
* @brief Widget which shows a pixmap centered inside the boundaries.
@@ -73,20 +74,33 @@ public:
void setSizeHint(const QSize& size);
QSize sizeHint() const override;
+ void setAnimatedImageFileName(const QString& fileName);
+ QString animatedImageFileName() const;
+
+ void stopAnimatedImage();
+
+ /**
+ * Checks if \a fileName contains an animated image supported by QMovie.
+ */
+ static bool isAnimatedImage(const QString &fileName);
+
protected:
void paintEvent(QPaintEvent* event) override;
private Q_SLOTS:
void checkPendingPixmaps();
+ void updateAnimatedImageFrame();
private:
QPixmap m_pixmap;
QPixmap m_oldPixmap;
+ QMovie* m_animatedImage;
QQueue<QPixmap> m_pendingPixmaps;
QTimeLine m_animation;
Transition m_transition;
int m_animationStep;
QSize m_sizeHint;
+ bool m_hasAnimatedImage;
};
inline QPixmap PixmapViewer::pixmap() const