Merge pull request #4930 from vitor-k/pause-on-unfocus

Pause when in background
This commit is contained in:
Weiyi Wang 2019-09-20 14:51:01 -04:00 committed by GitHub
commit 377abfa3e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 0 deletions

View file

@ -388,6 +388,8 @@ void Config::ReadValues() {
UISettings::values.first_start = ReadSetting("firstStart", true).toBool();
UISettings::values.callout_flags = ReadSetting("calloutFlags", 0).toUInt();
UISettings::values.show_console = ReadSetting("showConsole", false).toBool();
UISettings::values.pause_when_in_background =
ReadSetting("pauseWhenInBackground", false).toBool();
qt_config->beginGroup("Multiplayer");
UISettings::values.nickname = ReadSetting("nickname", "").toString();
@ -640,6 +642,7 @@ void Config::SaveValues() {
WriteSetting("firstStart", UISettings::values.first_start, true);
WriteSetting("calloutFlags", UISettings::values.callout_flags, 0);
WriteSetting("showConsole", UISettings::values.show_console, false);
WriteSetting("pauseWhenInBackground", UISettings::values.pause_when_in_background, false);
qt_config->beginGroup("Multiplayer");
WriteSetting("nickname", UISettings::values.nickname, "");

View file

@ -26,6 +26,7 @@ ConfigureGeneral::~ConfigureGeneral() = default;
void ConfigureGeneral::SetConfiguration() {
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background);
ui->toggle_update_check->setChecked(UISettings::values.check_for_update_on_start);
ui->toggle_auto_update->setChecked(UISettings::values.update_on_close);
@ -53,6 +54,7 @@ void ConfigureGeneral::ResetDefaults() {
void ConfigureGeneral::ApplyConfiguration() {
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked();
UISettings::values.check_for_update_on_start = ui->toggle_update_check->isChecked();
UISettings::values.update_on_close = ui->toggle_auto_update->isChecked();

View file

@ -29,6 +29,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toggle_background_pause">
<property name="text">
<string>Pause emulation when in background</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>