Add dummy sort function

This commit is contained in:
Jarrod Doyle 2024-09-08 17:22:47 +01:00
parent e76bc13ef5
commit 66a57d415a
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,4 @@
using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Godot; using Godot;
@ -5,6 +6,14 @@ namespace KeepersCompound.TMV.UI;
public partial class TextureBrowser : Node public partial class TextureBrowser : Node
{ {
enum SortMode
{
Name,
Family,
Index,
Count,
}
private Tree _folderTree; private Tree _folderTree;
private LineEdit _searchBar; private LineEdit _searchBar;
private MenuButton _sortMenu; private MenuButton _sortMenu;
@ -30,6 +39,7 @@ public partial class TextureBrowser : Node
_texturePath = GetNode<LineEdit>("%PathBox"); _texturePath = GetNode<LineEdit>("%PathBox");
_searchBar.TextChanged += ApplySearchFilter; _searchBar.TextChanged += ApplySearchFilter;
_sortMenu.GetPopup().IdPressed += ApplySortMode;
BuildFolderTree(); BuildFolderTree();
BuildTextureList(); // TODO: This should be triggered on folder change BuildTextureList(); // TODO: This should be triggered on folder change
@ -102,4 +112,15 @@ public partial class TextureBrowser : Node
panel.Visible = Regex.IsMatch(panel.Name.ToString(), regexString); panel.Visible = Regex.IsMatch(panel.Name.ToString(), regexString);
} }
} }
private void ApplySortMode(long id)
{
var popup = _sortMenu.GetPopup();
for (var i = 0; i < popup.ItemCount; i++)
{
popup.SetItemChecked(i, popup.GetItemId(i) == id);
}
// TODO: Actualy sort
}
} }