mirror of
https://github.com/citra-emu/citra-nightly.git
synced 2024-12-23 13:15:34 +00:00
Add option to enable pause when on background
This commit is contained in:
parent
7224ec57f6
commit
356fd60520
|
@ -384,6 +384,7 @@ void Config::ReadValues() {
|
||||||
UISettings::values.first_start = ReadSetting("firstStart", true).toBool();
|
UISettings::values.first_start = ReadSetting("firstStart", true).toBool();
|
||||||
UISettings::values.callout_flags = ReadSetting("calloutFlags", 0).toUInt();
|
UISettings::values.callout_flags = ReadSetting("calloutFlags", 0).toUInt();
|
||||||
UISettings::values.show_console = ReadSetting("showConsole", false).toBool();
|
UISettings::values.show_console = ReadSetting("showConsole", false).toBool();
|
||||||
|
UISettings::values.pause_when_on_background = ReadSetting("pauseWhenOnBackground", false).toBool();
|
||||||
|
|
||||||
qt_config->beginGroup("Multiplayer");
|
qt_config->beginGroup("Multiplayer");
|
||||||
UISettings::values.nickname = ReadSetting("nickname", "").toString();
|
UISettings::values.nickname = ReadSetting("nickname", "").toString();
|
||||||
|
@ -636,6 +637,7 @@ void Config::SaveValues() {
|
||||||
WriteSetting("firstStart", UISettings::values.first_start, true);
|
WriteSetting("firstStart", UISettings::values.first_start, true);
|
||||||
WriteSetting("calloutFlags", UISettings::values.callout_flags, 0);
|
WriteSetting("calloutFlags", UISettings::values.callout_flags, 0);
|
||||||
WriteSetting("showConsole", UISettings::values.show_console, false);
|
WriteSetting("showConsole", UISettings::values.show_console, false);
|
||||||
|
WriteSetting("pauseWhenOnBackground", UISettings::values.pause_when_on_background, false);
|
||||||
|
|
||||||
qt_config->beginGroup("Multiplayer");
|
qt_config->beginGroup("Multiplayer");
|
||||||
WriteSetting("nickname", UISettings::values.nickname, "");
|
WriteSetting("nickname", UISettings::values.nickname, "");
|
||||||
|
|
|
@ -26,6 +26,7 @@ ConfigureGeneral::~ConfigureGeneral() = default;
|
||||||
|
|
||||||
void ConfigureGeneral::SetConfiguration() {
|
void ConfigureGeneral::SetConfiguration() {
|
||||||
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
|
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
|
||||||
|
ui->toggle_background_pause->setChecked(UISettings::values.pause_when_on_background);
|
||||||
|
|
||||||
ui->toggle_update_check->setChecked(UISettings::values.check_for_update_on_start);
|
ui->toggle_update_check->setChecked(UISettings::values.check_for_update_on_start);
|
||||||
ui->toggle_auto_update->setChecked(UISettings::values.update_on_close);
|
ui->toggle_auto_update->setChecked(UISettings::values.update_on_close);
|
||||||
|
@ -53,6 +54,7 @@ void ConfigureGeneral::ResetDefaults() {
|
||||||
|
|
||||||
void ConfigureGeneral::ApplyConfiguration() {
|
void ConfigureGeneral::ApplyConfiguration() {
|
||||||
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
|
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
|
||||||
|
UISettings::values.pause_when_on_background = ui->toggle_background_pause->isChecked();
|
||||||
|
|
||||||
UISettings::values.check_for_update_on_start = ui->toggle_update_check->isChecked();
|
UISettings::values.check_for_update_on_start = ui->toggle_update_check->isChecked();
|
||||||
UISettings::values.update_on_close = ui->toggle_auto_update->isChecked();
|
UISettings::values.update_on_close = ui->toggle_auto_update->isChecked();
|
||||||
|
|
|
@ -29,6 +29,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="toggle_background_pause">
|
||||||
|
<property name="text">
|
||||||
|
<string>Pause emulation when on background</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -500,15 +500,17 @@ void GMainWindow::RestoreUIState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnLoseFocus(Qt::ApplicationState state) {
|
void GMainWindow::OnLoseFocus(Qt::ApplicationState state) {
|
||||||
if (ui.action_Pause->isEnabled() &&
|
if (UISettings::values.pause_when_on_background) {
|
||||||
(state == Qt::ApplicationSuspended ||
|
if (ui.action_Pause->isEnabled() &&
|
||||||
state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
|
(state == Qt::ApplicationSuspended ||
|
||||||
auto_paused = true;
|
state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
|
||||||
OnPauseGame();
|
auto_paused = true;
|
||||||
}
|
OnPauseGame();
|
||||||
if (ui.action_Start->isEnabled() && auto_paused && state == Qt::ApplicationActive) {
|
}
|
||||||
auto_paused = false;
|
if (ui.action_Start->isEnabled() && auto_paused && state == Qt::ApplicationActive) {
|
||||||
OnStartGame();
|
auto_paused = false;
|
||||||
|
OnStartGame();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ struct Values {
|
||||||
|
|
||||||
bool confirm_before_closing;
|
bool confirm_before_closing;
|
||||||
bool first_start;
|
bool first_start;
|
||||||
|
bool pause_when_on_background;
|
||||||
|
|
||||||
bool updater_found;
|
bool updater_found;
|
||||||
bool update_on_close;
|
bool update_on_close;
|
||||||
|
|
Loading…
Reference in a new issue