mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
6fa670e612
commit
57e7c3f5d0
1 changed files with 14 additions and 7 deletions
|
@ -289,19 +289,26 @@ QString MainWindow::filter()
|
||||||
bool MainWindow::askSaveChanges()
|
bool MainWindow::askSaveChanges()
|
||||||
{
|
{
|
||||||
QString message;
|
QString message;
|
||||||
QMessageBox::StandardButton response;
|
QMessageBox response;
|
||||||
|
|
||||||
if (existing_filename)
|
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
|
else
|
||||||
message = tr("You have unsaved changes\nDo you really want to close the datafile without saving?");
|
message = tr("Do you want to save the changes you made in the datafile?");
|
||||||
|
|
||||||
response = QMessageBox::question(this, tr("Save Changes?"), message,
|
response.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||||
QMessageBox::Save | QMessageBox::Cancel | QMessageBox::Ok, QMessageBox::Save);
|
response.setDefaultButton(QMessageBox::Save);
|
||||||
if (response == 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();
|
file_save();
|
||||||
return true;
|
return true;
|
||||||
} else if (response == QMessageBox::Ok) {
|
case QMessageBox::Discard:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue