TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicdownloadmanager.h
Go to the documentation of this file.
1 #ifndef MUSICDOWNLOADMANAGER_H
2 #define MUSICDOWNLOADMANAGER_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 "ttksingleton.h"
23 #include "musicnetworkdefines.h"
24 
29 {
30  qint64 m_timestamp;
31  QObject *m_object;
33 
35  : m_timestamp(-1),
36  m_object(nullptr),
37  m_type(TTK::Record::NormalDownload)
38  {
39 
40  }
41 
44  {
45  m_timestamp = t;
46  }
47 
48  MusicDownLoadPairData(qint64 t, QObject *object, TTK::Record type)
49  : m_timestamp(t),
50  m_object(object),
51  m_type(type)
52  {
53 
54  }
55 
56  inline bool operator< (const MusicDownLoadPairData &other) const
57  {
58  return m_timestamp < other.m_timestamp;
59  }
60 
61  inline bool operator== (const MusicDownLoadPairData &other) const
62  {
63  return m_timestamp == other.m_timestamp;
64  }
65 };
66 
71 {
72  Q_OBJECT
74 public:
78  void connectNetworkMultiValue(QObject *object);
82  void removeNetworkMultiValue(QObject *object);
83 
87  void connectDownload(const MusicDownLoadPairData &pair);
91  void reconnectDownload(const MusicDownLoadPairData &pair);
95  void removeDownload(const MusicDownLoadPairData &pair);
96 
97 private Q_SLOTS:
101  void downloadProgressChanged(float percent, const QString &total, qint64 time);
102 
103 private:
104  QObjectList m_queueList;
105  QList<MusicDownLoadPairData> m_pairList;
106 
108 
109 };
110 
111 #define G_DOWNLOAD_MANAGER_PTR makeMusicDownLoadManager()
113 
114 #endif // MUSICDOWNLOADMANAGER_H
bool operator==(const VolumeSettings &v1, const VolumeSettings &v2)
Definition: volume.h:38
#define TTK_MODULE_EXPORT
TTK_MODULE_EXPORT MusicDownLoadManager * makeMusicDownLoadManager()
#define TTK_DECLARE_SINGLETON_CLASS(Class)
// Singleton Macro // //
Definition: ttksingleton.h:86
The namespace of the process utils.
Definition: ttkcompat.h:24
MusicDownLoadPairData(qint64 t, QObject *object, TTK::Record type)
QList< MusicDownLoadPairData > m_pairList
The class of the produce the download manager.
#define TTK_DECLARE_MODULE(Class)
Definition: ttkqtglobal.h:152
The class of the download manager pair.
constexpr bool operator<(int128_t, int128_t)
Definition: int128.h:634