2013-06-06 13:33:15 +00:00
|
|
|
#ifndef SUBSURFACEWEBSERVICES_H
|
|
|
|
#define SUBSURFACEWEBSERVICES_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QNetworkReply>
|
2013-06-06 14:31:55 +00:00
|
|
|
#include <libxml/tree.h>
|
2013-06-06 13:33:15 +00:00
|
|
|
|
2013-10-25 00:30:21 +00:00
|
|
|
#include "ui_webservices.h"
|
2013-10-03 18:54:25 +00:00
|
|
|
|
2013-06-06 13:33:15 +00:00
|
|
|
class QAbstractButton;
|
|
|
|
class QNetworkReply;
|
|
|
|
|
2013-10-25 00:30:21 +00:00
|
|
|
class WebServices : public QDialog{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2013-11-14 22:39:17 +00:00
|
|
|
explicit WebServices(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
2013-10-25 00:30:21 +00:00
|
|
|
void hidePassword();
|
|
|
|
void hideUpload();
|
|
|
|
|
2013-11-14 22:55:49 +00:00
|
|
|
static QNetworkAccessManager *manager();
|
|
|
|
|
2013-10-25 00:30:21 +00:00
|
|
|
private slots:
|
|
|
|
virtual void startDownload() = 0;
|
2013-10-25 00:52:11 +00:00
|
|
|
virtual void startUpload() = 0;
|
2013-10-25 00:30:21 +00:00
|
|
|
virtual void buttonClicked(QAbstractButton* button) = 0;
|
|
|
|
|
|
|
|
protected:
|
2013-11-15 00:50:46 +00:00
|
|
|
void resetState();
|
|
|
|
|
2013-10-25 00:30:21 +00:00
|
|
|
Ui::WebServices ui;
|
|
|
|
QNetworkReply *reply;
|
|
|
|
QByteArray downloadedData;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SubsurfaceWebServices : public WebServices {
|
2013-06-06 13:33:15 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
static SubsurfaceWebServices* instance();
|
2013-10-25 00:52:11 +00:00
|
|
|
|
2013-06-06 13:33:15 +00:00
|
|
|
private slots:
|
|
|
|
void startDownload();
|
|
|
|
void buttonClicked(QAbstractButton* button);
|
|
|
|
void downloadFinished();
|
|
|
|
void downloadError(QNetworkReply::NetworkError error);
|
2013-10-25 00:52:11 +00:00
|
|
|
void startUpload(){} /*no op*/
|
2013-06-06 13:33:15 +00:00
|
|
|
private:
|
2013-11-14 22:39:17 +00:00
|
|
|
explicit SubsurfaceWebServices(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
2013-06-06 14:31:55 +00:00
|
|
|
void setStatusText(int status);
|
|
|
|
void download_dialog_traverse_xml(xmlNodePtr node, unsigned int *download_status);
|
|
|
|
unsigned int download_dialog_parse_response(const QByteArray& length);
|
2013-06-06 13:33:15 +00:00
|
|
|
};
|
|
|
|
|
2013-10-25 00:52:11 +00:00
|
|
|
class DivelogsDeWebServices : public WebServices {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
static DivelogsDeWebServices * instance();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void startDownload();
|
|
|
|
void buttonClicked(QAbstractButton* button);
|
|
|
|
void downloadFinished();
|
|
|
|
void downloadError(QNetworkReply::NetworkError error);
|
2013-11-14 22:39:17 +00:00
|
|
|
void startUpload();
|
2013-10-25 00:52:11 +00:00
|
|
|
private:
|
2013-11-14 22:39:17 +00:00
|
|
|
explicit DivelogsDeWebServices (QWidget* parent = 0, Qt::WindowFlags f = 0);
|
2013-10-25 00:52:11 +00:00
|
|
|
void setStatusText(int status);
|
|
|
|
void download_dialog_traverse_xml(xmlNodePtr node, unsigned int *download_status);
|
|
|
|
unsigned int download_dialog_parse_response(const QByteArray& length);
|
|
|
|
};
|
|
|
|
|
2013-10-03 18:54:25 +00:00
|
|
|
#endif
|