Lock-file dialog: allow quit-ing, make translated
Add translation macros for the text of the lock-file warning dialog, and update the default text after some discussion on the devel list. Also allow quiting the app, as an alternative option.
This commit is contained in:
parent
fe56b8272b
commit
6b41eb69eb
3 changed files with 27 additions and 7 deletions
|
@ -500,23 +500,40 @@ bool runInAppLauncherDialog()
|
|||
return true;
|
||||
}
|
||||
|
||||
static const char* static_lockFileDialog_Title =
|
||||
QT_TRANSLATE_NOOP("LockFileDialog", "Multiple copies of FlightGear running");
|
||||
static const char* static_lockFileDialog_Text =
|
||||
QT_TRANSLATE_NOOP("LockFileDialog",
|
||||
"FlightGear has detected another copy is already running. "
|
||||
"This copy will run in read-only mode, so downloads will not be possible, "
|
||||
"and settings will not be saved.");
|
||||
static const char* static_lockFileDialog_Info =
|
||||
QT_TRANSLATE_NOOP("LockFileDialog",
|
||||
"If you are sure another copy is not running on this computer, "
|
||||
"you can choose to reset the lock file, and run this copy as normal. "
|
||||
"Alternatively, you can close this copy of the software.");
|
||||
|
||||
LockFileDialogResult showLockFileDialog()
|
||||
{
|
||||
QString title = qApp->translate("LockFileDialog", static_lockFileDialog_Title);
|
||||
QString text = qApp->translate("LockFileDialog", static_lockFileDialog_Text);
|
||||
QString infoText = qApp->translate("LockFileDialog", static_lockFileDialog_Info);
|
||||
|
||||
QMessageBox mb;
|
||||
mb.setIconPixmap(QPixmap(":/app-icon-large"));
|
||||
mb.setWindowTitle("Multiple copies of Flightgear running");
|
||||
mb.setText("Flightgear has detected another copy is already running. "
|
||||
"This copy will run in read-only mode, so downloads will not be possible, "
|
||||
"and settings will not be saved.");
|
||||
mb.setInformativeText("If you are sure another copy is not running on this computer, "
|
||||
"you can choose to reset the lock file to prevent seeing this message again.");
|
||||
mb.setWindowTitle(title);
|
||||
mb.setText(text);
|
||||
mb.setInformativeText(infoText);
|
||||
mb.addButton(QMessageBox::Ok);
|
||||
mb.setDefaultButton(QMessageBox::Ok);
|
||||
mb.addButton(QMessageBox::Reset);
|
||||
mb.addButton(QMessageBox::Close);
|
||||
|
||||
int r = mb.exec();
|
||||
if (r == QMessageBox::Reset)
|
||||
return LockFileReset;
|
||||
if (r == QMessageBox::Close)
|
||||
return LockFileQuit;
|
||||
return LockFileContinue;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@ namespace flightgear
|
|||
enum LockFileDialogResult
|
||||
{
|
||||
LockFileContinue,
|
||||
LockFileReset
|
||||
LockFileReset,
|
||||
LockFileQuit
|
||||
};
|
||||
|
||||
LockFileDialogResult showLockFileDialog();
|
||||
|
|
|
@ -554,6 +554,8 @@ int fgMainInit( int argc, char **argv )
|
|||
SG_LOG( SG_GENERAL, SG_ALERT, "Deleting lock file at user request");
|
||||
fgDeleteLockFile();
|
||||
fgSetBool("/sim/fghome-readonly", false);
|
||||
} else if (r == flightgear::LockFileQuit) {
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue