TTKMusicPlayer  3.7.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 - 2024 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);
88  virtual ~Florid() = default;
89 
90 public slots:
94  void setImage(const QImage &image);
98  virtual void start() override;
102  virtual void stop() override;
103 
104 private slots:
108  void mediaUrlChanged();
109 
110 protected:
114  void reRenderLabel();
118  void reRenderImage(QColor &avg, const QImage *input);
122  virtual void process(bool state) override final;
123 
124  virtual void hideEvent(QHideEvent *event) override final;
125  virtual void showEvent(QShowEvent *event) override final;
126  virtual void paintEvent(QPaintEvent *event) override;
127  virtual void contextMenuEvent(QContextMenuEvent *event) override final;
128 
129 protected:
130  QImage m_image;
131  bool m_renderLabel = false;
132  bool m_enabledLabel = true;
133  bool m_gradientLabel = true;
134  QColor m_averageColor = QColor(255, 255, 255);
135  RoundAnimationLabel *m_roundLabel = nullptr;
136 
137 };
138 
139 #endif
QImage m_image
Definition: florid.h:130
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 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
state
Definition: http_parser.c:279
virtual void process(float *left, float *right)=0
Helper class to round animation widget.
Definition: florid.h:31