mirror of
https://github.com/Pixeval/Pixeval.git
synced 2025-01-07 03:06:53 +08:00
parent
2ae9792009
commit
a6640e5052
@ -154,17 +154,26 @@ public class DocumentViewerViewModel(NovelContent novelContent) : ObservableObje
|
||||
}));
|
||||
}
|
||||
|
||||
public async Task LoadImagesAsync()
|
||||
public void InitImages()
|
||||
{
|
||||
foreach (var illust in NovelContent.Illusts)
|
||||
{
|
||||
var key = (illust.Id, illust.Page);
|
||||
IllustrationLookup[key] = illust;
|
||||
IllustrationImages[key] = null!;
|
||||
IllustrationStreams[key] = null!;
|
||||
}
|
||||
|
||||
foreach (var image in NovelContent.Images)
|
||||
{
|
||||
UploadedImages[image.NovelImageId] = null!;
|
||||
UploadedStreams[image.NovelImageId] = null!;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task LoadImagesAsync()
|
||||
{
|
||||
InitImages();
|
||||
|
||||
foreach (var illust in NovelContent.Illusts)
|
||||
{
|
||||
|
@ -1,24 +0,0 @@
|
||||
<controls:SettingsCard
|
||||
x:Class="Pixeval.Controls.Settings.AiUpscalerModelSettingsCard"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:controls1="using:Pixeval.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:fluent="using:FluentIcons.WinUI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Header="{x:Bind Entry.Header}"
|
||||
Tag="{x:Bind Entry.Attribute}"
|
||||
mc:Ignorable="d">
|
||||
<controls:SettingsCard.HeaderIcon>
|
||||
<fluent:SymbolIcon Symbol="{x:Bind Entry.HeaderIcon}" />
|
||||
</controls:SettingsCard.HeaderIcon>
|
||||
<controls:SettingsCard.Description>
|
||||
<HyperlinkButton Content="{x:Bind Entry.Description}" Tag="https://github.com/xinntao/Real-ESRGAN/blob/master/README_CN.md" />
|
||||
</controls:SettingsCard.Description>
|
||||
<controls1:EnumComboBox
|
||||
ItemsSource="{x:Bind Entry.EnumItems}"
|
||||
SelectedEnum="{x:Bind Entry.Value, Mode=TwoWay}"
|
||||
SelectionChanged="EnumComboBox_OnSelectionChanged"
|
||||
Style="{StaticResource SettingsEnumComboBoxStyle}" />
|
||||
</controls:SettingsCard>
|
@ -1,25 +0,0 @@
|
||||
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Pixeval.Settings.Models;
|
||||
|
||||
namespace Pixeval.Controls.Settings
|
||||
{
|
||||
public sealed partial class AiUpscalerModelSettingsCard
|
||||
{
|
||||
public AiUpscalerModelSettingsCard()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public AiUpscalerModelSettingsEntry Entry { get; set; } = null!;
|
||||
|
||||
private void EnumComboBox_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
Entry.ValueChanged?.Invoke(Entry.Value);
|
||||
}
|
||||
}
|
||||
}
|
@ -164,6 +164,8 @@ public class NovelDownloadTaskGroup : DownloadTaskGroup
|
||||
return;
|
||||
}
|
||||
|
||||
DocumentViewModel.InitImages();
|
||||
|
||||
var content = NovelDownloadFormat switch
|
||||
{
|
||||
NovelDownloadFormat.OriginalTxt => NovelContent.Text,
|
||||
|
@ -322,10 +322,10 @@
|
||||
<AppBarSeparator Height="35" Margin="10,0,0,0" />
|
||||
<AppBarButton
|
||||
x:Name="UpscaleButton"
|
||||
Click="UpscaleButton_OnTapped"
|
||||
Icon="{winUi:SymbolIcon Symbol=EyeTracking}"
|
||||
IsCompact="True"
|
||||
LabelPosition="Collapsed"
|
||||
Tapped="UpscaleButton_OnTapped" />
|
||||
LabelPosition="Collapsed" />
|
||||
<TeachingTip
|
||||
x:Name="UpscaleTeachingTip"
|
||||
x:Uid="/EntryViewerPage/UpscaleTeachingTip"
|
||||
|
@ -285,7 +285,7 @@ public sealed partial class IllustrationViewerPage
|
||||
teachingTip.Target = appBarButton.IsInOverflow ? null : appBarButton;
|
||||
}
|
||||
|
||||
private async void UpscaleButton_OnTapped(object sender, TappedRoutedEventArgs e)
|
||||
private async void UpscaleButton_OnTapped(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!App.AppViewModel.AppSettings.ShowUpscalerTeachingTip)
|
||||
{
|
||||
|
@ -62,14 +62,14 @@
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate x:DataType="local:DependencyViewModel">
|
||||
<controls:SettingsExpander Tag="{x:Bind Url}">
|
||||
<controls:SettingsExpander>
|
||||
<controls:SettingsExpander.Content>
|
||||
<AppBarButton
|
||||
Click="LaunchUri"
|
||||
Icon="{fluent:SymbolIcon Symbol=Open}"
|
||||
IsCompact="True"
|
||||
LabelPosition="Collapsed"
|
||||
Tag="{x:Bind Url}"
|
||||
Tapped="LaunchUri" />
|
||||
Tag="{x:Bind Url}" />
|
||||
</controls:SettingsExpander.Content>
|
||||
<controls:SettingsExpander.Header>
|
||||
<TextBlock>
|
||||
@ -79,11 +79,13 @@
|
||||
</TextBlock>
|
||||
</controls:SettingsExpander.Header>
|
||||
<controls:SettingsExpander.Items>
|
||||
<labs:MarkdownTextBlock Margin="5" Text="{x:Bind License}">
|
||||
<labs:MarkdownTextBlock.Config>
|
||||
<labs:MarkdownConfig />
|
||||
</labs:MarkdownTextBlock.Config>
|
||||
</labs:MarkdownTextBlock>
|
||||
<controls:SettingsCard HorizontalContentAlignment="Left" ContentAlignment="Vertical">
|
||||
<labs:MarkdownTextBlock Margin="5" Text="{x:Bind License}">
|
||||
<labs:MarkdownTextBlock.Config>
|
||||
<labs:MarkdownConfig />
|
||||
</labs:MarkdownTextBlock.Config>
|
||||
</labs:MarkdownTextBlock>
|
||||
</controls:SettingsCard>
|
||||
</controls:SettingsExpander.Items>
|
||||
</controls:SettingsExpander>
|
||||
</DataTemplate>
|
||||
|
@ -108,9 +108,7 @@ public partial class SettingsPageViewModel : UiObservableObject, IDisposable
|
||||
t => t.DefaultSelectedTabItem,
|
||||
MainPageTabItemExtension.GetItems()),
|
||||
new StringAppSettingsEntry(AppSettings,
|
||||
#pragma warning disable CS8603 // Possible null reference return.
|
||||
t => t.WebCookie)
|
||||
#pragma warning restore CS8603 // Possible null reference return.
|
||||
{
|
||||
Placeholder = SettingsPageResources.WebCookieTextBoxPlaceholderText
|
||||
}
|
||||
@ -138,9 +136,12 @@ public partial class SettingsPageViewModel : UiObservableObject, IDisposable
|
||||
|
||||
new (SettingsEntryCategory.AiUpscaler)
|
||||
{
|
||||
new AiUpscalerModelSettingsEntry(AppSettings,
|
||||
new EnumAppSettingsEntry(AppSettings,
|
||||
t => t.UpscalerModel,
|
||||
RealESRGANModelExtension.GetItems()),
|
||||
RealESRGANModelExtension.GetItems())
|
||||
{
|
||||
DescriptionUri = new Uri("https://github.com/xinntao/Real-ESRGAN/blob/master/README_CN.md")
|
||||
},
|
||||
new IntAppSettingsEntry(AppSettings,
|
||||
t => t.UpscalerScaleRatio)
|
||||
{
|
||||
|
@ -165,11 +165,6 @@
|
||||
<None Remove="Assets\Images\Icons\tag-128x128.png" />
|
||||
<None Remove="Assets\Images\Icons\tag-64x64.png" />
|
||||
<None Remove="Assets\Images\Icons\tag.png" />
|
||||
<None Remove="Controls\Settings\AiUpscalerModelSettingsCard.xaml" />
|
||||
<None Remove="Pages\Capability\FeedPage.xaml" />
|
||||
<None Remove="Pages\Capability\Feeds\CondensedFeedPage.xaml" />
|
||||
<None Remove="Strings\zh-cn\AiUpscaler.resjson" />
|
||||
<None Remove="Strings\zh-cn\FeedPage.resjson" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -213,10 +208,4 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="Controls\Settings\AiUpscalerModelSettingsCard.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -1,34 +0,0 @@
|
||||
#region Copyright (c) Pixeval/Pixeval
|
||||
// GPL v3 License
|
||||
//
|
||||
// Pixeval/Pixeval
|
||||
// Copyright (c) 2024 Pixeval/AiUpscalerModelSettingsEntry.cs
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System.Linq.Expressions;
|
||||
using System;
|
||||
using Pixeval.AppManagement;
|
||||
using Pixeval.Controls.Settings;
|
||||
using Pixeval.Controls;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Pixeval.Settings.Models;
|
||||
|
||||
public class AiUpscalerModelSettingsEntry(AppSettings appSettings, Expression<Func<AppSettings, Enum>> property, IReadOnlyList<StringRepresentableItem> array)
|
||||
: EnumAppSettingsEntry(appSettings, property, array)
|
||||
{
|
||||
public override AiUpscalerModelSettingsCard Element => new() { Entry = this };
|
||||
}
|
Loading…
Reference in New Issue
Block a user