From 8a610aafd7a8e65a0c30f769180ff09470759889 Mon Sep 17 00:00:00 2001 From: Luke44565 Date: Wed, 13 Mar 2024 13:43:29 -0400 Subject: [PATCH] Disable back button when not in a folder, hide filesize/time played info for folders --- src/Ryujinx.UI.Common/App/ApplicationData.cs | 2 ++ src/Ryujinx/UI/Controls/ApplicationListView.axaml | 1 + src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs | 14 ++++++++++++++ src/Ryujinx/UI/Views/Main/MainViewControls.axaml | 3 ++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Ryujinx.UI.Common/App/ApplicationData.cs b/src/Ryujinx.UI.Common/App/ApplicationData.cs index 8cc7238e9..517a0c857 100644 --- a/src/Ryujinx.UI.Common/App/ApplicationData.cs +++ b/src/Ryujinx.UI.Common/App/ApplicationData.cs @@ -36,6 +36,8 @@ namespace Ryujinx.UI.App.Common public string FileSizeString => ValueFormatUtils.FormatFileSize(FileSize); + public bool IsGame => FileExtension != "Folder"; + public static string GetApplicationBuildId(VirtualFileSystem virtualFileSystem, string titleFilePath) { using FileStream file = new(titleFilePath, FileMode.Open, FileAccess.Read); diff --git a/src/Ryujinx/UI/Controls/ApplicationListView.axaml b/src/Ryujinx/UI/Controls/ApplicationListView.axaml index fecf08883..61e797736 100644 --- a/src/Ryujinx/UI/Controls/ApplicationListView.axaml +++ b/src/Ryujinx/UI/Controls/ApplicationListView.axaml @@ -123,6 +123,7 @@ HorizontalAlignment="Right" VerticalAlignment="Top" Orientation="Vertical" + IsVisible="{Binding IsGame}" Spacing="5"> _appsObservableList; private string _showUiKey = "F4"; @@ -670,6 +671,16 @@ namespace Ryujinx.Ava.UI.ViewModels public bool IsGrid => Glyph == Glyph.Grid; public bool IsList => Glyph == Glyph.List; + public bool IsInFolder + { + get => _isInFolder; + set + { + _isInFolder = value; + + OnPropertyChanged(); + } + } internal void Sort(bool isAscending) { @@ -1286,6 +1297,8 @@ namespace Ryujinx.Ava.UI.ViewModels public void OpenFolder(string path) { _pathHistory.Enqueue(path); + IsInFolder = _pathHistory.Count != 0; + Applications.Clear(); List SearchPaths = new List(); SearchPaths.Add(path); @@ -1309,6 +1322,7 @@ namespace Ryujinx.Ava.UI.ViewModels ApplicationLibrary.LoadApplications(SearchPaths, ConfigurationState.Instance.System.Language); } } + IsInFolder = _pathHistory.Count != 0; } public void SetListMode() diff --git a/src/Ryujinx/UI/Views/Main/MainViewControls.axaml b/src/Ryujinx/UI/Views/Main/MainViewControls.axaml index b49aaacc2..cbd89de0e 100644 --- a/src/Ryujinx/UI/Views/Main/MainViewControls.axaml +++ b/src/Ryujinx/UI/Views/Main/MainViewControls.axaml @@ -23,7 +23,8 @@ MinWidth="80" Margin="5,2,0,2" VerticalAlignment="Stretch" - Command="{Binding NavigateBack}"> + Command="{Binding NavigateBack}" + IsEnabled="{Binding IsInFolder}">