1- using System ;
1+ using Diffusion . Common . Query ;
2+ using Diffusion . Database ;
3+ using Diffusion . Toolkit . Classes ;
4+ using Diffusion . Toolkit . Localization ;
5+ using Diffusion . Toolkit . Models ;
6+ using Diffusion . Toolkit . Services ;
7+ using System ;
28using System . Collections . Generic ;
39using System . Collections . ObjectModel ;
410using System . Collections . Specialized ;
511using System . ComponentModel ;
12+ using System . Globalization ;
613using System . Linq ;
714using System . Windows . Forms ;
8- using Diffusion . Common . Query ;
9- using Diffusion . Database ;
10- using Diffusion . Toolkit . Classes ;
11- using Diffusion . Toolkit . Models ;
15+ using Diffusion . Common ;
1216
1317namespace Diffusion . Toolkit . Controls ;
1418
19+ public class CheckBoxItem : BaseNotify
20+ {
21+ public string PropertyName { get ; set ; }
22+
23+ public bool IsChecked
24+ {
25+ get ;
26+ set => SetField ( ref field , value ) ;
27+ }
28+
29+ public string Name
30+ {
31+ get ;
32+ set => SetField ( ref field , value ) ;
33+ }
34+
35+ public object Value
36+ {
37+ get ;
38+ set ;
39+ }
40+ }
41+
1542public class FilterControlModel : BaseNotify
1643{
1744 public FilterControlModel ( )
@@ -38,9 +65,20 @@ public FilterControlModel()
3865 NodePropertyComparisons = comps ;
3966 SizeOp = "pixels" ;
4067
68+ Types = new ObservableCollection < CheckBoxItem > ( )
69+ {
70+ new CheckBoxItem ( ) { PropertyName = "Types" , Name = GetLocalizedText ( "Filter.Metadata.Types.Image" ) , Value = ImageType . Image } ,
71+ new CheckBoxItem ( ) { PropertyName = "Types" , Name = GetLocalizedText ( "Filter.Metadata.Types.Video" ) , Value = ImageType . Video } ,
72+ } ;
73+
4174 AddNodeFilter ( ) ;
4275 }
4376
77+ private string GetLocalizedText ( string key )
78+ {
79+ return ( string ) JsonLocalizationProvider . Instance . GetLocalizedObject ( key , null , CultureInfo . InvariantCulture ) ;
80+ }
81+
4482 private void NodeFiltersOnCollectionChanged ( object ? sender , NotifyCollectionChangedEventArgs e )
4583 {
4684 if ( e . NewItems is not null )
@@ -320,6 +358,18 @@ public bool Unrated
320358 set => SetField ( ref field , value ) ;
321359 }
322360
361+ public bool UseTypes
362+ {
363+ get ;
364+ set => SetField ( ref field , value ) ;
365+ }
366+
367+ public ObservableCollection < CheckBoxItem > Types
368+ {
369+ get ;
370+ set => SetField ( ref field , value ) ;
371+ }
372+
323373 public bool UseNSFW
324374 {
325375 get ;
@@ -502,6 +552,7 @@ public bool Unavailable
502552 UseFavorite ||
503553 UseRating ||
504554 Unrated ||
555+ UseTypes ||
505556 UseNSFW ||
506557 UseForDeletion ||
507558 UseBatchSize ||
@@ -548,6 +599,10 @@ public void Clear()
548599 Rating = null ;
549600 RatingOp = String . Empty ;
550601 Unrated = false ;
602+ foreach ( var type in Types )
603+ {
604+ type . IsChecked = false ;
605+ }
551606 NSFW = false ;
552607 ForDeletion = false ;
553608 BatchSize = 0 ;
@@ -576,6 +631,7 @@ public void Clear()
576631 UseModelName = false ;
577632 UseFavorite = false ;
578633 UseRating = false ;
634+ UseTypes = false ;
579635 UseNSFW = false ;
580636 UseForDeletion = false ;
581637 UseBatchSize = false ;
0 commit comments