Add option to enable pause when on background
This commit is contained in:
parent
7224ec57f6
commit
356fd60520
5 changed files with 23 additions and 9 deletions
|
@ -500,15 +500,17 @@ void GMainWindow::RestoreUIState() {
|
|||
}
|
||||
|
||||
void GMainWindow::OnLoseFocus(Qt::ApplicationState state) {
|
||||
if (ui.action_Pause->isEnabled() &&
|
||||
(state == Qt::ApplicationSuspended ||
|
||||
state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
|
||||
auto_paused = true;
|
||||
OnPauseGame();
|
||||
}
|
||||
if (ui.action_Start->isEnabled() && auto_paused && state == Qt::ApplicationActive) {
|
||||
auto_paused = false;
|
||||
OnStartGame();
|
||||
if (UISettings::values.pause_when_on_background) {
|
||||
if (ui.action_Pause->isEnabled() &&
|
||||
(state == Qt::ApplicationSuspended ||
|
||||
state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
|
||||
auto_paused = true;
|
||||
OnPauseGame();
|
||||
}
|
||||
if (ui.action_Start->isEnabled() && auto_paused && state == Qt::ApplicationActive) {
|
||||
auto_paused = false;
|
||||
OnStartGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue