subsurface/core/uploadDiveLogsDE.h
jan Iversen 5a4128a8f2 core: add uploadStatus signal to uploadDiveLogsDE
The uploadStatus signal can be used to inform the user about
the process e.g.
- preparing zip file
- starting actual upload

It is a suplement to uploadProgress, that only informs about
the network part.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-11 12:36:43 -05:00

39 lines
1 KiB
C++

// 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);
// only to be used in desktop-widgets::subsurfacewebservices
bool prepareDives(const QString &tempfile, const bool selected);
private slots:
void updateProgressSlot(qint64 current, qint64 total);
void uploadFinishedSlot();
void uploadTimeoutSlot();
void uploadErrorSlot(QNetworkReply::NetworkError error);
signals:
void uploadFinish(bool success, const QString &text);
void uploadProgress(qreal percentage, qreal total);
void uploadStatus(const QString &text);
private:
uploadDiveLogsDE();
void uploadDives(const QString &filename, const QString &userid, const QString &password);
QNetworkReply *reply;
QHttpMultiPart *multipart;
QTimer timeout;
};
#endif // UPLOADDIVELOGSDE_H