summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2014-07-31 18:51:38 +0300
committerGravatar Thiago Macieira <thiago@macieira.org>2014-08-13 10:48:15 -0700
commit4e99382c96c71e5427a7f1ef011b04f0e560a1f6 (patch)
tree980b96d4133481a5d719d89f3bdc7c9ff56820fb /qt-ui
parent24cb0b0496e8f593f22f3e1cd25b286ad8c7031f (diff)
downloadsubsurface-4e99382c96c71e5427a7f1ef011b04f0e560a1f6.tar.gz
Improve on error reporting in the ConfigureDiveComputer class
This patch improves on the error reporting for the dive computer configuration dialog to use config->lastError. The previous code was using a different argument in each function, which lacked uniformity. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/configuredivecomputerdialog.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp
index 293dd244b..e40522529 100644
--- a/qt-ui/configuredivecomputerdialog.cpp
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -396,11 +396,10 @@ void ConfigureDiveComputerDialog::on_backupButton_clicked()
if (!backupPath.isEmpty()) {
populateDeviceDetails();
getDeviceData();
- QString errorText = "";
- if (!config->saveXMLBackup(backupPath, deviceDetails, &device_data, errorText)) {
+ if (!config->saveXMLBackup(backupPath, deviceDetails, &device_data)) {
QMessageBox::critical(this, tr("XML Backup Error"),
tr("An error occurred while saving the backup file.\n%1")
- .arg(errorText)
+ .arg(config->lastError)
);
} else {
QMessageBox::information(this, tr("Backup succeeded"),
@@ -420,11 +419,10 @@ void ConfigureDiveComputerDialog::on_restoreBackupButton_clicked()
filename, tr("Backup files (*.xml)")
);
if (!restorePath.isEmpty()) {
- QString errorText = "";
- if (!config->restoreXMLBackup(restorePath, deviceDetails, errorText)) {
+ if (!config->restoreXMLBackup(restorePath, deviceDetails)) {
QMessageBox::critical(this, tr("XML Restore Error"),
tr("An error occurred while restoring the backup file.\n%1")
- .arg(errorText)
+ .arg(config->lastError)
);
} else {
reloadValues();
@@ -447,8 +445,7 @@ void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked()
);
if (!firmwarePath.isEmpty()) {
getDeviceData();
- QString errText;
- config->startFirmwareUpdate(firmwarePath, &device_data, errText);
+ config->startFirmwareUpdate(firmwarePath, &device_data);
}
}