mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-27 16:47:11 +02:00
UI: Add keybinds to useful things
This commit is contained in:
parent
59b3ff7802
commit
741eba2798
13 changed files with 88 additions and 70 deletions
|
@ -45,16 +45,23 @@
|
|||
<CheckBox Margin="10" Grid.Column="0" VerticalContentAlignment="Center"
|
||||
IsChecked="{Binding ShowAllAmiibo}"
|
||||
Content="{locale:Locale AmiiboOptionsShowAllLabel}" />
|
||||
<CheckBox Margin="10" VerticalContentAlignment="Center" Grid.Column="1" IsChecked="{Binding UseRandomUuid}"
|
||||
<CheckBox HotKey="H"
|
||||
Margin="10" VerticalContentAlignment="Center" Grid.Column="1"
|
||||
IsChecked="{Binding UseRandomUuid}"
|
||||
Content="{locale:Locale AmiiboOptionsUsRandomTagLabel}" />
|
||||
|
||||
<Button Grid.Column="3" IsEnabled="{Binding EnableScanning}" Width="80"
|
||||
Content="{locale:Locale AmiiboScanButtonLabel}" Name="ScanButton"
|
||||
<Button Grid.Column="3"
|
||||
IsEnabled="{Binding EnableScanning}"
|
||||
Width="80"
|
||||
Name="ScanButton"
|
||||
HotKey="Return"
|
||||
Content="{locale:Locale AmiiboScanButtonLabel}"
|
||||
Click="ScanButton_Click" />
|
||||
<Button Grid.Column="4"
|
||||
Margin="10,0"
|
||||
Width="80"
|
||||
Name="CancelButton"
|
||||
HotKey="Escape"
|
||||
Content="{locale:Locale InputDialogCancel}"
|
||||
Click="CancelButton_Click" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
|
|
@ -9,13 +9,11 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
{
|
||||
public AmiiboWindow(bool showAll, string lastScannedAmiiboId, string titleId)
|
||||
{
|
||||
ViewModel = new AmiiboWindowViewModel(this, lastScannedAmiiboId, titleId)
|
||||
DataContext = ViewModel = new AmiiboWindowViewModel(this, lastScannedAmiiboId, titleId)
|
||||
{
|
||||
ShowAllAmiibo = showAll,
|
||||
};
|
||||
|
||||
DataContext = ViewModel;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
Title = App.FormatTitle(LocaleKeys.Amiibo);
|
||||
|
@ -23,9 +21,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
|
||||
public AmiiboWindow()
|
||||
{
|
||||
ViewModel = new AmiiboWindowViewModel(this, string.Empty, string.Empty);
|
||||
|
||||
DataContext = ViewModel;
|
||||
DataContext = ViewModel = new AmiiboWindowViewModel(this, string.Empty, string.Empty);
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
|
@ -37,23 +33,10 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
|
||||
public bool IsScanned { get; set; }
|
||||
public AmiiboApi ScannedAmiibo { get; set; }
|
||||
public AmiiboWindowViewModel ViewModel { get; set; }
|
||||
public AmiiboWindowViewModel ViewModel;
|
||||
|
||||
private void ScanButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (ViewModel.AmiiboSelectedIndex > -1)
|
||||
{
|
||||
ScannedAmiibo = ViewModel.AmiiboList[ViewModel.AmiiboSelectedIndex];
|
||||
IsScanned = true;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
private void ScanButton_Click(object sender, RoutedEventArgs e) => ViewModel.Scan();
|
||||
|
||||
private void CancelButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IsScanned = false;
|
||||
|
||||
Close();
|
||||
}
|
||||
private void CancelButton_Click(object sender, RoutedEventArgs e) => ViewModel.Cancel();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<window:StyleableAppWindow
|
||||
<window:StyleableAppWindow
|
||||
x:Class="Ryujinx.Ava.UI.Windows.CheatWindow"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
|
@ -98,6 +98,7 @@
|
|||
Name="SaveButton"
|
||||
MinWidth="90"
|
||||
Margin="5"
|
||||
HotKey="Ctrl+S"
|
||||
Command="{Binding Save}"
|
||||
IsVisible="{Binding !NoCheatsFound}">
|
||||
<TextBlock Text="{locale:Locale SettingsButtonSave}" />
|
||||
|
@ -106,6 +107,7 @@
|
|||
Name="CancelButton"
|
||||
MinWidth="90"
|
||||
Margin="5"
|
||||
HotKey="Escape"
|
||||
Command="{Binding Close}">
|
||||
<TextBlock Text="{locale:Locale InputDialogCancel}" />
|
||||
</Button>
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
<KeyBinding Gesture="Ctrl+Cmd+F" Command="{Binding ToggleFullscreen}" />
|
||||
<KeyBinding Gesture="F9" Command="{Binding ToggleDockMode}" />
|
||||
<KeyBinding Gesture="Escape" Command="{Binding ExitCurrentState}" />
|
||||
<KeyBinding Gesture="Ctrl+A" Command="{Binding OpenAmiiboWindow}" />
|
||||
</Window.KeyBindings>
|
||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RowDefinitions="*">
|
||||
<helpers:OffscreenTextBox IsEnabled="False" Opacity="0" Name="HiddenTextBox" IsHitTestVisible="False" IsTabStop="False" />
|
||||
|
|
|
@ -37,8 +37,6 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
{
|
||||
public partial class MainWindow : StyleableAppWindow
|
||||
{
|
||||
internal static MainWindowViewModel MainWindowViewModel { get; private set; }
|
||||
|
||||
public MainWindowViewModel ViewModel { get; }
|
||||
|
||||
internal readonly AvaHostUIHandler UiHandler;
|
||||
|
@ -69,9 +67,20 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
public readonly double StatusBarHeight;
|
||||
public readonly double MenuBarHeight;
|
||||
|
||||
// The special window decoration from AppWindow in FluentAvalonia is only present on Windows;
|
||||
// and as such optimizing for the fact that the menu bar and the title bar are the same is only needed on Windows.
|
||||
// Maximized is considered superior to FullScreen on Windows in this case because you get the benefits of being in full screen,
|
||||
// while still being able to use the standard 3 window controls in the top right to minimize, make the window smaller, or close the app.
|
||||
|
||||
public static readonly WindowState FullScreenWindowState =
|
||||
OperatingSystem.IsWindows() ? WindowState.Maximized : WindowState.FullScreen;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
DataContext = ViewModel = MainWindowViewModel = new MainWindowViewModel();
|
||||
DataContext = ViewModel = new MainWindowViewModel
|
||||
{
|
||||
Window = this
|
||||
};
|
||||
|
||||
InitializeComponent();
|
||||
Load();
|
||||
|
@ -184,7 +193,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
ViewModel.ShowContent = true;
|
||||
ViewModel.IsLoadingIndeterminate = false;
|
||||
|
||||
if (startFullscreen && ViewModel.WindowState != WindowState.FullScreen)
|
||||
if (startFullscreen && ViewModel.WindowState != MainWindow.FullScreenWindowState)
|
||||
{
|
||||
ViewModel.ToggleFullscreen();
|
||||
}
|
||||
|
@ -196,7 +205,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
ViewModel.ShowLoadProgress = true;
|
||||
ViewModel.IsLoadingIndeterminate = true;
|
||||
|
||||
if (startFullscreen && ViewModel.WindowState != WindowState.FullScreen)
|
||||
if (startFullscreen && ViewModel.WindowState != MainWindow.FullScreenWindowState)
|
||||
{
|
||||
ViewModel.ToggleFullscreen();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
{
|
||||
public partial class ModManagerWindow : UserControl
|
||||
{
|
||||
public ModManagerViewModel ViewModel;
|
||||
public readonly ModManagerViewModel ViewModel;
|
||||
|
||||
public ModManagerWindow()
|
||||
{
|
||||
|
|
|
@ -10,14 +10,13 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
{
|
||||
public partial class SettingsWindow : StyleableAppWindow
|
||||
{
|
||||
internal SettingsViewModel ViewModel { get; set; }
|
||||
internal readonly SettingsViewModel ViewModel;
|
||||
|
||||
public SettingsWindow(VirtualFileSystem virtualFileSystem, ContentManager contentManager)
|
||||
{
|
||||
Title = App.FormatTitle(LocaleKeys.Settings);
|
||||
|
||||
ViewModel = new SettingsViewModel(virtualFileSystem, contentManager);
|
||||
DataContext = ViewModel;
|
||||
DataContext = ViewModel = new SettingsViewModel(virtualFileSystem, contentManager);
|
||||
|
||||
ViewModel.CloseWindow += Close;
|
||||
ViewModel.SaveSettingsEvent += SaveSettings;
|
||||
|
@ -28,8 +27,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
|
||||
public SettingsWindow()
|
||||
{
|
||||
ViewModel = new SettingsViewModel();
|
||||
DataContext = ViewModel;
|
||||
DataContext = ViewModel = new SettingsViewModel();
|
||||
|
||||
InitializeComponent();
|
||||
Load();
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using FluentAvalonia.UI.Windowing;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.UI.Common.Configuration;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Windows
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue