Improve the download from Subsurface webservice dialog

- make the User ID input field wide enough
- use the progress bar for an explanatory text
- mark it as 100% completed once the download succeeds

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-01-15 15:33:04 +07:00
parent 07c116ecd2
commit 78cdded902
2 changed files with 11 additions and 0 deletions

View file

@ -319,6 +319,9 @@ SubsurfaceWebServices::SubsurfaceWebServices(QWidget* parent, Qt::WindowFlags f)
ui.userID->setText(s.value("subsurface_webservice_uid").toString().toUpper()); ui.userID->setText(s.value("subsurface_webservice_uid").toString().toUpper());
hidePassword(); hidePassword();
hideUpload(); hideUpload();
ui.progressBar->setFormat("Enter User ID and click Download");
ui.progressBar->setRange(0,1);
ui.progressBar->setValue(-1);
} }
void SubsurfaceWebServices::buttonClicked(QAbstractButton* button) void SubsurfaceWebServices::buttonClicked(QAbstractButton* button)
@ -370,6 +373,7 @@ void SubsurfaceWebServices::startDownload()
request.setRawHeader("Accept", "text/xml"); request.setRawHeader("Accept", "text/xml");
reply = manager()->get(request); reply = manager()->get(request);
ui.status->setText(tr("Connecting...")); ui.status->setText(tr("Connecting..."));
ui.progressBar->setEnabled(true);
ui.progressBar->setRange(0,0); // this makes the progressbar do an 'infinite spin' ui.progressBar->setRange(0,0); // this makes the progressbar do an 'infinite spin'
ui.download->setEnabled(false); ui.download->setEnabled(false);
ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false); ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
@ -382,6 +386,8 @@ void SubsurfaceWebServices::downloadFinished()
return; return;
ui.progressBar->setRange(0,1); ui.progressBar->setRange(0,1);
ui.progressBar->setValue(1);
ui.progressBar->setFormat("%p%");
downloadedData = reply->readAll(); downloadedData = reply->readAll();
ui.download->setEnabled(true); ui.download->setEnabled(true);

View file

@ -31,6 +31,11 @@
<property name="placeholderText"> <property name="placeholderText">
<string>Enter your ID here</string> <string>Enter your ID here</string>
</property> </property>
<property name="minimumSize">
<size>
<width>420</width>
</size>
</property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">