diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-08-29 15:33:39 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-08-29 16:32:28 +0200 |
commit | 15bf643347e507513d6999dd346f0cce9c7952c8 (patch) | |
tree | f0b0470e0731e063021b57165391a2b5597ecaf3 /src/ui/MxcAnimatedImage.h | |
parent | cleanup QSettings usage a bit (diff) | |
download | nheko-15bf643347e507513d6999dd346f0cce9c7952c8.tar.xz |
Add option to only play animated images on hover
Diffstat (limited to 'src/ui/MxcAnimatedImage.h')
-rw-r--r-- | src/ui/MxcAnimatedImage.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ui/MxcAnimatedImage.h b/src/ui/MxcAnimatedImage.h index 7b9502e0..2e0489ad 100644 --- a/src/ui/MxcAnimatedImage.h +++ b/src/ui/MxcAnimatedImage.h @@ -19,6 +19,7 @@ class MxcAnimatedImage : public QQuickItem Q_PROPERTY(QString eventId READ eventId WRITE setEventId NOTIFY eventIdChanged) Q_PROPERTY(bool animatable READ animatable NOTIFY animatableChanged) Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged) + Q_PROPERTY(bool play READ play WRITE setPlay NOTIFY playChanged) public: MxcAnimatedImage(QQuickItem *parent = nullptr) : QQuickItem(parent) @@ -32,6 +33,7 @@ public: bool animatable() const { return animatable_; } bool loaded() const { return buffer.size() > 0; } + bool play() const { return play_; } QString eventId() const { return eventId_; } TimelineModel *room() const { return room_; } void setEventId(QString newEventId) @@ -48,6 +50,14 @@ public: emit roomChanged(); } } + void setPlay(bool newPlay) + { + if (play_ != newPlay) { + play_ = newPlay; + movie.setPaused(!play_); + emit playChanged(); + } + } QSGNode *updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *updatePaintNodeData) override; @@ -57,6 +67,7 @@ signals: void eventIdChanged(); void animatableChanged(); void loadedChanged(); + void playChanged(); private slots: void startDownload(); @@ -76,4 +87,5 @@ private: QMovie movie; int currentFrame = 0; bool imageDirty = true; + bool play_ = true; }; |