UI: In-app Configuration resetting
This commit is contained in:
parent
479b38f035
commit
45cec4e7cf
@ -2,7 +2,7 @@ using Avalonia.Collections;
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using Gommon;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using LibHac.Tools.FsSystem;
|
using LibHac.Tools.FsSystem;
|
||||||
using Ryujinx.Audio.Backends.OpenAL;
|
using Ryujinx.Audio.Backends.OpenAL;
|
||||||
using Ryujinx.Audio.Backends.SDL2;
|
using Ryujinx.Audio.Backends.SDL2;
|
||||||
@ -28,8 +28,6 @@ using System.Collections.Generic;
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TimeZone = Ryujinx.Ava.UI.Models.TimeZone;
|
using TimeZone = Ryujinx.Ava.UI.Models.TimeZone;
|
||||||
|
|
||||||
@ -722,6 +720,25 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
CloseWindow?.Invoke();
|
CloseWindow?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ObservableProperty] private bool _wantsToReset;
|
||||||
|
|
||||||
|
public AsyncRelayCommand ResetButton => Commands.Create(async () =>
|
||||||
|
{
|
||||||
|
if (!WantsToReset) return;
|
||||||
|
|
||||||
|
CloseWindow?.Invoke();
|
||||||
|
ConfigurationState.Instance.LoadDefault();
|
||||||
|
ConfigurationState.Instance.ToFileFormat().SaveConfig(Program.ConfigurationPath);
|
||||||
|
RyujinxApp.MainWindow.LoadApplications();
|
||||||
|
|
||||||
|
await ContentDialogHelper.CreateInfoDialog(
|
||||||
|
$"Your {RyujinxApp.FullAppName} configuration has been reset.",
|
||||||
|
"",
|
||||||
|
string.Empty,
|
||||||
|
LocaleManager.Instance[LocaleKeys.SettingsButtonClose],
|
||||||
|
"Configuration Reset");
|
||||||
|
});
|
||||||
|
|
||||||
public void CancelButton()
|
public void CancelButton()
|
||||||
{
|
{
|
||||||
RevertIfNotSaved();
|
RevertIfNotSaved();
|
||||||
|
@ -108,24 +108,36 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</ui:NavigationView.Styles>
|
</ui:NavigationView.Styles>
|
||||||
</ui:NavigationView>
|
</ui:NavigationView>
|
||||||
<ReversibleStackPanel
|
<Grid Grid.Row="2"
|
||||||
Grid.Row="2"
|
ColumnDefinitions="Auto,*,Auto">
|
||||||
Margin="10"
|
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||||
Spacing="10"
|
<Button
|
||||||
Orientation="Horizontal"
|
IsEnabled="{Binding WantsToReset}"
|
||||||
HorizontalAlignment="Right"
|
Margin="10"
|
||||||
ReverseOrder="{x:Static helper:RunningPlatform.IsMacOS}">
|
Content="Reset Settings"
|
||||||
<Button
|
Command="{Binding ResetButton}" />
|
||||||
Classes="accent"
|
<CheckBox IsChecked="{Binding WantsToReset}"/>
|
||||||
Content="{ext:Locale SettingsButtonOk}"
|
<TextBlock Text="I want to reset my settings."/>
|
||||||
Command="{Binding OkButton}" />
|
</StackPanel>
|
||||||
<Button
|
<ReversibleStackPanel
|
||||||
HotKey="Escape"
|
Grid.Column="2"
|
||||||
Content="{ext:Locale SettingsButtonCancel}"
|
Margin="10"
|
||||||
Command="{Binding CancelButton}" />
|
Spacing="10"
|
||||||
<Button
|
Orientation="Horizontal"
|
||||||
Content="{ext:Locale SettingsButtonApply}"
|
HorizontalAlignment="Right"
|
||||||
Command="{Binding ApplyButton}" />
|
ReverseOrder="{x:Static helper:RunningPlatform.IsMacOS}">
|
||||||
</ReversibleStackPanel>
|
<Button
|
||||||
|
Classes="accent"
|
||||||
|
Content="{ext:Locale SettingsButtonOk}"
|
||||||
|
Command="{Binding OkButton}" />
|
||||||
|
<Button
|
||||||
|
HotKey="Escape"
|
||||||
|
Content="{ext:Locale SettingsButtonCancel}"
|
||||||
|
Command="{Binding CancelButton}" />
|
||||||
|
<Button
|
||||||
|
Content="{ext:Locale SettingsButtonApply}"
|
||||||
|
Command="{Binding ApplyButton}" />
|
||||||
|
</ReversibleStackPanel>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</window:StyleableAppWindow>
|
</window:StyleableAppWindow>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user