TTKMusicPlayer  4.3.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 - 2026 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
33 public:
37  explicit MusicBarrageAnimation(QObject *parent = nullptr);
38  MusicBarrageAnimation(QObject *target, const QByteArray &name, QObject *parent = nullptr);
39 
43  void setSize(const QSize &size);
44 
45 private Q_SLOTS:
49  void animationFinished();
50 
51 private:
55  void initialize();
56 
57  QSize m_parentSize;
58 
59 };
60 
61 
63 
67 class TTK_MODULE_EXPORT MusicBarrageWidget : public QObject
68 {
69  Q_OBJECT
70 public:
74  explicit MusicBarrageWidget(QObject *parent = nullptr);
79 
83  void start();
87  void pause();
91  void stop();
92 
96  void setSize(const QSize &size);
100  void setBarrage(const QString &name, const QString &id);
101 
102 public Q_SLOTS:
106  void barrageStateChanged(bool on);
110  void addBarrage(const MusicBarrageRecord &record);
111 
112 private Q_SLOTS:
116  void sizeChanged();
120  void downloadFinished(const QByteArray &bytes);
121 
122 private:
126  void clearItems();
130  void createLabel();
134  void clearBarrages();
138  QLabel *createLabel(const MusicBarrageRecord &record);
142  void createAnimation();
146  void createAnimation(QLabel *label);
147 
148  bool m_state;
150  QWidget *m_parent;
151  QTimer *m_sizeTimer;
152  QString m_lastQueryID;
153  QList<QLabel*> m_labels;
154  QList<MusicBarrageAnimation*> m_animations;
155  MusicBarrageRecordList m_barrageRecords;
157 
158 };
159 
160 #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
QList< MusicBarrageAnimation * > m_animations
TTK_MODULE_EXPORT void initialize(TTK::Attribute attr)
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.