Add option to show the title bar

This commit is contained in:
Luke Warner 2024-10-28 19:24:16 -04:00
parent 1c3347c95a
commit a0d84915ec
8 changed files with 35 additions and 3 deletions

View File

@ -16,7 +16,7 @@ namespace Ryujinx.UI.Common.Configuration
/// <summary>
/// The current version of the file format
/// </summary>
public const int CurrentVersion = 55;
public const int CurrentVersion = 56;
/// <summary>
/// Version of the configuration file format
@ -173,6 +173,11 @@ namespace Ryujinx.UI.Common.Configuration
/// </summary>
public bool RememberWindowState { get; set; }
/// <summary>
/// Enables or disables the redesigned title bar
/// </summary>
public bool ShowTitleBar { get; set; }
/// <summary>
/// Enables hardware-accelerated rendering for Avalonia
/// </summary>

View File

@ -652,6 +652,11 @@ namespace Ryujinx.UI.Common.Configuration
/// </summary>
public ReactiveObject<bool> RememberWindowState { get; private set; }
/// <summary>
/// Enables or disables the redesigned title bar
/// </summary>
public ReactiveObject<bool> ShowTitleBar { get; private set; }
/// <summary>
/// Enables hardware-accelerated rendering for Avalonia
/// </summary>
@ -675,6 +680,7 @@ namespace Ryujinx.UI.Common.Configuration
ShowConfirmExit = new ReactiveObject<bool>();
IgnoreApplet = new ReactiveObject<bool>();
RememberWindowState = new ReactiveObject<bool>();
ShowTitleBar = new ReactiveObject<bool>();
EnableHardwareAcceleration = new ReactiveObject<bool>();
HideCursor = new ReactiveObject<HideCursorMode>();
}
@ -714,6 +720,7 @@ namespace Ryujinx.UI.Common.Configuration
ShowConfirmExit = ShowConfirmExit,
IgnoreApplet = IgnoreApplet,
RememberWindowState = RememberWindowState,
ShowTitleBar = ShowTitleBar,
EnableHardwareAcceleration = EnableHardwareAcceleration,
HideCursor = HideCursor,
EnableVsync = Graphics.EnableVsync,
@ -826,6 +833,7 @@ namespace Ryujinx.UI.Common.Configuration
ShowConfirmExit.Value = true;
IgnoreApplet.Value = false;
RememberWindowState.Value = true;
ShowTitleBar.Value = false;
EnableHardwareAcceleration.Value = true;
HideCursor.Value = HideCursorMode.OnIdle;
Graphics.EnableVsync.Value = true;
@ -1540,6 +1548,15 @@ namespace Ryujinx.UI.Common.Configuration
configurationFileUpdated = true;
}
if (configurationFileFormat.Version < 56)
{
Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 56.");
configurationFileFormat.ShowTitleBar = false;
configurationFileUpdated = true;
}
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
Graphics.ResScale.Value = configurationFileFormat.ResScale;
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
@ -1572,6 +1589,7 @@ namespace Ryujinx.UI.Common.Configuration
ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit;
IgnoreApplet.Value = configurationFileFormat.IgnoreApplet;
RememberWindowState.Value = configurationFileFormat.RememberWindowState;
ShowTitleBar.Value = configurationFileFormat.ShowTitleBar;
EnableHardwareAcceleration.Value = configurationFileFormat.EnableHardwareAcceleration;
HideCursor.Value = configurationFileFormat.HideCursor;
Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync;

View File

@ -100,6 +100,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "Check for Updates on Launch",
"SettingsTabGeneralShowConfirmExitDialog": "Show \"Confirm Exit\" Dialog",
"SettingsTabGeneralRememberWindowState": "Remember Window Size/Position",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "Hide Cursor:",
"SettingsTabGeneralHideCursorNever": "Never",
"SettingsTabGeneralHideCursorOnIdle": "On Idle",

View File

@ -146,6 +146,7 @@ namespace Ryujinx.Ava.UI.ViewModels
public bool ShowConfirmExit { get; set; }
public bool IgnoreApplet { get; set; }
public bool RememberWindowState { get; set; }
public bool ShowTitleBar { get; set; }
public int HideCursor { get; set; }
public bool EnableDockedMode { get; set; }
public bool EnableKeyboard { get; set; }
@ -410,6 +411,7 @@ namespace Ryujinx.Ava.UI.ViewModels
ShowConfirmExit = config.ShowConfirmExit;
IgnoreApplet = config.IgnoreApplet;
RememberWindowState = config.RememberWindowState;
ShowTitleBar = config.ShowTitleBar;
HideCursor = (int)config.HideCursor.Value;
GameDirectories.Clear();
@ -507,6 +509,7 @@ namespace Ryujinx.Ava.UI.ViewModels
config.ShowConfirmExit.Value = ShowConfirmExit;
config.IgnoreApplet.Value = IgnoreApplet;
config.RememberWindowState.Value = RememberWindowState;
config.ShowTitleBar.Value = ShowTitleBar;
config.HideCursor.Value = (HideCursorMode)HideCursor;
if (_gameDirectoryChanged)

View File

@ -13,7 +13,7 @@
<viewModels:MainWindowViewModel />
</Design.DataContext>
<DockPanel HorizontalAlignment="Stretch">
<Border Padding="7, 0, 0, 0" VerticalAlignment="Center" HorizontalAlignment="Center">
<Border Name="RyuLogo" Padding="7, 0, 0, 0" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image
ToolTip.Tip="{Binding Title}"
Height="25"

View File

@ -32,6 +32,8 @@ namespace Ryujinx.Ava.UI.Views.Main
{
InitializeComponent();
RyuLogo.IsVisible = (ConfigurationState.Instance.ShowTitleBar) ? false : true;
ToggleFileTypesMenuItem.ItemsSource = GenerateToggleFileTypeItems();
ChangeLanguageMenuItem.ItemsSource = GenerateLanguageMenuItems();
}

View File

@ -39,6 +39,9 @@
<CheckBox IsChecked="{Binding RememberWindowState}">
<TextBlock Text="{locale:Locale SettingsTabGeneralRememberWindowState}" />
</CheckBox>
<CheckBox IsChecked="{Binding ShowTitleBar}">
<TextBlock Text="{locale:Locale SettingsTabGeneralShowTitleBar}" />
</CheckBox>
<StackPanel Margin="0, 15, 0, 0" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center"
Text="{locale:Locale SettingsTabGeneralHideCursor}"

View File

@ -82,7 +82,7 @@ namespace Ryujinx.Ava.UI.Windows
ViewModel.Title = App.FormatTitle();
TitleBar.ExtendsContentIntoTitleBar = true;
TitleBar.ExtendsContentIntoTitleBar = (ConfigurationState.Instance.ShowTitleBar) ? false : true;
TitleBar.TitleBarHitTestType = TitleBarHitTestType.Complex;
// NOTE: Height of MenuBar and StatusBar is not usable here, since it would still be 0 at this point.