aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2015-01-20 22:40:50 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-21 17:03:18 +1200
commitba525df7665cff904818ccfc70c183f16c7b5f45 (patch)
treee5174132a011e05a6314b8743118ac524b2c76a2
parent0787d941a0f58417a2eb1a656e54c19123366c71 (diff)
downloadsubsurface-ba525df7665cff904818ccfc70c183f16c7b5f45.tar.gz
Use a progressbar in the configure dc dialog
This switches from a couple of labels in the dialog to a progress bar, to later being able to use it to provide better user experience. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/configuredivecomputerdialog.cpp24
-rw-r--r--qt-ui/configuredivecomputerdialog.ui15
2 files changed, 21 insertions, 18 deletions
diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp
index bc9ff5e2f..ab9f032f9 100644
--- a/qt-ui/configuredivecomputerdialog.cpp
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -670,8 +670,10 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsSuuntoVyper()
void ConfigureDiveComputerDialog::readSettings()
{
- ui.statusLabel->clear();
- ui.errorLabel->clear();
+ // Disable the retrieve button while read thread is running
+ ui.progressBar->setValue(0);
+ ui.progressBar->setFormat("%p%");
+ ui.progressBar->setTextVisible(true);
getDeviceData();
config->readSettings(&device_data);
@@ -679,8 +681,9 @@ void ConfigureDiveComputerDialog::readSettings()
void ConfigureDiveComputerDialog::resetSettings()
{
- ui.statusLabel->clear();
- ui.errorLabel->clear();
+ ui.progressBar->setValue(0);
+ ui.progressBar->setFormat("%p%");
+ ui.progressBar->setTextVisible(true);
getDeviceData();
config->resetSettings(&device_data);
@@ -688,13 +691,12 @@ void ConfigureDiveComputerDialog::resetSettings()
void ConfigureDiveComputerDialog::configMessage(QString msg)
{
- ui.statusLabel->setText(msg);
+ ui.progressBar->setFormat(msg);
}
void ConfigureDiveComputerDialog::configError(QString err)
{
- ui.statusLabel->setText("");
- ui.errorLabel->setText(err);
+ ui.progressBar->setFormat("Error: " + err);
}
void ConfigureDiveComputerDialog::getDeviceData()
@@ -716,6 +718,10 @@ void ConfigureDiveComputerDialog::on_cancel_clicked()
void ConfigureDiveComputerDialog::on_saveSettingsPushButton_clicked()
{
+ ui.progressBar->setValue(0);
+ ui.progressBar->setFormat("%p%");
+ ui.progressBar->setTextVisible(true);
+
populateDeviceDetails();
getDeviceData();
config->saveDeviceDetails(deviceDetails, &device_data);
@@ -1058,6 +1064,10 @@ void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked()
QString firmwarePath = QFileDialog::getOpenFileName(this, tr("Select firmware file"),
filename, tr("All files (*.*)"));
if (!firmwarePath.isEmpty()) {
+ ui.progressBar->setValue(0);
+ ui.progressBar->setFormat("%p%");
+ ui.progressBar->setTextVisible(true);
+
getDeviceData();
config->startFirmwareUpdate(firmwarePath, &device_data);
}
diff --git a/qt-ui/configuredivecomputerdialog.ui b/qt-ui/configuredivecomputerdialog.ui
index 134c43538..99d07432b 100644
--- a/qt-ui/configuredivecomputerdialog.ui
+++ b/qt-ui/configuredivecomputerdialog.ui
@@ -2373,18 +2373,11 @@
</widget>
</item>
<item>
- <widget class="QLabel" name="errorLabel">
- <property name="styleSheet">
- <string notr="true">color: rgb(242, 19, 25);</string>
+ <widget class="QProgressBar" name="progressBar">
+ <property name="value">
+ <number>0</number>
</property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="statusLabel">
- <property name="text">
+ <property name="format">
<string/>
</property>
</widget>