diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-03-14 11:26:07 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-03-14 12:36:06 -0700 |
commit | 609715ab698489588b32aa69d98fa2c5b233ef8f (patch) | |
tree | d9bfef1748deea912ce894e22c53f7920a62afec /qt-ui/divelogimportdialog.cpp | |
parent | ec33a95ad04099d428275de2c6b36e7098cc943e (diff) | |
download | subsurface-609715ab698489588b32aa69d98fa2c5b233ef8f.tar.gz |
Convert other users of showError() to the new world order
The "report_error()" interface is a lot simpler, although some of the
C++ code uses QStrings which make them a bit annoying, especially for
the varargs model. Still, even with the explicit conversion to UTF8 and
"char *", the report_error() model is much nicer.
This also just makes refreshDisplay() do the error reporting in the UI
automatically, so a number of error paths don't even have to worry. And
the multi-line model of error reporting means that it all automatically
does the right thing, and reports errors for each file rather than just
for the last file that failed to open.
So this removes closer to a hundred lines of cruft, while being a
simpler interface and doing better error reporting.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelogimportdialog.cpp')
-rw-r--r-- | qt-ui/divelogimportdialog.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp index bff49156f..3de08b003 100644 --- a/qt-ui/divelogimportdialog.cpp +++ b/qt-ui/divelogimportdialog.cpp @@ -54,8 +54,6 @@ DiveLogImportDialog::~DiveLogImportDialog() #define VALUE_IF_CHECKED(x) (ui->x->isEnabled() ? ui->x->value() - 1 : -1) void DiveLogImportDialog::on_buttonBox_accepted() { - char *error = NULL; - if (ui->tabWidget->currentIndex() == 0) { for (int i = 0; i < fileNames.size(); ++i) { parse_csv_file(fileNames[i].toUtf8().data(), ui->CSVTime->value() - 1, @@ -65,13 +63,7 @@ void DiveLogImportDialog::on_buttonBox_accepted() VALUE_IF_CHECKED(CSVstopdepth), ui->CSVSeparator->currentIndex(), specialCSV.contains(ui->knownImports->currentIndex()) ? CSVApps[ui->knownImports->currentIndex()].name.toUtf8().data() : "csv", - ui->CSVUnits->currentIndex(), - &error); - if (error != NULL) { - MainWindow::instance()->showError(error); - free(error); - error = NULL; - } + ui->CSVUnits->currentIndex()); } } else { for (int i = 0; i < fileNames.size(); ++i) { @@ -84,13 +76,7 @@ void DiveLogImportDialog::on_buttonBox_accepted() VALUE_IF_CHECKED(Gps), VALUE_IF_CHECKED(MaxDepth), VALUE_IF_CHECKED(MeanDepth), VALUE_IF_CHECKED(Buddy), VALUE_IF_CHECKED(Notes), VALUE_IF_CHECKED(Weight), - VALUE_IF_CHECKED(Tags), - &error); - if (error != NULL) { - MainWindow::instance()->showError(error); - free(error); - error = NULL; - } + VALUE_IF_CHECKED(Tags)); } } process_dives(true, false); |