mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
7c22e4d805
UserSurveyServices derives from WebServices and therefore has to define three pure virtual functions [startDownload(), startUpload(), buttonClicked()] as no-ops. Interestingly, a comment in the header says "need to declare them as no ops or Qt4 is unhappy" which is of course not true as these functions are not declared by Qt. There seems to be no point in deriving from WebServices, therefore don't do it. These function definitions can then be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
87 lines
2.1 KiB
C++
87 lines
2.1 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef SUBSURFACEWEBSERVICES_H
|
|
#define SUBSURFACEWEBSERVICES_H
|
|
|
|
#include <QDialog>
|
|
#include <QNetworkReply>
|
|
#include <QTemporaryFile>
|
|
#include <QTimer>
|
|
#include <libxml/tree.h>
|
|
|
|
#include "ui_webservices.h"
|
|
|
|
class QAbstractButton;
|
|
class QHttpMultiPart;
|
|
|
|
class WebServices : public QDialog {
|
|
Q_OBJECT
|
|
public:
|
|
explicit WebServices(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
|
void hidePassword();
|
|
void hideUpload();
|
|
void hideDownload();
|
|
|
|
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;
|
|
QTimer timeout;
|
|
QByteArray downloadedData;
|
|
QString defaultApplyText;
|
|
QString userAgent;
|
|
};
|
|
|
|
class DivelogsDeWebServices : public WebServices {
|
|
Q_OBJECT
|
|
public:
|
|
static DivelogsDeWebServices *instance();
|
|
void downloadDives();
|
|
void prepareDivesForUpload(bool selected);
|
|
|
|
private
|
|
slots:
|
|
void startDownload();
|
|
void buttonClicked(QAbstractButton *button);
|
|
void saveToZipFile();
|
|
void listDownloadFinished();
|
|
void downloadFinished();
|
|
void uploadFinished();
|
|
void downloadError(QNetworkReply::NetworkError error);
|
|
void uploadError(QNetworkReply::NetworkError error);
|
|
void startUpload();
|
|
|
|
private:
|
|
void uploadDives(QIODevice *dldContent);
|
|
explicit DivelogsDeWebServices(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
|
void setStatusText(int status);
|
|
bool prepare_dives_for_divelogs(const QString &filename, bool selected);
|
|
void download_dialog_traverse_xml(xmlNodePtr node, unsigned int *download_status);
|
|
unsigned int download_dialog_parse_response(const QByteArray &length);
|
|
|
|
QHttpMultiPart *multipart;
|
|
QTemporaryFile zipFile;
|
|
bool uploadMode;
|
|
};
|
|
|
|
class UserSurveyServices : public QDialog {
|
|
Q_OBJECT
|
|
public:
|
|
QNetworkReply* sendSurvey(QString values);
|
|
explicit UserSurveyServices(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
|
};
|
|
|
|
#endif // SUBSURFACEWEBSERVICES_H
|