Set file size text

This commit is contained in:
Jarrod Doyle 2024-09-08 19:47:01 +01:00
parent 56614d3b1d
commit fbacfccd13
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
2 changed files with 7 additions and 0 deletions

View File

@ -28,6 +28,7 @@ public partial class TextureBrowser : Node
private OptionButton _filterOptions;
private LineEdit _fileType;
private LineEdit _resolutionBox;
private LineEdit _fileSizeBox;
private string _searchFilterPrefix = "";
@ -48,6 +49,7 @@ public partial class TextureBrowser : Node
_filterOptions = GetNode<OptionButton>("%FilterOptions");
_fileType = GetNode<LineEdit>("%FileTypeBox");
_resolutionBox = GetNode<LineEdit>("%ResolutionBox");
_fileSizeBox = GetNode<LineEdit>("%FileSizeBox");
_searchBar.TextChanged += ApplySearchFilter;
_sortMenu.GetPopup().IdPressed += ApplySortMode;
@ -132,8 +134,12 @@ public partial class TextureBrowser : Node
_previewTexture.Texture = texture;
_texturePath.Text = name;
_fileType.Text = Path.GetExtension(path).ToUpper();
var resolution = texture.GetSize();
_resolutionBox.Text = $"{resolution.X}x{resolution.Y}";
var fileInfo = new FileInfo(path);
_fileSizeBox.Text = $"{(fileInfo.Length / 1000.0f).ToString("0.0")} kb";
}
private void ApplySearchFilter(string filter)

View File

@ -297,6 +297,7 @@ layout_mode = 2
text = "File Size"
[node name="FileSizeBox" type="LineEdit" parent="TabContainer/Textures/VBoxContainer/HSplitContainer/HSplitContainer/Preview/VBoxContainer/PanelContainer/MarginContainer/Details"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
editable = false