Changeset View
Changeset View
Standalone View
Standalone View
src/panels/information/pixmapviewer.h
Show All 18 Lines | |||||
19 | 19 | | |||
20 | #ifndef PIXMAPVIEWER_H | 20 | #ifndef PIXMAPVIEWER_H | ||
21 | #define PIXMAPVIEWER_H | 21 | #define PIXMAPVIEWER_H | ||
22 | 22 | | |||
23 | #include <QPixmap> | 23 | #include <QPixmap> | ||
24 | #include <QQueue> | 24 | #include <QQueue> | ||
25 | #include <QTimeLine> | 25 | #include <QTimeLine> | ||
26 | #include <QWidget> | 26 | #include <QWidget> | ||
27 | 27 | | |||
broulik: Not neccessary to include it, you only use it as a pointer. Forward-declaration `class QMovie;`… | |||||
28 | class QPaintEvent; | 28 | class QPaintEvent; | ||
29 | class QMovie; | ||||
29 | 30 | | |||
30 | /** | 31 | /** | ||
31 | * @brief Widget which shows a pixmap centered inside the boundaries. | 32 | * @brief Widget which shows a pixmap centered inside the boundaries. | ||
32 | * | 33 | * | ||
33 | * When the pixmap is changed, a smooth transition is done from the old pixmap | 34 | * When the pixmap is changed, a smooth transition is done from the old pixmap | ||
34 | * to the new pixmap. | 35 | * to the new pixmap. | ||
35 | */ | 36 | */ | ||
36 | class PixmapViewer : public QWidget | 37 | class PixmapViewer : public QWidget | ||
Show All 31 Lines | 41 | public: | |||
68 | 69 | | |||
69 | /** | 70 | /** | ||
70 | * Sets the size hint to \a size and triggers a relayout | 71 | * Sets the size hint to \a size and triggers a relayout | ||
71 | * of the parent widget. Per default no size hint is given. | 72 | * of the parent widget. Per default no size hint is given. | ||
72 | */ | 73 | */ | ||
73 | void setSizeHint(const QSize& size); | 74 | void setSizeHint(const QSize& size); | ||
74 | QSize sizeHint() const override; | 75 | QSize sizeHint() const override; | ||
75 | 76 | | |||
77 | void setAnimatedImageFileName(const QString& fileName); | ||||
78 | QString animatedImageFileName() const; | ||||
79 | | ||||
80 | bool hasAnimatedImage(); | ||||
meven: A space to many | |||||
81 | void clearAnimatedImage(); | ||||
82 | | ||||
83 | /** | ||||
84 | * Returns the list of supported mimetypes that can be animated | ||||
85 | */ | ||||
86 | static const QStringList animatedMimeTypes(); | ||||
87 | | ||||
76 | protected: | 88 | protected: | ||
77 | void paintEvent(QPaintEvent* event) override; | 89 | void paintEvent(QPaintEvent* event) override; | ||
78 | 90 | | |||
79 | private Q_SLOTS: | 91 | private Q_SLOTS: | ||
80 | void checkPendingPixmaps(); | 92 | void checkPendingPixmaps(); | ||
93 | void updateAnimatedImageFrame(); | ||||
81 | 94 | | |||
82 | private: | 95 | private: | ||
83 | QPixmap m_pixmap; | 96 | QPixmap m_pixmap; | ||
84 | QPixmap m_oldPixmap; | 97 | QPixmap m_oldPixmap; | ||
98 | QMovie* m_animatedImage; | ||||
85 | QQueue<QPixmap> m_pendingPixmaps; | 99 | QQueue<QPixmap> m_pendingPixmaps; | ||
86 | QTimeLine m_animation; | 100 | QTimeLine m_animation; | ||
87 | Transition m_transition; | 101 | Transition m_transition; | ||
88 | int m_animationStep; | 102 | int m_animationStep; | ||
89 | QSize m_sizeHint; | 103 | QSize m_sizeHint; | ||
90 | }; | 104 | }; | ||
91 | 105 | | |||
92 | inline QPixmap PixmapViewer::pixmap() const | 106 | inline QPixmap PixmapViewer::pixmap() const | ||
93 | { | 107 | { | ||
94 | return m_pixmap; | 108 | return m_pixmap; | ||
95 | } | 109 | } | ||
96 | 110 | | |||
97 | 111 | | |||
98 | #endif | 112 | #endif |
Not neccessary to include it, you only use it as a pointer. Forward-declaration class QMovie; is sufficient