include exclude to directory

This commit is contained in:
avikpl1911 2024-02-07 15:40:13 +05:30
parent 25123232bd
commit 1df084a635
5 changed files with 3497 additions and 2 deletions

View file

@ -1,3 +1,4 @@
using Ryujinx.Common;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Configuration.Hid;
using Ryujinx.Common.Configuration.Multiplayer;
@ -252,6 +253,12 @@ namespace Ryujinx.Ui.Common.Configuration
/// </summary>
public List<string> GameDirs { get; set; }
/// <summary>
/// A list of directories to be hidden in the games List
/// </summary>
///
public List<string> ExcludeGameDirs { get; set; }
/// <summary>
/// A list of file types to be hidden in the games List
/// </summary>

View file

@ -121,6 +121,11 @@ namespace Ryujinx.Ui.Common.Configuration
/// </summary>
public ReactiveObject<List<string>> GameDirs { get; private set; }
/// <summary>
/// A list of directories containing games to be excluded until included to load games into the games list
/// </summary>
public ReactiveObject<List<string>> ExcludeGameDirs { get; private set; }
/// <summary>
/// A list of file types to be hidden in the games List
/// </summary>
@ -191,6 +196,8 @@ namespace Ryujinx.Ui.Common.Configuration
GuiColumns = new Columns();
ColumnSort = new ColumnSortSettings();
GameDirs = new ReactiveObject<List<string>>();
ExcludeGameDirs = new ReactiveObject<List<string>>();
ShownFileTypes = new ShownFileTypeSettings();
WindowStartup = new WindowStartupSettings();
EnableCustomTheme = new ReactiveObject<bool>();
@ -713,6 +720,7 @@ namespace Ryujinx.Ui.Common.Configuration
SortAscending = Ui.ColumnSort.SortAscending,
},
GameDirs = Ui.GameDirs,
ExcludeGameDirs = Ui.ExcludeGameDirs,
ShownFileTypes = new ShownFileTypes
{
NSP = Ui.ShownFileTypes.NSP,
@ -819,6 +827,7 @@ namespace Ryujinx.Ui.Common.Configuration
Ui.ColumnSort.SortColumnId.Value = 0;
Ui.ColumnSort.SortAscending.Value = false;
Ui.GameDirs.Value = new List<string>();
Ui.ExcludeGameDirs.Value = new List<string>();
Ui.ShownFileTypes.NSP.Value = true;
Ui.ShownFileTypes.PFS0.Value = true;
Ui.ShownFileTypes.XCI.Value = true;
@ -1489,6 +1498,7 @@ namespace Ryujinx.Ui.Common.Configuration
Ui.ColumnSort.SortColumnId.Value = configurationFileFormat.ColumnSort.SortColumnId;
Ui.ColumnSort.SortAscending.Value = configurationFileFormat.ColumnSort.SortAscending;
Ui.GameDirs.Value = configurationFileFormat.GameDirs;
Ui.ExcludeGameDirs.Value = configurationFileFormat.ExcludeGameDirs;
Ui.ShownFileTypes.NSP.Value = configurationFileFormat.ShownFileTypes.NSP;
Ui.ShownFileTypes.PFS0.Value = configurationFileFormat.ShownFileTypes.PFS0;
Ui.ShownFileTypes.XCI.Value = configurationFileFormat.ShownFileTypes.XCI;

File diff suppressed because it is too large Load diff

View file

@ -29,6 +29,7 @@ namespace Ryujinx.Ui.Windows
{
private readonly MainWindow _parent;
private readonly ListStore _gameDirsBoxStore;
private readonly ListStore _gameDirsBoxStore1;
private readonly ListStore _audioBackendStore;
private readonly TimeZoneContentManager _timeZoneContentManager;
private readonly HashSet<string> _validTzRegions;
@ -95,6 +96,8 @@ namespace Ryujinx.Ui.Windows
[GUI] ToggleButton _browseThemePath;
[GUI] Label _custThemePathLabel;
[GUI] TreeView _gameDirsBox;
[GUI] TreeView _gameDirsBox1;
[GUI] ToggleButton _include_exclude_dir;
[GUI] Entry _addGameDirBox;
[GUI] ComboBoxText _galThreading;
[GUI] Entry _graphicsShadersDumpPath;
@ -384,6 +387,19 @@ namespace Ryujinx.Ui.Windows
_gameDirsBoxStore.AppendValues(gameDir);
}
_gameDirsBox1.AppendColumn("", new CellRendererText(), "text", 0);
_gameDirsBoxStore1 = new ListStore(typeof(string));
_gameDirsBox1.Model = _gameDirsBoxStore1;
foreach (string gameDir1 in ConfigurationState.Instance.Ui.ExcludeGameDirs.Value)
{
_gameDirsBoxStore1.AppendValues(gameDir1);
}
if (_custThemeToggle.Active == false)
{
_custThemePath.Sensitive = false;
@ -571,8 +587,30 @@ namespace Ryujinx.Ui.Windows
ConfigurationState.Instance.Ui.GameDirs.Value = gameDirs;
_directoryChanged = false;
List<string> ExcludegameDirs = new();
_gameDirsBoxStore1.GetIterFirst(out TreeIter treeIter1);
for (int j = 0; j < _gameDirsBoxStore1.IterNChildren(); j++)
{
gameDirs.Add((string)_gameDirsBoxStore1.GetValue(treeIter1, 0));
_gameDirsBoxStore1.IterNext(ref treeIter1);
}
ConfigurationState.Instance.Ui.ExcludeGameDirs.Value = ExcludegameDirs;
_directoryChanged = false;
}
HideCursorMode hideCursor = HideCursorMode.Never;
if (_hideCursorOnIdle.Active)
@ -723,6 +761,22 @@ namespace Ryujinx.Ui.Windows
}
}
private void onRowActivated(object sender, ButtonReleaseEventArgs args)
{
Console.WriteLine("here");
_include_exclude_dir.Label = "exclude";
}
private void onRowActivated1(object sender, ButtonReleaseEventArgs args)
{
Console.WriteLine("here");
_include_exclude_dir.Label = "include";
}
private void AddDir_Pressed(object sender, EventArgs args)
{
if (Directory.Exists(_addGameDirBox.Buffer.Text))

View file

@ -292,6 +292,23 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-bottom">5</property>
<property name="label" translatable="yes">Included Game Directories</property>
<attributes>
<attribute name="weight" value="medium"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
@ -311,6 +328,7 @@
<property name="can-focus">True</property>
<property name="headers-visible">False</property>
<property name="headers-clickable">False</property>
<signal name="button-release-event" handler="onRowActivated" />
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
@ -326,6 +344,50 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-bottom">5</property>
<property name="label" translatable="yes">Excluded Game Directories</property>
<attributes>
<attribute name="weight" value="medium"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="margin-bottom">10</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView" id="_gameDirsBox1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="headers-visible">False</property>
<signal name="button-release-event" handler="onRowActivated1" />
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
<style>
<class name="GameDir"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
@ -359,6 +421,21 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="_include_exclude_dir">
<property name="label" translatable="yes">Include</property>
<property name="width-request">80</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes"> Add a game tyu directory to the list</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="_removeDir">
<property name="label" translatable="yes">Remove</property>
@ -380,14 +457,14 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>