Show file icon in search all files dialog
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
using SharpIDE.Application.Features.Analysis;
|
using SharpIDE.Application.Features.Analysis;
|
||||||
using SharpIDE.Application.Features.Search;
|
using SharpIDE.Application.Features.Search;
|
||||||
|
using SharpIDE.Godot.Features.SolutionExplorer;
|
||||||
|
|
||||||
namespace SharpIDE.Godot.Features.Search.SearchAllFiles;
|
namespace SharpIDE.Godot.Features.Search.SearchAllFiles;
|
||||||
|
|
||||||
public partial class SearchAllFilesResultComponent : MarginContainer
|
public partial class SearchAllFilesResultComponent : MarginContainer
|
||||||
{
|
{
|
||||||
private TextureRect _textureRect = null!;
|
private TextureRect _textureRect = null!;
|
||||||
|
private TextureRect _overlayTextureRect = null!;
|
||||||
private Label _fileNameLabel = null!;
|
private Label _fileNameLabel = null!;
|
||||||
private Label _filePathLabel = null!;
|
private Label _filePathLabel = null!;
|
||||||
private Button _button = null!;
|
private Button _button = null!;
|
||||||
@@ -21,6 +23,7 @@ public partial class SearchAllFilesResultComponent : MarginContainer
|
|||||||
{
|
{
|
||||||
_button = GetNode<Button>("Button");
|
_button = GetNode<Button>("Button");
|
||||||
_textureRect = GetNode<TextureRect>("%IconTextureRect");
|
_textureRect = GetNode<TextureRect>("%IconTextureRect");
|
||||||
|
_overlayTextureRect = GetNode<TextureRect>("%IconOverlayTextureRect");
|
||||||
_fileNameLabel = GetNode<Label>("%FileNameLabel");
|
_fileNameLabel = GetNode<Label>("%FileNameLabel");
|
||||||
_filePathLabel = GetNode<Label>("%FilePathLabel");
|
_filePathLabel = GetNode<Label>("%FilePathLabel");
|
||||||
SetValue(Result);
|
SetValue(Result);
|
||||||
@@ -36,7 +39,9 @@ public partial class SearchAllFilesResultComponent : MarginContainer
|
|||||||
private void SetValue(FindFilesSearchResult result)
|
private void SetValue(FindFilesSearchResult result)
|
||||||
{
|
{
|
||||||
if (result is null) return;
|
if (result is null) return;
|
||||||
_textureRect.Texture = _csharpFileIcon;
|
var (icon, overlayIcon) = FileIconHelper.GetIconForFileExtension(result.File.Extension);
|
||||||
|
_textureRect.Texture = icon;
|
||||||
|
_overlayTextureRect.Texture = overlayIcon;
|
||||||
_fileNameLabel.Text = result.File.Name;
|
_fileNameLabel.Text = result.File.Name;
|
||||||
_filePathLabel.Text = result.File.Path;
|
_filePathLabel.Text = result.File.Path;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,15 @@ theme_override_constants/margin_right = 5
|
|||||||
[node name="HBoxContainer" type="HBoxContainer" parent="Button/MarginContainer"]
|
[node name="HBoxContainer" type="HBoxContainer" parent="Button/MarginContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="IconTextureRect" type="TextureRect" parent="Button/MarginContainer/HBoxContainer"]
|
[node name="CenterContainer" type="CenterContainer" parent="Button/MarginContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
|
||||||
|
[node name="IconTextureRect" type="TextureRect" parent="Button/MarginContainer/HBoxContainer/CenterContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="IconOverlayTextureRect" type="TextureRect" parent="Button/MarginContainer/HBoxContainer/CenterContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user