3 This file is part of Minitube.
4 Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
6 Minitube is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Minitube is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Minitube. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef NETWORKACCESS_H
22 #define NETWORKACCESS_H
28 QNetworkAccessManager* networkAccessManager();
31 class NetworkReply : public QObject {
36 NetworkReply(QNetworkReply* networkReply);
37 QNetworkReply* getNetworkReply() { return networkReply; }
40 void data(QByteArray);
41 void error(QNetworkReply*);
42 void finished(QNetworkReply*);
46 void requestError(QNetworkReply::NetworkError);
47 void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
52 QNetworkReply *networkReply;
53 QTimer *readTimeoutTimer;
58 class NetworkAccess : public QObject {
63 NetworkAccess(QObject* parent = 0);
64 QNetworkReply* request(QUrl url,
65 int operation = QNetworkAccessManager::GetOperation,
66 const QByteArray &body = QByteArray(), uint offset = 0);
67 NetworkReply* get(QUrl url);
68 NetworkReply* head(QUrl url);
69 NetworkReply* post(QUrl url, const QMap<QString, QString>& params);
72 QNetworkRequest buildRequest(QUrl url);
76 #endif // NETWORKACCESS_H