Merge pull request #1186 from wabbajack-tools/utility-lists

Utility lists
This commit is contained in:
Timothy Baldridge 2020-11-14 12:30:47 -07:00 committed by GitHub
commit 8edd84f934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 6 deletions

View File

@ -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();

View File

@ -107,6 +107,7 @@ namespace Wabbajack
private bool _useCompression = false;
public bool UseCompression { get => _useCompression; set => RaiseAndSetIfChanged(ref _useCompression, value); }
public bool ShowUtilityLists { get; set; }
}
[JsonName("PerformanceSettings")]

View File

@ -37,6 +37,9 @@ namespace Wabbajack
[Reactive]
public bool ShowNSFW { get; set; }
[Reactive]
public bool ShowUtilityLists { get; set; }
[Reactive]
public string GameType { get; set; }
@ -61,6 +64,7 @@ namespace Wabbajack
{
GameType = !string.IsNullOrEmpty(settings.Game) ? settings.Game : ALL_GAME_TYPE;
ShowNSFW = settings.ShowNSFW;
ShowUtilityLists = settings.ShowUtilityLists;
OnlyInstalled = settings.OnlyInstalled;
Search = settings.Search;
}
@ -77,6 +81,7 @@ namespace Wabbajack
{
OnlyInstalled = false;
ShowNSFW = false;
ShowUtilityLists = false;
Search = string.Empty;
GameType = ALL_GAME_TYPE;
});
@ -150,6 +155,8 @@ 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 => showUtilityLists ? vm.Metadata.UtilityList : !vm.Metadata.UtilityList))
// Filter by Game
.Filter(this.WhenAny(x => x.GameType)
.Debounce(TimeSpan.FromMilliseconds(150), RxApp.MainThreadScheduler)
@ -163,12 +170,6 @@ namespace Wabbajack
return GameType == vm.Metadata.Game.GetDescription<Game>().ToString();
}))
.Filter(this.WhenAny(x => x.ShowNSFW)
.Select<bool, Func<ModListMetadataVM, bool>>(showNSFW => vm =>
{
if (!vm.Metadata.NSFW) return true;
return vm.Metadata.NSFW && showNSFW;
}))
// Put broken lists at bottom
.Sort(Comparer<ModListMetadataVM>.Create((a, b) => a.IsBroken.CompareTo(b.IsBroken)))
.Bind(ModLists)
@ -204,6 +205,7 @@ namespace Wabbajack
settings.Game = GameType;
settings.Search = Search;
settings.ShowNSFW = ShowNSFW;
settings.ShowUtilityLists = ShowUtilityLists;
settings.OnlyInstalled = OnlyInstalled;
}
}

View File

@ -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"

View File

@ -63,6 +63,8 @@ namespace Wabbajack
.DisposeWith(dispose);
this.BindStrict(ViewModel, vm => vm.ShowNSFW, x => x.ShowNSFW.IsChecked)
.DisposeWith(dispose);
this.BindStrict(ViewModel, vm => vm.ShowUtilityLists, x => x.ShowUtilityLists.IsChecked)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.ClearFiltersCommand)
.BindToStrict(this, x => x.ClearFiltersButton.Command)