diff options
author | Henrik Brautaset Aronsen <subsurface@henrik.synth.no> | 2013-05-24 09:28:48 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-24 06:16:10 -0700 |
commit | 57e7c3f5d0605a88e479b74a36101d01561b13b6 (patch) | |
tree | dfadae588de873305e9b7650775ebf1cf2c1bd3b /qt-ui/mainwindow.cpp | |
parent | 6fa670e612a31f698f56d1bbb98959342894a188 (diff) | |
download | subsurface-57e7c3f5d0605a88e479b74a36101d01561b13b6.tar.gz |
Improve wording in askSaveChanges()
Don't Save/Cancel/Save is less ambiguous than OK/Cancel/Save. Also
being slightly more verbose when creating the QMessageBox.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r-- | qt-ui/mainwindow.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index cff62db48..53138f5a1 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -289,19 +289,26 @@ QString MainWindow::filter() bool MainWindow::askSaveChanges() { QString message; - QMessageBox::StandardButton response; + QMessageBox response; if (existing_filename) - message = tr("You have unsaved changes to file: %1\nDo you really want to close the file without saving?").arg(existing_filename); + message = tr("Do you want to save the changes you made in the file %1?").arg(existing_filename); else - message = tr("You have unsaved changes\nDo you really want to close the datafile without saving?"); - - response = QMessageBox::question(this, tr("Save Changes?"), message, - QMessageBox::Save | QMessageBox::Cancel | QMessageBox::Ok, QMessageBox::Save); - if (response == QMessageBox::Save) { + message = tr("Do you want to save the changes you made in the datafile?"); + + response.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); + response.setDefaultButton(QMessageBox::Save); + response.setText(message); + response.setWindowTitle(tr("Save Changes?")); // Not displayed on MacOSX as described in Qt API + response.setInformativeText(tr("Changes will be lost if you don't save them.")); + response.setIcon(QMessageBox::Warning); + int ret = response.exec(); + + switch (ret) { + case QMessageBox::Save: file_save(); return true; - } else if (response == QMessageBox::Ok) { + case QMessageBox::Discard: return true; } return false; |