From eb08f17a03082f6ce677b38a06f2f3d10b327dfc Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Wed, 27 Nov 2019 09:48:58 +0100 Subject: core: add upload divelogs.de class The implementation is based on class DivelogsDeWebServices in desktop-widgets but without the UI entanglement Signed-off-by: Jan Iversen --- core/uploadDiveLogsDE.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 core/uploadDiveLogsDE.h (limited to 'core/uploadDiveLogsDE.h') diff --git a/core/uploadDiveLogsDE.h b/core/uploadDiveLogsDE.h new file mode 100644 index 000000000..d19d20a26 --- /dev/null +++ b/core/uploadDiveLogsDE.h @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifndef UPLOADDIVELOGSDE_H +#define UPLOADDIVELOGSDE_H +#include +#include +#include + + +class uploadDiveLogsDE : public QObject { + Q_OBJECT + +public: + static uploadDiveLogsDE *instance(); + void doUpload(bool selected, const QString &userid, const QString &password); + +private slots: + void updateProgress(qint64 current, qint64 total); + void uploadFinished(); + void uploadTimeout(); + void uploadError(QNetworkReply::NetworkError error); + +signals: + void uploadFinish(bool success, const QString &text); + void uploadProgress(qreal percentage); + +private: + uploadDiveLogsDE(); + + bool prepareDives(bool selected, const QString &filename); + void uploadDives(const QString &filename, const QString &userid, const QString &password); + + QNetworkReply *reply; + QHttpMultiPart *multipart; + QTimer timeout; +}; +#endif // UPLOADDIVELOGSDE_H -- cgit v1.2.3-70-g09d2