Skip to content

Commit bc086b7

Browse files
author
David Khristepher Santos
committed
add Video Icon
1 parent 0e16e37 commit bc086b7

5 files changed

Lines changed: 33 additions & 1 deletion

File tree

Diffusion.Toolkit/Controls/ThumbnailIcons.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Windows.Markup;
55
using System.Windows.Media;
66
using System.Windows.Media.Imaging;
7+
using Diffusion.Common;
78
using Diffusion.Toolkit.Models;
89
using Diffusion.Toolkit.Themes;
910

@@ -21,6 +22,9 @@ public class ThumbnailIcons : FrameworkElement
2122
private static BitmapImage? _darkHideIcon;
2223
private static BitmapImage? _lightHideIcon;
2324

25+
private static BitmapImage? _darkVideoIcon;
26+
private static BitmapImage? _lightVideoIcon;
27+
2428
private static Typeface _typeFace = new Typeface(new FontFamily("Arial"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
2529
private static Typeface _typeFaceBoldCondensed = new Typeface(new FontFamily("Arial"), FontStyles.Normal, FontWeights.Bold, FontStretches.Condensed);
2630

@@ -42,6 +46,7 @@ private static void PropertyChangedCallback(DependencyObject d, DependencyProper
4246
case nameof(ImageEntry.ForDeletion):
4347
case nameof(ImageEntry.Favorite):
4448
case nameof(ImageEntry.Rating):
49+
case nameof(ImageEntry.Type):
4550
var thumb = d as ThumbnailIcons;
4651
thumb.InvalidateVisual();
4752
break;
@@ -84,6 +89,10 @@ private static void InitIcons()
8489
_darkHideIcon = new BitmapImage(darkHideIconUri);
8590
Uri lightHideIconUri = GetUri("/Icons/Light/hide-24.png");
8691
_lightHideIcon = new BitmapImage(lightHideIconUri);
92+
Uri darkVideoIconUri = GetUri("/Icons/Dark/video-24.png");
93+
_darkVideoIcon = new BitmapImage(darkVideoIconUri);
94+
Uri lightVideoIconUri = GetUri("/Icons/Light/video-24.png");
95+
_lightVideoIcon = new BitmapImage(lightVideoIconUri);
8796
Uri errorIconUri = GetUri("/Icons/error-32.png");
8897
_errorIcon = new BitmapImage(errorIconUri);
8998
}
@@ -119,6 +128,21 @@ protected override void OnRender(DrawingContext drawingContext)
119128
}
120129

121130

131+
132+
if (Data.Type == ImageType.Video)
133+
{
134+
if (ThemeManager.CurrentTheme == "Dark")
135+
{
136+
drawingContext.DrawImage(_darkVideoIcon, new Rect(new Point(x, y), new Size(24, 24)));
137+
}
138+
else if (ThemeManager.CurrentTheme == "Light")
139+
{
140+
drawingContext.DrawImage(_lightVideoIcon, new Rect(new Point(x, y), new Size(24, 24)));
141+
}
142+
x += xOffset;
143+
}
144+
145+
122146
if (Data.NSFW)
123147
{
124148
if (ThemeManager.CurrentTheme == "Dark")

Diffusion.Toolkit/Diffusion.Toolkit.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<None Remove="Icons\Dark\trash-32.png" />
2828
<None Remove="Icons\Dark\gallery-32.png" />
2929
<None Remove="Icons\Dark\trash-solid-32.png" />
30+
<None Remove="Icons\Dark\video-24.png" />
3031
<None Remove="Icons\error-32.png" />
3132
<None Remove="Icons\favorite-32.png" />
3233
<None Remove="Icons\filter-32.png" />
@@ -48,6 +49,7 @@
4849
<None Remove="Icons\Light\trash-32.png" />
4950
<None Remove="Icons\Light\gallery-32.png" />
5051
<None Remove="Icons\Light\trash-solid-32.png" />
52+
<None Remove="Icons\Light\video-24.png" />
5153
<None Remove="Icons\link-32.png" />
5254
<None Remove="Icons\models-32.png" />
5355
<None Remove="Icons\rebuild-32.png" />
@@ -90,6 +92,7 @@
9092

9193
<ItemGroup>
9294
<Resource Include="Icons\Dark\trash-solid-32.png" />
95+
<Resource Include="Icons\Dark\video-24.png" />
9396
<Resource Include="Icons\error-32.png" />
9497
<EmbeddedResource Include="Localization\de-DE.json">
9598
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -205,6 +208,7 @@
205208
<Resource Include="Icons\Light\trash-32.png" />
206209
<Resource Include="Icons\Light\gallery-32.png" />
207210
<Resource Include="Icons\Light\trash-solid-32.png" />
211+
<Resource Include="Icons\Light\video-24.png" />
208212
<Resource Include="Icons\star-32.png" />
209213
<Resource Include="Icons\x-mark-16.png" />
210214
<Resource Include="Icons\x-mark-32.png" />
1.5 KB
Loading
209 Bytes
Loading

Diffusion.Toolkit/Models/ImageEntry.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,11 @@ public long Size
179179
set => SetField(ref field, value);
180180
}
181181

182-
public ImageType Type { get; set; }
182+
public ImageType Type
183+
{
184+
get;
185+
set => SetField(ref field, value);
186+
}
183187

184188
public void Clear()
185189
{

0 commit comments

Comments
 (0)