TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicgiflabelwidget.h
Go to the documentation of this file.
1 #ifndef MUSICGIFLABELWIDGET_H
2 #define MUSICGIFLABELWIDGET_H
3 
4 /***************************************************************************
5  * This file is part of the TTK Music Player project
6  * Copyright (C) 2015 - 2024 Greedysky Studio
7 
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17 
18  * You should have received a copy of the GNU General Public License along
19  * with this program; If not, see <http://www.gnu.org/licenses/>.
20  ***************************************************************************/
21 
22 #include <QLabel>
23 #include "musicglobaldefine.h"
24 
25 class QTimer;
26 
31 {
32  Q_OBJECT
34 public:
35  enum class Module
36  {
37  BallonWhite,
38  CicleBlue,
39  RiceFontWhite,
40  RiceFontBlack,
41  RiceFontBlackBig,
42  HourglassWhite,
43  RadioBlue,
44  CheckBlue,
45  RecordRed,
46  CloseWhite
47  };
48 
52  explicit MusicGifLabelWidget(QWidget *parent = nullptr);
53  explicit MusicGifLabelWidget(Module type, QWidget *parent = nullptr);
58 
62  void setType(Module type);
66  Module type() const;
67 
71  void setInterval(int value);
75  int interval() const;
76 
80  void setInfinited(bool s);
84  bool infinited() const;
85 
89  void run(bool run);
93  inline bool isRunning() const { return m_isRunning; }
94 
98  void start();
102  void stop();
103 
104 public Q_SLOTS:
108  void updateRender();
109 
110 private:
114  virtual void paintEvent(QPaintEvent *event) override final;
118  bool infinitedModeCheck();
119 
120  int m_index;
122  QTimer *m_timer;
123  QPixmap m_renderer;
124  bool m_isRunning, m_infinited;
125 
126 };
127 
128 
133 {
134  Q_OBJECT
136 public:
140  explicit MusicGifLabelMaskWidget(QWidget *parent = nullptr);
145 
149  void run(bool run);
153  bool isRunning() const;
154 
155 protected:
159  virtual void paintEvent(QPaintEvent *event) override;
160 
162 
163 };
164 
165 
170 {
171  Q_OBJECT
173 public:
177  explicit MusicGifLabelValueWidget(QWidget *parent = nullptr);
178 
182  inline void setValue(int value) { m_value = value; }
186  inline int value() const { return m_value; }
187 
188 private:
192  virtual void paintEvent(QPaintEvent *event) override final;
193 
194  int m_value;
195 
196 };
197 
198 #endif // MUSICGIFLABELWIDGET_H
#define TTK_MODULE_EXPORT
virtual void paintEvent(QPaintEvent *event) override
MusicGifLabelWidget * m_loadingLabel
#define TTK_DECLARE_MODULE(Class)
Definition: ttkqtglobal.h:152
The class of the float gif label mask widget.
The class of the float gif label widget.
The class of the float gif label value widget.