]> git.sur5r.net Git - minitube/blobdiff - src/networkaccess.h
Imported Upstream version 2.5.2
[minitube] / src / networkaccess.h
index 1a05d91d38c2520bf2d857ce28746fe6bd32bb4d..770818651bf4295e8de1dbfd45bc53e0391e2f76 100644 (file)
@@ -1,3 +1,23 @@
+/* $BEGIN_LICENSE
+
+This file is part of Minitube.
+Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
+
+Minitube is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Minitube is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Minitube.  If not, see <http://www.gnu.org/licenses/>.
+
+$END_LICENSE */
+
 #ifndef NETWORKACCESS_H
 #define NETWORKACCESS_H
 
@@ -14,21 +34,24 @@ class NetworkReply : public QObject {
 
 public:
     NetworkReply(QNetworkReply* networkReply);
-
-public slots:
-    void finished();
-    void requestError(QNetworkReply::NetworkError);
-    void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
-    void readTimeout();
+    QNetworkReply* getNetworkReply() { return networkReply; }
 
 signals:
     void data(QByteArray);
     void error(QNetworkReply*);
     void finished(QNetworkReply*);
 
+private slots:
+    void finished();
+    void requestError(QNetworkReply::NetworkError);
+    void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
+    void readTimeout();
+
 private:
+    void setupReply();
     QNetworkReply *networkReply;
     QTimer *readTimeoutTimer;
+    int retryCount;
 
 };
 
@@ -37,15 +60,16 @@ class NetworkAccess : public QObject {
     Q_OBJECT
 
 public:
-    NetworkAccess( QObject* parent=0);
-    QNetworkReply* manualGet(QNetworkRequest request, int operation = QNetworkAccessManager::GetOperation);
-    QNetworkRequest buildRequest(QUrl url);
-    QNetworkReply* simpleGet(QUrl url, int operation = QNetworkAccessManager::GetOperation);
+    NetworkAccess(QObject* parent = 0);
+    QNetworkReply* request(QUrl url,
+                             int operation = QNetworkAccessManager::GetOperation,
+                             const QByteArray &body = QByteArray(), uint offset = 0);
     NetworkReply* get(QUrl url);
     NetworkReply* head(QUrl url);
+    NetworkReply* post(QUrl url, const QMap<QString, QString>& params);
 
-private slots:
-    void error(QNetworkReply::NetworkError);
+private:
+    QNetworkRequest buildRequest(QUrl url);
 
 };