subsurface/core/uploadDiveLogsDE.h
jan Iversen 49e6330399 core: make shared prepareDives identical to desktop prepare_dives_for_divelogs
In order to replace DivelogsDeWebServices::prepare_dives_for_divelogs with
uploadDiveLogsDE::prepareDives, first step is to make the functions identical.

amount_selected is not maintained for mobile, add #ifdef SUBSURFACE_MOBILE

Add comment, to make code more readable

add white line to make code more readable

change to use variable ds (created a couple of lines earlier

Avoid "goto" by adding close code

Remove label and close code (it was only called in 1 place)

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

36 lines
906 B
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);
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(const QString &tempfile, const bool selected);
void uploadDives(const QString &filename, const QString &userid, const QString &password);
QNetworkReply *reply;
QHttpMultiPart *multipart;
QTimer timeout;
};
#endif // UPLOADDIVELOGSDE_H