mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Implement utility list filtering for the UI
This commit is contained in:
parent
802448c934
commit
73d3168d2c
@ -34,6 +34,9 @@ namespace Wabbajack.Lib.ModListRegistry
|
||||
|
||||
[JsonProperty("nsfw")]
|
||||
public bool NSFW { get; set; }
|
||||
|
||||
[JsonProperty("utility_list")]
|
||||
public bool UtilityList { get; set; }
|
||||
|
||||
[JsonProperty("links")]
|
||||
public LinksObject Links { get; set; } = new LinksObject();
|
||||
|
@ -37,6 +37,9 @@ namespace Wabbajack
|
||||
|
||||
[Reactive]
|
||||
public bool ShowNSFW { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public bool ShowUtilityLists { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string GameType { get; set; }
|
||||
@ -77,6 +80,7 @@ namespace Wabbajack
|
||||
{
|
||||
OnlyInstalled = false;
|
||||
ShowNSFW = false;
|
||||
ShowUtilityLists = false;
|
||||
Search = string.Empty;
|
||||
GameType = ALL_GAME_TYPE;
|
||||
});
|
||||
@ -150,6 +154,12 @@ namespace Wabbajack
|
||||
if (!vm.Metadata.NSFW) return true;
|
||||
return vm.Metadata.NSFW && showNSFW;
|
||||
}))
|
||||
.Filter(this.WhenAny(x => x.ShowUtilityLists)
|
||||
.Select<bool, Func<ModListMetadataVM, bool>>(showNSFW => vm =>
|
||||
{
|
||||
if (!vm.Metadata.UtilityList) return true;
|
||||
return vm.Metadata.UtilityList && showNSFW;
|
||||
}))
|
||||
// Filter by Game
|
||||
.Filter(this.WhenAny(x => x.GameType)
|
||||
.Debounce(TimeSpan.FromMilliseconds(150), RxApp.MainThreadScheduler)
|
||||
@ -169,6 +179,12 @@ namespace Wabbajack
|
||||
if (!vm.Metadata.NSFW) return true;
|
||||
return vm.Metadata.NSFW && showNSFW;
|
||||
}))
|
||||
.Filter(this.WhenAny(x => x.ShowUtilityLists)
|
||||
.Select<bool, Func<ModListMetadataVM, bool>>(showUtilityLists => vm =>
|
||||
{
|
||||
if (!vm.Metadata.UtilityList) return true;
|
||||
return vm.Metadata.UtilityList && showUtilityLists;
|
||||
}))
|
||||
// Put broken lists at bottom
|
||||
.Sort(Comparer<ModListMetadataVM>.Create((a, b) => a.IsBroken.CompareTo(b.IsBroken)))
|
||||
.Bind(ModLists)
|
||||
|
@ -116,6 +116,14 @@
|
||||
VerticalAlignment="Center"
|
||||
Content="Show NSFW"
|
||||
Foreground="{StaticResource ForegroundBrush}" />
|
||||
|
||||
<CheckBox
|
||||
x:Name="ShowUtilityLists"
|
||||
Margin="10,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
Content="Show Utility Lists"
|
||||
Foreground="{StaticResource ForegroundBrush}" />
|
||||
|
||||
<CheckBox
|
||||
x:Name="OnlyInstalledCheckbox"
|
||||
Margin="10,0,10,0"
|
||||
|
Loading…
Reference in New Issue
Block a user