5class QPropertyAnimation;
6class QVariantAnimation;
21 static constexpr const unsigned int ANIMATION_DURATION = 300;
22 static constexpr const unsigned int ANIMATION_FPS = 60;
23 static constexpr const qreal BEGIN_ANGLE = -30;
24 static constexpr const qreal END_ANGLE = -10;
25 static constexpr const unsigned int SWITCH_COLOR_MSEC_INTERVAL = 20000;
26 static constexpr const unsigned int COLOR_SWITCH_PROCESS_INTERVAL = 2000;
29 static constexpr const QColor BEGIN_COLOR = QColor(173, 216, 230);
30 static constexpr const QColor END_COLOR = QColor(0, 51, 102);
38 explicit DiskMusic(QWidget* parent =
nullptr);
51 void setPixmap(
const QString& pixmap_path);
93 qreal angle { BEGIN_ANGLE };
94 float current_rotations {};
95 bool is_playing {
false };
97 QPropertyAnimation* animation {
nullptr };
98 QVariantAnimation* color_animation {
nullptr };
111 void process_rotation() {
112 current_rotations += 0.5;
113 if (current_rotations >= 360.0)
114 current_rotations -= 360.0;
118 void process_the_color_change(QPainter& p);
119 void startColorTransition();
121 QColor beginColor { BEGIN_COLOR };
122 QColor endColor { END_COLOR };
126 QTimer color_switch_timer;
The DiskMusic class is a Widget Class(Sorry for the non-class label) that holding all the details of ...
Definition DiskMusic.h:15
~DiskMusic()
Destroy the Disk Music object.
Definition DiskMusic.cpp:158
QPixmap coverPixmap
the cover pixmap
Definition DiskMusic.h:101
QPixmap armPixmap
the arm pixmap
Definition DiskMusic.h:102
QPixmap recordPixmap
the record pixmap
Definition DiskMusic.h:103
qreal armAngle() const
armAngle get the arm angle
Definition DiskMusic.h:57
void setStatus(bool set_is_playing)
setStatus set the status of the disk
Definition DiskMusic.cpp:46
qreal armAngle
property announced
Definition DiskMusic.h:20
void paintEvent(QPaintEvent *event) override
paintEvent the paint event for the disk
Definition DiskMusic.cpp:65
void setPixmap(const QString &pixmap_path)
setPixmap set the pixmap of the disk center display
Definition DiskMusic.cpp:61
void armAngleChanged()
armAngleChanged the signal indicating the arm angle changed
void setArmAngle(qreal angle)
setArmAngle set the arm angle
Definition DiskMusic.h:65