summaryrefslogtreecommitdiffstats
path: root/qt-ui/subsurfacewebservices.h
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-04 16:21:44 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-04 16:21:44 -0800
commit421dceba1ed37b5000c4ad5796f4924fb15587b4 (patch)
tree57830cf95bf9ea3af32f2253673c5d145fa76dea /qt-ui/subsurfacewebservices.h
parent28b8d177c3b10d32201615d15c2aba2f969cf3f4 (diff)
parent662e642ac9f650ccafda75d53ff54ff587b3d97c (diff)
downloadsubsurface-421dceba1ed37b5000c4ad5796f4924fb15587b4.tar.gz
Merge branch 'improve-subsurfaceweb' of git://github.com/thiagomacieira/subsurface
Diffstat (limited to 'qt-ui/subsurfacewebservices.h')
-rw-r--r--qt-ui/subsurfacewebservices.h33
1 files changed, 28 insertions, 5 deletions
diff --git a/qt-ui/subsurfacewebservices.h b/qt-ui/subsurfacewebservices.h
index 515e3fe9c..3c41b08d1 100644
--- a/qt-ui/subsurfacewebservices.h
+++ b/qt-ui/subsurfacewebservices.h
@@ -3,29 +3,43 @@
#include <QDialog>
#include <QNetworkReply>
+#include <QTemporaryFile>
+#include <QTimer>
#include <libxml/tree.h>
#include "ui_webservices.h"
class QAbstractButton;
class QNetworkReply;
+class QHttpMultiPart;
class WebServices : public QDialog{
Q_OBJECT
public:
- explicit WebServices(QWidget* parent = 0, Qt::WindowFlags f = 0);
+ explicit WebServices(QWidget* parent = 0, Qt::WindowFlags f = 0);
void hidePassword();
void hideUpload();
+ void hideDownload();
+
+ static QNetworkAccessManager *manager();
private slots:
virtual void startDownload() = 0;
virtual void startUpload() = 0;
virtual void buttonClicked(QAbstractButton* button) = 0;
+ virtual void downloadTimedOut();
+
+protected slots:
+ void updateProgress(qint64 current, qint64 total);
protected:
+ void resetState();
+ void connectSignalsForDownload(QNetworkReply *reply);
+ void connectSignalsForUpload();
+
Ui::WebServices ui;
QNetworkReply *reply;
- QNetworkAccessManager *manager;
+ QTimer timeout;
QByteArray downloadedData;
};
@@ -41,7 +55,7 @@ private slots:
void downloadError(QNetworkReply::NetworkError error);
void startUpload(){} /*no op*/
private:
- explicit SubsurfaceWebServices(QWidget* parent = 0, Qt::WindowFlags f = 0);
+ explicit SubsurfaceWebServices(QWidget* parent = 0, Qt::WindowFlags f = 0);
void setStatusText(int status);
void download_dialog_traverse_xml(xmlNodePtr node, unsigned int *download_status);
unsigned int download_dialog_parse_response(const QByteArray& length);
@@ -51,18 +65,27 @@ class DivelogsDeWebServices : public WebServices {
Q_OBJECT
public:
static DivelogsDeWebServices * instance();
+ void downloadDives();
+ void uploadDives(QIODevice *dldContent);
private slots:
void startDownload();
void buttonClicked(QAbstractButton* button);
+ void saveToZipFile();
+ void listDownloadFinished();
void downloadFinished();
+ void uploadFinished();
void downloadError(QNetworkReply::NetworkError error);
- void startUpload();
+ void uploadError(QNetworkReply::NetworkError error);
+ void startUpload();
private:
- explicit DivelogsDeWebServices (QWidget* parent = 0, Qt::WindowFlags f = 0);
+ explicit DivelogsDeWebServices (QWidget* parent = 0, Qt::WindowFlags f = 0);
void setStatusText(int status);
void download_dialog_traverse_xml(xmlNodePtr node, unsigned int *download_status);
unsigned int download_dialog_parse_response(const QByteArray& length);
+
+ QHttpMultiPart *multipart;
+ QTemporaryFile zipFile;
};
#endif