mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
desktop-widgets: diveDiveShareExportDialog add signal handling
connect signals from uploadDiveShare and remove reply variable Signed-off-by: Jan Iversen <jan@casacondor.com>
This commit is contained in:
parent
fc740f6369
commit
91e0ee9d9b
2 changed files with 14 additions and 10 deletions
|
@ -15,8 +15,7 @@
|
||||||
DiveShareExportDialog::DiveShareExportDialog(QWidget *parent) :
|
DiveShareExportDialog::DiveShareExportDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::DiveShareExportDialog),
|
ui(new Ui::DiveShareExportDialog),
|
||||||
exportSelected(false),
|
exportSelected(false)
|
||||||
reply(NULL)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
}
|
}
|
||||||
|
@ -89,18 +88,16 @@ static QByteArray generate_html_list(const QByteArray &data)
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveShareExportDialog::finishedSlot()
|
void DiveShareExportDialog::finishedSlot(bool isOk, const QString &text, const QByteArray &html)
|
||||||
{
|
{
|
||||||
ui->progressBar->setVisible(false);
|
ui->progressBar->setVisible(false);
|
||||||
if (reply->error() != 0) {
|
if (!isOk) {
|
||||||
ui->buttonBox->setStandardButtons(QDialogButtonBox::Cancel);
|
ui->buttonBox->setStandardButtons(QDialogButtonBox::Cancel);
|
||||||
ui->txtResult->setText(reply->errorString());
|
ui->txtResult->setText(text);
|
||||||
} else {
|
} else {
|
||||||
ui->buttonBox->setStandardButtons(QDialogButtonBox::Ok);
|
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()
|
void DiveShareExportDialog::doUpload()
|
||||||
|
@ -118,4 +115,12 @@ void DiveShareExportDialog::doUpload()
|
||||||
ui->progressBar->setRange(0, 0);
|
ui->progressBar->setRange(0, 0);
|
||||||
|
|
||||||
uploadDiveShare::instance()->doUpload(exportSelected, uid, noPublic);
|
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 &)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,12 +24,11 @@ public:
|
||||||
private:
|
private:
|
||||||
Ui::DiveShareExportDialog *ui;
|
Ui::DiveShareExportDialog *ui;
|
||||||
bool exportSelected;
|
bool exportSelected;
|
||||||
QNetworkReply *reply;
|
|
||||||
private
|
private
|
||||||
slots:
|
slots:
|
||||||
void UIDFromBrowser();
|
void UIDFromBrowser();
|
||||||
void doUpload();
|
void doUpload();
|
||||||
void finishedSlot();
|
void finishedSlot(bool, const QString &, const QByteArray &);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIVESHAREEXPORTDIALOG_H
|
#endif // DIVESHAREEXPORTDIALOG_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue