Qmmp
playlistdownloader.h
1 /***************************************************************************
2  * Copyright (C) 2012-2017 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef PLAYLISTDOWNLOADER_H
22 #define PLAYLISTDOWNLOADER_H
23 
24 #include <QObject>
25 #include <QUrl>
26 #include <QPointer>
27 #include "playlistmodel.h"
28 
29 class QNetworkAccessManager;
30 class QNetworkReply;
31 
35 class PlayListDownloader : public QObject
36 {
37  Q_OBJECT
38 public:
42  explicit PlayListDownloader(QObject *parent = 0);
43 
44 signals:
50  void finished(bool ok, const QString &message = QString());
51 
52 public slots:
58  void start(const QUrl &url, PlayListModel *model);
59 
60 private slots:
61  void readResponse(QNetworkReply *reply);
62 
63 private:
64  QNetworkAccessManager *m_manager;
65  QUrl m_redirect_url, m_url;
66  QNetworkReply *m_getReply;
67  QByteArray m_ua;
68  QPointer<PlayListModel> m_model;
69 };
70 
71 #endif // PLAYLISTDOWNLOADER_H
The PlayListDownloader class downloads playlist from remote URL and extracts tracks.
Definition: playlistdownloader.h:35
The PlayListModel class provides a data model for the playlist.
Definition: playlistmodel.h:101
PlayListDownloader(QObject *parent=0)
void finished(bool ok, const QString &message=QString())
void start(const QUrl &url, PlayListModel *model)