mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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>
This commit is contained in:
parent
0787d941a0
commit
ba525df766
2 changed files with 21 additions and 18 deletions
|
@ -670,8 +670,10 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsSuuntoVyper()
|
||||||
|
|
||||||
void ConfigureDiveComputerDialog::readSettings()
|
void ConfigureDiveComputerDialog::readSettings()
|
||||||
{
|
{
|
||||||
ui.statusLabel->clear();
|
// Disable the retrieve button while read thread is running
|
||||||
ui.errorLabel->clear();
|
ui.progressBar->setValue(0);
|
||||||
|
ui.progressBar->setFormat("%p%");
|
||||||
|
ui.progressBar->setTextVisible(true);
|
||||||
|
|
||||||
getDeviceData();
|
getDeviceData();
|
||||||
config->readSettings(&device_data);
|
config->readSettings(&device_data);
|
||||||
|
@ -679,8 +681,9 @@ void ConfigureDiveComputerDialog::readSettings()
|
||||||
|
|
||||||
void ConfigureDiveComputerDialog::resetSettings()
|
void ConfigureDiveComputerDialog::resetSettings()
|
||||||
{
|
{
|
||||||
ui.statusLabel->clear();
|
ui.progressBar->setValue(0);
|
||||||
ui.errorLabel->clear();
|
ui.progressBar->setFormat("%p%");
|
||||||
|
ui.progressBar->setTextVisible(true);
|
||||||
|
|
||||||
getDeviceData();
|
getDeviceData();
|
||||||
config->resetSettings(&device_data);
|
config->resetSettings(&device_data);
|
||||||
|
@ -688,13 +691,12 @@ void ConfigureDiveComputerDialog::resetSettings()
|
||||||
|
|
||||||
void ConfigureDiveComputerDialog::configMessage(QString msg)
|
void ConfigureDiveComputerDialog::configMessage(QString msg)
|
||||||
{
|
{
|
||||||
ui.statusLabel->setText(msg);
|
ui.progressBar->setFormat(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDiveComputerDialog::configError(QString err)
|
void ConfigureDiveComputerDialog::configError(QString err)
|
||||||
{
|
{
|
||||||
ui.statusLabel->setText("");
|
ui.progressBar->setFormat("Error: " + err);
|
||||||
ui.errorLabel->setText(err);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDiveComputerDialog::getDeviceData()
|
void ConfigureDiveComputerDialog::getDeviceData()
|
||||||
|
@ -716,6 +718,10 @@ void ConfigureDiveComputerDialog::on_cancel_clicked()
|
||||||
|
|
||||||
void ConfigureDiveComputerDialog::on_saveSettingsPushButton_clicked()
|
void ConfigureDiveComputerDialog::on_saveSettingsPushButton_clicked()
|
||||||
{
|
{
|
||||||
|
ui.progressBar->setValue(0);
|
||||||
|
ui.progressBar->setFormat("%p%");
|
||||||
|
ui.progressBar->setTextVisible(true);
|
||||||
|
|
||||||
populateDeviceDetails();
|
populateDeviceDetails();
|
||||||
getDeviceData();
|
getDeviceData();
|
||||||
config->saveDeviceDetails(deviceDetails, &device_data);
|
config->saveDeviceDetails(deviceDetails, &device_data);
|
||||||
|
@ -1058,6 +1064,10 @@ void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked()
|
||||||
QString firmwarePath = QFileDialog::getOpenFileName(this, tr("Select firmware file"),
|
QString firmwarePath = QFileDialog::getOpenFileName(this, tr("Select firmware file"),
|
||||||
filename, tr("All files (*.*)"));
|
filename, tr("All files (*.*)"));
|
||||||
if (!firmwarePath.isEmpty()) {
|
if (!firmwarePath.isEmpty()) {
|
||||||
|
ui.progressBar->setValue(0);
|
||||||
|
ui.progressBar->setFormat("%p%");
|
||||||
|
ui.progressBar->setTextVisible(true);
|
||||||
|
|
||||||
getDeviceData();
|
getDeviceData();
|
||||||
config->startFirmwareUpdate(firmwarePath, &device_data);
|
config->startFirmwareUpdate(firmwarePath, &device_data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2373,18 +2373,11 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="errorLabel">
|
<widget class="QProgressBar" name="progressBar">
|
||||||
<property name="styleSheet">
|
<property name="value">
|
||||||
<string notr="true">color: rgb(242, 19, 25);</string>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="format">
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="statusLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
Loading…
Add table
Reference in a new issue