settings: add Show Confirm Exist toggle (#1856)
This commit is contained in:
parent
5be6ec6364
commit
1e5b37c94f
8 changed files with 63 additions and 5 deletions
|
@ -14,7 +14,7 @@ namespace Ryujinx.Configuration
|
|||
/// <summary>
|
||||
/// The current version of the file format
|
||||
/// </summary>
|
||||
public const int CurrentVersion = 18;
|
||||
public const int CurrentVersion = 20;
|
||||
|
||||
public int Version { get; set; }
|
||||
|
||||
|
@ -128,6 +128,11 @@ namespace Ryujinx.Configuration
|
|||
/// </summary>
|
||||
public bool CheckUpdatesOnStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Show "Confirm Exit" Dialog
|
||||
/// </summary>
|
||||
public bool ShowConfirmExit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables Vertical Sync
|
||||
/// </summary>
|
||||
|
|
|
@ -360,6 +360,11 @@ namespace Ryujinx.Configuration
|
|||
/// </summary>
|
||||
public ReactiveObject<bool> CheckUpdatesOnStart { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Show "Confirm Exit" Dialog
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> ShowConfirmExit { get; private set; }
|
||||
|
||||
private ConfigurationState()
|
||||
{
|
||||
Ui = new UiSection();
|
||||
|
@ -369,6 +374,7 @@ namespace Ryujinx.Configuration
|
|||
Hid = new HidSection();
|
||||
EnableDiscordIntegration = new ReactiveObject<bool>();
|
||||
CheckUpdatesOnStart = new ReactiveObject<bool>();
|
||||
ShowConfirmExit = new ReactiveObject<bool>();
|
||||
}
|
||||
|
||||
public ConfigurationFileFormat ToFileFormat()
|
||||
|
@ -413,6 +419,7 @@ namespace Ryujinx.Configuration
|
|||
DockedMode = System.EnableDockedMode,
|
||||
EnableDiscordIntegration = EnableDiscordIntegration,
|
||||
CheckUpdatesOnStart = CheckUpdatesOnStart,
|
||||
ShowConfirmExit = ShowConfirmExit,
|
||||
EnableVsync = Graphics.EnableVsync,
|
||||
EnableShaderCache = Graphics.EnableShaderCache,
|
||||
EnablePtc = System.EnablePtc,
|
||||
|
@ -475,6 +482,7 @@ namespace Ryujinx.Configuration
|
|||
System.EnableDockedMode.Value = false;
|
||||
EnableDiscordIntegration.Value = true;
|
||||
CheckUpdatesOnStart.Value = true;
|
||||
ShowConfirmExit.Value = true;
|
||||
Graphics.EnableVsync.Value = true;
|
||||
Graphics.EnableShaderCache.Value = true;
|
||||
System.EnablePtc.Value = true;
|
||||
|
@ -770,6 +778,15 @@ namespace Ryujinx.Configuration
|
|||
configurationFileUpdated = true;
|
||||
}
|
||||
|
||||
if (configurationFileFormat.Version < 20)
|
||||
{
|
||||
Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 20.");
|
||||
|
||||
configurationFileFormat.ShowConfirmExit = true;
|
||||
|
||||
configurationFileUpdated = true;
|
||||
}
|
||||
|
||||
List<InputConfig> inputConfig = new List<InputConfig>();
|
||||
inputConfig.AddRange(configurationFileFormat.ControllerConfig);
|
||||
inputConfig.AddRange(configurationFileFormat.KeyboardConfig);
|
||||
|
@ -796,6 +813,7 @@ namespace Ryujinx.Configuration
|
|||
System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
|
||||
EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration;
|
||||
CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart;
|
||||
ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit;
|
||||
Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync;
|
||||
Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache;
|
||||
System.EnablePtc.Value = configurationFileFormat.EnablePtc;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": 18,
|
||||
"version": 20,
|
||||
"res_scale": 1,
|
||||
"res_scale_custom": 1,
|
||||
"max_anisotropy": -1,
|
||||
|
@ -21,6 +21,7 @@
|
|||
"docked_mode": false,
|
||||
"enable_discord_integration": true,
|
||||
"check_updates_on_start": true,
|
||||
"show_confirm_exit": true,
|
||||
"enable_vsync": true,
|
||||
"enable_shader_cache": true,
|
||||
"enable_ptc": true,
|
||||
|
|
|
@ -154,7 +154,7 @@ namespace Ryujinx.Ui
|
|||
{
|
||||
if (keyboard.IsKeyDown(OpenTK.Input.Key.Escape))
|
||||
{
|
||||
if (GtkDialog.CreateExitDialog())
|
||||
if (!ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog())
|
||||
{
|
||||
Exit();
|
||||
}
|
||||
|
|
|
@ -907,7 +907,7 @@ namespace Ryujinx.Ui
|
|||
|
||||
private void Exit_Pressed(object sender, EventArgs args)
|
||||
{
|
||||
if (!_gameLoaded || GtkDialog.CreateExitDialog())
|
||||
if (!_gameLoaded || !ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog())
|
||||
{
|
||||
End();
|
||||
}
|
||||
|
@ -915,7 +915,7 @@ namespace Ryujinx.Ui
|
|||
|
||||
private void Window_Close(object sender, DeleteEventArgs args)
|
||||
{
|
||||
if (!_gameLoaded || GtkDialog.CreateExitDialog())
|
||||
if (!_gameLoaded || !ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog())
|
||||
{
|
||||
End();
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace Ryujinx.Ui.Windows
|
|||
[GUI] CheckButton _dockedModeToggle;
|
||||
[GUI] CheckButton _discordToggle;
|
||||
[GUI] CheckButton _checkUpdatesToggle;
|
||||
[GUI] CheckButton _showConfirmExitToggle;
|
||||
[GUI] CheckButton _vSyncToggle;
|
||||
[GUI] CheckButton _shaderCacheToggle;
|
||||
[GUI] CheckButton _ptcToggle;
|
||||
|
@ -176,6 +177,11 @@ namespace Ryujinx.Ui.Windows
|
|||
_checkUpdatesToggle.Click();
|
||||
}
|
||||
|
||||
if (ConfigurationState.Instance.ShowConfirmExit)
|
||||
{
|
||||
_showConfirmExitToggle.Click();
|
||||
}
|
||||
|
||||
if (ConfigurationState.Instance.Graphics.EnableVsync)
|
||||
{
|
||||
_vSyncToggle.Click();
|
||||
|
@ -393,6 +399,7 @@ namespace Ryujinx.Ui.Windows
|
|||
ConfigurationState.Instance.System.EnableDockedMode.Value = _dockedModeToggle.Active;
|
||||
ConfigurationState.Instance.EnableDiscordIntegration.Value = _discordToggle.Active;
|
||||
ConfigurationState.Instance.CheckUpdatesOnStart.Value = _checkUpdatesToggle.Active;
|
||||
ConfigurationState.Instance.ShowConfirmExit.Value = _showConfirmExitToggle.Active;
|
||||
ConfigurationState.Instance.Graphics.EnableVsync.Value = _vSyncToggle.Active;
|
||||
ConfigurationState.Instance.Graphics.EnableShaderCache.Value = _shaderCacheToggle.Active;
|
||||
ConfigurationState.Instance.System.EnablePtc.Value = _ptcToggle.Active;
|
||||
|
|
|
@ -137,6 +137,22 @@
|
|||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="_showConfirmExitToggle">
|
||||
<property name="label" translatable="yes">Show "Confirm Exit" Dialog</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
|
|
@ -1199,6 +1199,17 @@
|
|||
false
|
||||
]
|
||||
},
|
||||
"show_confirm_exit": {
|
||||
"$id": "#/properties/show_confirm_exit",
|
||||
"type": "boolean",
|
||||
"title": "Show \"Confirm Exit\" Dialog",
|
||||
"description": "Check to shows the \"Confirm Exit\" dialog when closing Ryujinx.",
|
||||
"default": true,
|
||||
"examples": [
|
||||
true,
|
||||
false
|
||||
]
|
||||
},
|
||||
"enable_vsync": {
|
||||
"$id": "#/properties/enable_vsync",
|
||||
"type": "boolean",
|
||||
|
|
Reference in a new issue