Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
electronic_shutdown_effect.h
Go to the documentation of this file.
1#ifndef ELECTRONIC_SHUTDOWN_EFFECT_H
2#define ELECTRONIC_SHUTDOWN_EFFECT_H
3
4#include <QCache>
5#include <QGraphicsEffect>
6
18class ElectronicShutdownEffect final : public QGraphicsEffect {
19 Q_OBJECT
21 Q_PROPERTY(qreal progress READ GetProgress WRITE SetProgress)
22
23public:
29 explicit ElectronicShutdownEffect(QObject *parent = nullptr);
30
36 void SetProgress(qreal progress);
37
42 qreal GetProgress() const {
43 return progress_;
44 }
45
46protected:
57 void draw(QPainter *painter) override;
58
59private:
61 qreal progress_;
65 QCache<QString, QPixmap> result_cache_;
66};
67
68#endif // ELECTRONIC_SHUTDOWN_EFFECT_H
void SetProgress(qreal progress)
Sets the progress of the shutdown animation. Clamps the value between 0.0 and 1.0 and triggers an upd...
Definition electronic_shutdown_effect.cpp:12
qreal GetProgress() const
Gets the current progress of the shutdown animation.
Definition electronic_shutdown_effect.h:42
ElectronicShutdownEffect(QObject *parent=nullptr)
Constructs an ElectronicShutdownEffect. Initializes the effect, sets up the result cache,...
Definition electronic_shutdown_effect.cpp:7
qreal last_progress_
Stores the progress value from the last time the cache was updated, used to optimize cache usage.
Definition electronic_shutdown_effect.h:63
void draw(QPainter *painter) override
Overridden draw method that renders the shutdown effect. Retrieves the source pixmap....
Definition electronic_shutdown_effect.cpp:17
QCache< QString, QPixmap > result_cache_
Cache storing pre-rendered effect pixmaps keyed by progress level string for performance.
Definition electronic_shutdown_effect.h:65
qreal progress
Property controlling the progress of the shutdown animation (0.0 to 1.0). Animatable.
Definition electronic_shutdown_effect.h:21
qreal progress_
Current progress level of the shutdown animation (0.0 to 1.0).
Definition electronic_shutdown_effect.h:61