TTKMusicPlayer  4.2.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
florid.h
Go to the documentation of this file.
1 /***************************************************************************
2  * This file is part of the TTK qmmp plugin project
3  * Copyright (C) 2015 - 2025 Greedysky Studio
4 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14 
15  * You should have received a copy of the GNU General Public License along
16  * with this program; If not, see <http://www.gnu.org/licenses/>.
17  ***************************************************************************/
18 
19 #ifndef FLORID_H
20 #define FLORID_H
21 
22 #include <QTimer>
23 #include "qmmp.h"
24 #include "visual.h"
25 
26 #define LABEL_RADIUS 100
27 
31 class QMMP_EXPORT RoundAnimationLabel : public QWidget
32 {
33  Q_OBJECT
34 public:
38  explicit RoundAnimationLabel(QWidget *parent = nullptr);
40 
44  void setPixmap(const QPixmap &pix);
45 
46 public slots:
50  void start();
54  void stop();
58  void timeout();
59 
60 protected:
64  virtual void paintEvent(QPaintEvent *event) override final;
65 
66 protected:
67  QPixmap m_pixmap;
68  QTimer m_timer;
69  int m_rotateAngle = 0;
70 
71 };
72 
73 
77 class QMMP_EXPORT Florid : public Visual
78 {
79  Q_OBJECT
80 public:
84  explicit Florid(QWidget *parent = nullptr);
85 
86 public slots:
90  void setImage(const QImage &image);
94  virtual void start() override;
98  virtual void stop() override;
99 
100 private slots:
104  void mediaUrlChanged();
105 
106 protected:
110  void reRenderLabel();
114  void reRenderImage(QColor &avg, const QImage *input);
118  virtual void processState(bool v) override final;
119 
120  virtual void hideEvent(QHideEvent *event) override final;
121  virtual void showEvent(QShowEvent *event) override final;
122  virtual void paintEvent(QPaintEvent *event) override;
123  virtual void contextMenuEvent(QContextMenuEvent *event) override final;
124 
125 protected:
126  QImage m_image;
127  bool m_renderLabel = false;
128  bool m_enabledLabel = true;
129  bool m_gradientLabel = true;
130  QColor m_averageColor = QColor(255, 255, 255);
131  RoundAnimationLabel *m_roundLabel = nullptr;
132 
133 };
134 
135 #endif
QImage m_image
Definition: florid.h:126
virtual void showEvent(QShowEvent *event) override
The Visual class provides the base interface class of visualizations.
Definition: visual.h:37
virtual void start()
virtual void hideEvent(QHideEvent *event) override
virtual void processState(bool v)
virtual void stop()
QPixmap m_pixmap
Definition: florid.h:67
#define QMMP_EXPORT
Definition: qmmp_export.h:29
QTimer m_timer
Definition: florid.h:68
TTK_MODULE_EXPORT void reRenderImage(int delta, const QImage *input, QImage *output)
Helper class to florid widget.
Definition: florid.h:77
Helper class to round animation widget.
Definition: florid.h:31