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>
This commit is contained in:
Linus Torvalds 2014-03-14 11:26:07 -07:00 committed by Dirk Hohndel
parent ec33a95ad0
commit 609715ab69
9 changed files with 96 additions and 174 deletions

View file

@ -1414,7 +1414,6 @@ void DivePlannerPointsModel::createTemporaryPlan()
}
char *cache = NULL;
tempDive = NULL;
const char *errorString = NULL;
struct divedatapoint *dp = NULL;
for (int i = 0; i < MAX_CYLINDERS; i++) {
cylinder_t *cyl = &stagingDive->cylinder[i];
@ -1432,7 +1431,7 @@ void DivePlannerPointsModel::createTemporaryPlan()
#if DEBUG_PLAN
dump_plan(&diveplan);
#endif
plan(&diveplan, &cache, &tempDive, isPlanner(), &errorString);
plan(&diveplan, &cache, &tempDive, isPlanner());
if (mode == ADD) {
// copy the samples and events, but don't overwrite the cylinders
copy_samples(tempDive, current_dive);
@ -1468,10 +1467,9 @@ void DivePlannerPointsModel::createPlan()
// to not delete it later. mumble. ;p
char *cache = NULL;
tempDive = NULL;
const char *errorString = NULL;
createTemporaryPlan();
plan(&diveplan, &cache, &tempDive, isPlanner(), &errorString);
plan(&diveplan, &cache, &tempDive, isPlanner());
copy_cylinders(stagingDive, tempDive);
int mean[MAX_CYLINDERS], duration[MAX_CYLINDERS];
per_cylinder_mean_depth(tempDive, select_dc(&tempDive->dc), mean, duration);