summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2019-12-10 15:36:31 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-11 11:08:51 -0500
commit91e0ee9d9bbf5a3630f3c203f6ecba9e91eec6f8 (patch)
tree8ee35df52a673c84da83347c6a6af7123df4c38e /desktop-widgets
parentfc740f63697f332d88c9f8a2be74e53e582f096b (diff)
downloadsubsurface-91e0ee9d9bbf5a3630f3c203f6ecba9e91eec6f8.tar.gz
desktop-widgets: diveDiveShareExportDialog add signal handling
connect signals from uploadDiveShare and remove reply variable Signed-off-by: Jan Iversen <jan@casacondor.com>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/diveshareexportdialog.cpp21
-rw-r--r--desktop-widgets/diveshareexportdialog.h3
2 files changed, 14 insertions, 10 deletions
diff --git a/desktop-widgets/diveshareexportdialog.cpp b/desktop-widgets/diveshareexportdialog.cpp
index 5207569fb..2f41dffea 100644
--- a/desktop-widgets/diveshareexportdialog.cpp
+++ b/desktop-widgets/diveshareexportdialog.cpp
@@ -15,8 +15,7 @@
DiveShareExportDialog::DiveShareExportDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::DiveShareExportDialog),
- exportSelected(false),
- reply(NULL)
+ exportSelected(false)
{
ui->setupUi(this);
}
@@ -89,18 +88,16 @@ static QByteArray generate_html_list(const QByteArray &data)
return html;
}
-void DiveShareExportDialog::finishedSlot()
+void DiveShareExportDialog::finishedSlot(bool isOk, const QString &text, const QByteArray &html)
{
ui->progressBar->setVisible(false);
- if (reply->error() != 0) {
+ if (!isOk) {
ui->buttonBox->setStandardButtons(QDialogButtonBox::Cancel);
- ui->txtResult->setText(reply->errorString());
+ ui->txtResult->setText(text);
} else {
ui->buttonBox->setStandardButtons(QDialogButtonBox::Ok);
- ui->txtResult->setHtml(generate_html_list(reply->readAll()));
+ ui->txtResult->setHtml(generate_html_list(html));
}
-
- reply->deleteLater();
}
void DiveShareExportDialog::doUpload()
@@ -118,4 +115,12 @@ void DiveShareExportDialog::doUpload()
ui->progressBar->setRange(0, 0);
uploadDiveShare::instance()->doUpload(exportSelected, uid, noPublic);
+ connect(uploadDiveShare::instance(), SIGNAL(uploadFinish(bool, const QString &, const QByteArray &)),
+ this, SLOT(finishedSlot(bool, const QString &, const QByteArray &)));
+
+ // Not implemented in the UI, but would be nice to have
+ //connect(uploadDiveLogsDE::instance(), SIGNAL(uploadProgress(qreal, qreal)),
+ // this, SLOT(updateProgress(qreal, qreal)));
+ //connect(uploadDiveLogsDE::instance(), SIGNAL(uploadStatus(const QString &)),
+ // this, SLOT(uploadStatus(const QString &)));
}
diff --git a/desktop-widgets/diveshareexportdialog.h b/desktop-widgets/diveshareexportdialog.h
index 4fd13781a..391a23def 100644
--- a/desktop-widgets/diveshareexportdialog.h
+++ b/desktop-widgets/diveshareexportdialog.h
@@ -24,12 +24,11 @@ public:
private:
Ui::DiveShareExportDialog *ui;
bool exportSelected;
- QNetworkReply *reply;
private
slots:
void UIDFromBrowser();
void doUpload();
- void finishedSlot();
+ void finishedSlot(bool, const QString &, const QByteArray &);
};
#endif // DIVESHAREEXPORTDIALOG_H