mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-02 23:20:20 +00:00
ff96bcb0fc
One of the rules of using QNetworkAccessManager is to share it among all users, since sockets and other state can be shared. Looks like Marble doesn't allow us to set it, though, and it creates multiple instances. I'll prepare an upstream patch to fix that sometime. Signed-off-by: Thiago Macieira <thiago@macieira.org>
69 lines
1.8 KiB
C++
69 lines
1.8 KiB
C++
#ifndef SUBSURFACEWEBSERVICES_H
|
|
#define SUBSURFACEWEBSERVICES_H
|
|
|
|
#include <QDialog>
|
|
#include <QNetworkReply>
|
|
#include <libxml/tree.h>
|
|
|
|
#include "ui_webservices.h"
|
|
|
|
class QAbstractButton;
|
|
class QNetworkReply;
|
|
|
|
class WebServices : public QDialog{
|
|
Q_OBJECT
|
|
public:
|
|
explicit WebServices(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
|
void hidePassword();
|
|
void hideUpload();
|
|
|
|
static QNetworkAccessManager *manager();
|
|
|
|
private slots:
|
|
virtual void startDownload() = 0;
|
|
virtual void startUpload() = 0;
|
|
virtual void buttonClicked(QAbstractButton* button) = 0;
|
|
|
|
protected:
|
|
Ui::WebServices ui;
|
|
QNetworkReply *reply;
|
|
QByteArray downloadedData;
|
|
};
|
|
|
|
class SubsurfaceWebServices : public WebServices {
|
|
Q_OBJECT
|
|
public:
|
|
static SubsurfaceWebServices* instance();
|
|
|
|
private slots:
|
|
void startDownload();
|
|
void buttonClicked(QAbstractButton* button);
|
|
void downloadFinished();
|
|
void downloadError(QNetworkReply::NetworkError error);
|
|
void startUpload(){} /*no op*/
|
|
private:
|
|
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);
|
|
};
|
|
|
|
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);
|
|
void startUpload();
|
|
private:
|
|
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);
|
|
};
|
|
|
|
#endif
|