2019-11-27 08:48:58 +00:00
|
|
|
// 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);
|
|
|
|
|
2019-12-09 08:50:26 +00:00
|
|
|
// only to be used in desktop-widgets::subsurfacewebservices
|
|
|
|
bool prepareDives(const QString &tempfile, const bool selected);
|
|
|
|
|
2019-11-27 08:48:58 +00:00
|
|
|
private slots:
|
2019-12-09 09:49:40 +00:00
|
|
|
void updateProgressSlot(qint64 current, qint64 total);
|
|
|
|
void uploadFinishedSlot();
|
|
|
|
void uploadTimeoutSlot();
|
|
|
|
void uploadErrorSlot(QNetworkReply::NetworkError error);
|
2019-11-27 08:48:58 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void uploadFinish(bool success, const QString &text);
|
2019-12-09 11:18:33 +00:00
|
|
|
void uploadProgress(qreal percentage, qreal total);
|
2019-11-27 08:48:58 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
uploadDiveLogsDE();
|
|
|
|
|
|
|
|
void uploadDives(const QString &filename, const QString &userid, const QString &password);
|
|
|
|
|
|
|
|
QNetworkReply *reply;
|
|
|
|
QHttpMultiPart *multipart;
|
|
|
|
QTimer timeout;
|
|
|
|
};
|
|
|
|
#endif // UPLOADDIVELOGSDE_H
|