File indexing completed on 2025-02-23 04:27:36

0001 /****************************************************************************************
0002  * Copyright (c) 2006 Ian Monroe <ian@monroe.nu>                                        *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) version 3 or        *
0007  * any later version accepted by the membership of KDE e.V. (or its successor approved  *
0008  * by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of  *
0009  * version 3 of the license.                                                            *
0010  *                                                                                      *
0011  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0012  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0013  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0014  *                                                                                      *
0015  * You should have received a copy of the GNU General Public License along with         *
0016  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0017  ****************************************************************************************/
0018 
0019 #ifndef DAAPCONTENTFETCHER_H
0020 #define DAAPCONTENTFETCHER_H
0021 
0022 #include <QByteArray>
0023 #include <QObject>
0024 
0025 class QIODevice;
0026 class QNetworkReply;
0027 
0028 namespace Daap {
0029 
0030 /**
0031    Inspired by a daapsharp class of the same name. Basically it adds all the silly headers
0032    that DAAP needs
0033     @author Ian Monroe <ian@monroe.nu>
0034 */
0035 class ContentFetcher : public QObject
0036 {
0037     Q_OBJECT
0038 
0039     public:
0040         ContentFetcher( const QString & hostname, quint16 port, const QString& password, QObject * parent = nullptr, const char * name = nullptr );
0041         ~ContentFetcher() override;
0042 
0043         void getDaap( const QString & command, QIODevice* musicFile = nullptr );
0044         QByteArray results();
0045 
0046     private Q_SLOTS:
0047         void onFinished();
0048 
0049     Q_SIGNALS:
0050         void httpError( const QString& );
0051         void finished();
0052         void loginRequired();
0053 
0054     private:
0055         QNetworkReply *m_reply;
0056         QByteArray m_lastResult;
0057         QString m_hostname;
0058         quint16 m_port;
0059         QByteArray m_authorize;
0060         bool m_selfDestruct;
0061         static int s_requestId; //!< Apple needs this for some reason
0062 };
0063 
0064 
0065 
0066 }
0067 
0068 #endif