TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicbarragewidget.h
Go to the documentation of this file.
1 #ifndef MUSICBARRAGEWIDGET_H
2 #define MUSICBARRAGEWIDGET_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 "musicwidgetheaders.h"
23 #include "musicbarragerecord.h"
24 
25 #include <QPropertyAnimation>
26 
30 class TTK_MODULE_EXPORT MusicBarrageAnimation : public QPropertyAnimation
31 {
32  Q_OBJECT
34 public:
38  explicit MusicBarrageAnimation(QObject *parent = nullptr);
39  MusicBarrageAnimation(QObject *target, const QByteArray &name, QObject *parent = nullptr);
40 
44  void setSize(const QSize &size);
45 
46 private Q_SLOTS:
50  void animationFinished();
51 
52 private:
56  void initialize();
57 
58  QSize m_parentSize;
59 
60 };
61 
62 
64 
68 class TTK_MODULE_EXPORT MusicBarrageWidget : public QObject
69 {
70  Q_OBJECT
72 public:
76  explicit MusicBarrageWidget(QObject *parent = nullptr);
81 
85  void start();
89  void pause();
93  void stop();
94 
98  void setSize(const QSize &size);
102  void setBarrage(const QString &name, const QString &id);
103 
104 public Q_SLOTS:
108  void barrageStateChanged(bool on);
112  void addBarrage(const MusicBarrageRecord &record);
113 
114 private Q_SLOTS:
118  void sizeChanged();
122  void downLoadFinished(const QByteArray &bytes);
123 
124 private:
128  void clearItems();
132  void createLabel();
136  void clearBarrages();
140  QLabel *createLabel(const MusicBarrageRecord &record);
144  void createAnimation();
148  void createAnimation(QLabel *label);
149 
150  bool m_state;
152  QWidget *m_parent;
153  QTimer *m_sizeTimer;
154  QString m_lastQueryID;
155  QList<QLabel*> m_labels;
156  QList<MusicBarrageAnimation*> m_animations;
157  MusicBarrageRecordList m_barrageRecords;
159 
160 };
161 
162 #endif // MUSICBARRAGEWIDGET_H
#define TTK_MODULE_EXPORT
voidpf void uLong size
Definition: ioapi.h:136
The class of the barrage record item.
MusicBarrageRecordList m_barrageRecords
const char * name
Definition: http_parser.c:458
#define TTK_DECLARE_MODULE(Class)
Definition: ttkqtglobal.h:152
QList< MusicBarrageAnimation * > m_animations
QList< QLabel * > m_labels
The namespace of the barrage request interface.
The class of the barrage widget.
MusicBarrageRequest * m_networkRequest
The class of the barrage animation.