TTKMusicPlayer  4.3.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 - 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 "ttksingleton.h"
23 #include "musicnetworkdefines.h"
24 
29 {
30  qint64 m_timestamp;
31  QObject *m_object;
33 
34  MusicDownloadData() noexcept
35  : m_timestamp(-1),
36  m_object(nullptr),
37  m_type(TTK::Record::NormalDownload)
38  {
39 
40  }
41 
42  MusicDownloadData(qint64 t) noexcept
44  {
45  m_timestamp = t;
46  }
47 
48  MusicDownloadData(qint64 t, QObject *object, TTK::Record type) noexcept
49  : m_timestamp(t),
50  m_object(object),
51  m_type(type)
52  {
53 
54  }
55 
56  inline bool operator< (const MusicDownloadData &other) const noexcept
57  {
58  return m_timestamp < other.m_timestamp;
59  }
60 
61  inline bool operator== (const MusicDownloadData &other) const noexcept
62  {
63  return m_timestamp == other.m_timestamp;
64  }
65 };
66 
71 {
72  Q_OBJECT
74 public:
78  void connectMultiNetwork(QObject *object);
82  void removeMultiNetwork(QObject *object);
83 
87  void connectNetworkData(const MusicDownloadData &data);
91  void reconnectNetworkData(const MusicDownloadData &data);
95  void removeNetworkData(const MusicDownloadData &data);
96 
97 private Q_SLOTS:
101  void downloadProgressChanged(float percent, const QString &total, qint64 time);
102 
103 private:
104  QObjectList m_objects;
105  QList<MusicDownloadData> m_datas;
106 
107 };
108 
109 #define G_DOWNLOAD_MANAGER_PTR makeMusicDownloadManager()
111 
112 #endif // MUSICDOWNLOADMANAGER_H
#define TTK_MODULE_EXPORT
TTK_MODULE_EXPORT MusicDownloadManager * makeMusicDownloadManager()
bool operator==(const TTKOptional< T > &v, const T &other)
Definition: ttkoptional.h:144
MusicDownloadData(qint64 t, QObject *object, TTK::Record type) noexcept
#define TTK_DECLARE_SINGLETON_CLASS(Class)
// Singleton Macro // //
Definition: ttksingleton.h:86
The namespace of the application object.
Definition: ttkcompat.h:24
QList< MusicDownloadData > m_datas
MusicDownloadData(qint64 t) noexcept
constexpr bool operator<(int128_t, int128_t)
Definition: int128.h:634
The class of the produce the download manager.
The class of the download manger data.