Add unofficial lists to the UI

This commit is contained in:
Timothy Baldridge 2022-03-29 22:05:20 -06:00
parent fd2b523493
commit 26eb1ed38b
4 changed files with 11 additions and 10 deletions

View File

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

View File

@ -40,7 +40,7 @@ namespace Wabbajack
public bool ShowNSFW { get; set; } public bool ShowNSFW { get; set; }
[Reactive] [Reactive]
public bool ShowUtilityLists { get; set; } public bool ShowUnofficial { get; set; }
[Reactive] [Reactive]
public string GameType { get; set; } public string GameType { get; set; }
@ -65,7 +65,7 @@ namespace Wabbajack
{ {
GameType = !string.IsNullOrEmpty(settings.Game) ? settings.Game : ALL_GAME_TYPE; GameType = !string.IsNullOrEmpty(settings.Game) ? settings.Game : ALL_GAME_TYPE;
ShowNSFW = settings.ShowNSFW; ShowNSFW = settings.ShowNSFW;
ShowUtilityLists = settings.ShowUtilityLists; ShowUnofficial = settings.ShowUnofficial;
OnlyInstalled = settings.OnlyInstalled; OnlyInstalled = settings.OnlyInstalled;
Search = settings.Search; Search = settings.Search;
} }
@ -82,7 +82,7 @@ namespace Wabbajack
{ {
OnlyInstalled = false; OnlyInstalled = false;
ShowNSFW = false; ShowNSFW = false;
ShowUtilityLists = false; ShowUnofficial = false;
Search = string.Empty; Search = string.Empty;
GameType = ALL_GAME_TYPE; GameType = ALL_GAME_TYPE;
}); });
@ -153,8 +153,8 @@ namespace Wabbajack
if (!vm.Metadata.NSFW) return true; if (!vm.Metadata.NSFW) return true;
return vm.Metadata.NSFW && showNSFW; return vm.Metadata.NSFW && showNSFW;
})) }))
.Filter(this.WhenAny(x => x.ShowUtilityLists) .Filter(this.WhenAny(x => x.ShowUnofficial)
.Select<bool, Func<ModListMetadataVM, bool>>(showUtilityLists => vm => showUtilityLists ? vm.Metadata.UtilityList : !vm.Metadata.UtilityList)) .Select<bool, Func<ModListMetadataVM, bool>>(ShowUnofficial => vm => vm.Metadata.RepositoryName == "wj-featured" || ShowUnofficial))
// Filter by Game // Filter by Game
.Filter(this.WhenAny(x => x.GameType) .Filter(this.WhenAny(x => x.GameType)
.Debounce(TimeSpan.FromMilliseconds(150), RxApp.MainThreadScheduler) .Debounce(TimeSpan.FromMilliseconds(150), RxApp.MainThreadScheduler)
@ -202,7 +202,7 @@ namespace Wabbajack
settings.Game = GameType; settings.Game = GameType;
settings.Search = Search; settings.Search = Search;
settings.ShowNSFW = ShowNSFW; settings.ShowNSFW = ShowNSFW;
settings.ShowUtilityLists = ShowUtilityLists; settings.ShowUnofficial = ShowUnofficial;
settings.OnlyInstalled = OnlyInstalled; settings.OnlyInstalled = OnlyInstalled;
} }
} }

View File

@ -117,11 +117,12 @@
Content="Show NSFW" Content="Show NSFW"
Foreground="{StaticResource ForegroundBrush}" /> Foreground="{StaticResource ForegroundBrush}" />
<CheckBox <CheckBox
x:Name="ShowUtilityLists" x:Name="ShowUnofficial"
Margin="10,0,10,0" Margin="10,0,10,0"
VerticalAlignment="Center" VerticalAlignment="Center"
Content="Only Utility Lists" Content="Show Unofficial Lists"
Foreground="{StaticResource ForegroundBrush}" /> Foreground="{StaticResource ForegroundBrush}" />
<CheckBox <CheckBox

View File

@ -63,7 +63,7 @@ namespace Wabbajack
.DisposeWith(dispose); .DisposeWith(dispose);
this.BindStrict(ViewModel, vm => vm.ShowNSFW, x => x.ShowNSFW.IsChecked) this.BindStrict(ViewModel, vm => vm.ShowNSFW, x => x.ShowNSFW.IsChecked)
.DisposeWith(dispose); .DisposeWith(dispose);
this.BindStrict(ViewModel, vm => vm.ShowUtilityLists, x => x.ShowUtilityLists.IsChecked) this.BindStrict(ViewModel, vm => vm.ShowUnofficial, x => x.ShowUnofficial.IsChecked)
.DisposeWith(dispose); .DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.ClearFiltersCommand) this.WhenAny(x => x.ViewModel.ClearFiltersCommand)