Ability to hide file types in Game List (#4555)

* Added HiddenFileTypes to config state, and check to file enumeration

* Added hiddenfiletypes checkboxes to the UI

* Added Ava version of HiddenFileTypes

* Inverted Hide to Show with file types, minor formatting

* all variables with a reference to 'hidden' is now 'shown'

* one more variable name changed

* review feedback

* added FileTypes extension methof to get the correlating config value

* moved extension method to new folder and file in Ryujinx.Ui.Common

* added default case for ToggleFileType

* changed exception type to OutOfRangeException
This commit is contained in:
NitroTears 2023-04-16 11:03:35 +10:00 committed by GitHub
parent 5c89e22bb9
commit c5258cf082
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 321 additions and 5 deletions

View file

@ -119,6 +119,12 @@ namespace Ryujinx.Ui
[GUI] CheckMenuItem _fileExtToggle;
[GUI] CheckMenuItem _pathToggle;
[GUI] CheckMenuItem _fileSizeToggle;
[GUI] CheckMenuItem _nspShown;
[GUI] CheckMenuItem _pfs0Shown;
[GUI] CheckMenuItem _xciShown;
[GUI] CheckMenuItem _ncaShown;
[GUI] CheckMenuItem _nroShown;
[GUI] CheckMenuItem _nsoShown;
[GUI] Label _gpuBackend;
[GUI] Label _dockedMode;
[GUI] Label _aspectRatio;
@ -220,6 +226,20 @@ namespace Ryujinx.Ui
_pauseEmulation.Sensitive = false;
_resumeEmulation.Sensitive = false;
_nspShown.Active = ConfigurationState.Instance.Ui.ShownFileTypes.NSP.Value;
_pfs0Shown.Active = ConfigurationState.Instance.Ui.ShownFileTypes.PFS0.Value;
_xciShown.Active = ConfigurationState.Instance.Ui.ShownFileTypes.XCI.Value;
_ncaShown.Active = ConfigurationState.Instance.Ui.ShownFileTypes.NCA.Value;
_nroShown.Active = ConfigurationState.Instance.Ui.ShownFileTypes.NRO.Value;
_nsoShown.Active = ConfigurationState.Instance.Ui.ShownFileTypes.NSO.Value;
_nspShown.Toggled += NSP_Shown_Toggled;
_pfs0Shown.Toggled += PFS0_Shown_Toggled;
_xciShown.Toggled += XCI_Shown_Toggled;
_ncaShown.Toggled += NCA_Shown_Toggled;
_nroShown.Toggled += NRO_Shown_Toggled;
_nsoShown.Toggled += NSO_Shown_Toggled;
_fileTypesSubMenu.Visible = FileAssociationHelper.IsTypeAssociationSupported;
if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn) _favToggle.Active = true;
@ -1757,6 +1777,54 @@ namespace Ryujinx.Ui
UpdateColumns();
}
private void NSP_Shown_Toggled(object sender, EventArgs args)
{
ConfigurationState.Instance.Ui.ShownFileTypes.NSP.Value = _nspShown.Active;
SaveConfig();
UpdateGameTable();
}
private void PFS0_Shown_Toggled(object sender, EventArgs args)
{
ConfigurationState.Instance.Ui.ShownFileTypes.PFS0.Value = _pfs0Shown.Active;
SaveConfig();
UpdateGameTable();
}
private void XCI_Shown_Toggled (object sender, EventArgs args)
{
ConfigurationState.Instance.Ui.ShownFileTypes.XCI.Value = _xciShown.Active;
SaveConfig();
UpdateGameTable();
}
private void NCA_Shown_Toggled (object sender, EventArgs args)
{
ConfigurationState.Instance.Ui.ShownFileTypes.NCA.Value = _ncaShown.Active;
SaveConfig();
UpdateGameTable();
}
private void NRO_Shown_Toggled (object sender, EventArgs args)
{
ConfigurationState.Instance.Ui.ShownFileTypes.NRO.Value = _nroShown.Active;
SaveConfig();
UpdateGameTable();
}
private void NSO_Shown_Toggled (object sender, EventArgs args)
{
ConfigurationState.Instance.Ui.ShownFileTypes.NSO.Value = _nsoShown.Active;
SaveConfig();
UpdateGameTable();
}
private void RefreshList_Pressed(object sender, ButtonReleaseEventArgs args)
{
UpdateGameTable();

View file

@ -262,6 +262,75 @@
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="ShownFileTypes">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">Select which file types to show</property>
<property name="label" translatable="yes">Show File Types</property>
<property name="use-underline">True</property>
<child type="submenu">
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkCheckMenuItem" id="_nspShown">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">Shows .NSP files in the games list</property>
<property name="label" translatable="yes">.NSP</property>
<property name="use-underline">True</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="_pfs0Shown">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">Shows .PFS0 files in the games list</property>
<property name="label" translatable="yes">.PFS0</property>
<property name="use-underline">True</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="_xciShown">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">Shows .XCI files in the games list</property>
<property name="label" translatable="yes">.XCI</property>
<property name="use-underline">True</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="_ncaShown">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">Shows .NCA files in the games list</property>
<property name="label" translatable="yes">.NCA</property>
<property name="use-underline">True</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="_nroShown">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">Shows .NRO files in the games list</property>
<property name="label" translatable="yes">.NRO</property>
<property name="use-underline">True</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="_nsoShown">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">Shows .NSO files in the games list</property>
<property name="label" translatable="yes">.NSO</property>
<property name="use-underline">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem">
<property name="visible">True</property>