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>
This commit is contained in:
jan Iversen 2019-12-09 13:52:34 +01:00 committed by Dirk Hohndel
parent 9fd95c18bd
commit 5a4128a8f2
2 changed files with 5 additions and 0 deletions

View file

@ -74,6 +74,8 @@ bool uploadDiveLogsDE::prepareDives(const QString &tempfile, const bool selected
xsltStylesheetPtr xslt = NULL; xsltStylesheetPtr xslt = NULL;
struct zip *zip; struct zip *zip;
emit uploadStatus(tr("building zip file to upload"));
xslt = get_stylesheet("divelogs-export.xslt"); xslt = get_stylesheet("divelogs-export.xslt");
if (!xslt) { if (!xslt) {
qDebug() << errPrefix << "missing stylesheet"; qDebug() << errPrefix << "missing stylesheet";
@ -214,6 +216,8 @@ void uploadDiveLogsDE::uploadDives(const QString &filename, const QString &useri
} }
multipart = new QHttpMultiPart(QHttpMultiPart::FormDataType); multipart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
emit uploadStatus(tr("Uploading dives"));
// prepare header with filename (of all dives) and pointer to file // prepare header with filename (of all dives) and pointer to file
args = "form-data; name=\"userfile\"; filename=\"" + filename + "\""; args = "form-data; name=\"userfile\"; filename=\"" + filename + "\"";
part1.setRawHeader("Content-Disposition", args.toLatin1()); part1.setRawHeader("Content-Disposition", args.toLatin1());

View file

@ -25,6 +25,7 @@ private slots:
signals: signals:
void uploadFinish(bool success, const QString &text); void uploadFinish(bool success, const QString &text);
void uploadProgress(qreal percentage, qreal total); void uploadProgress(qreal percentage, qreal total);
void uploadStatus(const QString &text);
private: private:
uploadDiveLogsDE(); uploadDiveLogsDE();