summaryrefslogtreecommitdiffstats
path: root/core/uploadDiveLogsDE.h
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2019-11-27 09:48:58 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-11 12:36:43 -0500
commiteb08f17a03082f6ce677b38a06f2f3d10b327dfc (patch)
treeda07fa526f4e1dcaa1fcc63a1f375ab5da5006fd /core/uploadDiveLogsDE.h
parent42939ab7f88469d1cbf3e4f4369eea9e58d7a847 (diff)
downloadsubsurface-eb08f17a03082f6ce677b38a06f2f3d10b327dfc.tar.gz
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 <jan@casacondor.com>
Diffstat (limited to 'core/uploadDiveLogsDE.h')
-rw-r--r--core/uploadDiveLogsDE.h36
1 files changed, 36 insertions, 0 deletions
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 <QNetworkReply>
+#include <QHttpMultiPart>
+#include <QTimer>
+
+
+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