show the error string in the GUI rather than stderr

This makes the error string just be an internal "membuffer", which the
GUI can fetch and show when errors occur.  The error string keeps
accumulating until somebody retrieves it with "get_error_string()".

This should make any write errors actually show up to the user.

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 10:35:09 -07:00 committed by Dirk Hohndel
parent b5d0cfd557
commit ec33a95ad0
3 changed files with 33 additions and 9 deletions

View file

@ -899,8 +899,10 @@ int MainWindow::file_save_as(void)
if (ui.InfoWidget->isEditing())
ui.InfoWidget->acceptChanges();
if (save_dives(filename.toUtf8().data()))
if (save_dives(filename.toUtf8().data())) {
showError(get_error_string());
return -1;
}
set_filename(filename.toUtf8().data(), true);
setTitle(MWTF_FILENAME);
@ -927,8 +929,10 @@ int MainWindow::file_save(void)
if (!current_def_dir.exists())
current_def_dir.mkpath(current_def_dir.absolutePath());
}
if (save_dives(existing_filename))
if (save_dives(existing_filename)) {
showError(get_error_string());
return -1;
}
mark_divelist_changed(false);
addRecentFile(QStringList() << QString(existing_filename));
return 0;