From f57fd585b2642b6407394103fe9b3554c7d33191 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Wed, 5 Nov 2025 11:12:40 +0100 Subject: [PATCH] UI changes --- src/modules/imageresizer/ui/Models/AiSize.cs | 7 - .../ui/Properties/Resources.Designer.cs | 337 ++++++++---------- .../imageresizer/ui/Properties/Resources.resx | 11 +- .../ui/ViewModels/InputViewModel.cs | 14 +- .../imageresizer/ui/Views/InputPage.xaml | 62 ++-- 5 files changed, 200 insertions(+), 231 deletions(-) diff --git a/src/modules/imageresizer/ui/Models/AiSize.cs b/src/modules/imageresizer/ui/Models/AiSize.cs index 8bd8fa20e4..dcb9d521d8 100644 --- a/src/modules/imageresizer/ui/Models/AiSize.cs +++ b/src/modules/imageresizer/ui/Models/AiSize.cs @@ -15,13 +15,6 @@ namespace ImageResizer.Models private static readonly CompositeFormat ScaleFormat = CompositeFormat.Parse(Resources.Input_AiScaleFormat); private int _scale = 2; - [JsonIgnore] - public override string Name - { - get => Resources.Input_AiSuperResolution; - set { /* no-op */ } - } - /// /// Gets the formatted scale display string (e.g., "2×"). /// diff --git a/src/modules/imageresizer/ui/Properties/Resources.Designer.cs b/src/modules/imageresizer/ui/Properties/Resources.Designer.cs index a04eed77b1..22166e73b9 100644 --- a/src/modules/imageresizer/ui/Properties/Resources.Designer.cs +++ b/src/modules/imageresizer/ui/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace ImageResizer.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { @@ -78,6 +78,33 @@ namespace ImageResizer.Properties { } } + /// + /// Looks up a localized string similar to Failed to convert image format for AI processing.. + /// + public static string Error_AiConversionFailed { + get { + return ResourceManager.GetString("Error_AiConversionFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AI super resolution processing failed: {0}. + /// + public static string Error_AiProcessingFailed { + get { + return ResourceManager.GetString("Error_AiProcessingFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AI scaling operation failed.. + /// + public static string Error_AiScalingFailed { + get { + return ResourceManager.GetString("Error_AiScalingFailed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Height. /// @@ -105,6 +132,132 @@ namespace ImageResizer.Properties { } } + /// + /// Looks up a localized string similar to Current:. + /// + public static string Input_AiCurrentLabel { + get { + return ResourceManager.GetString("Input_AiCurrentLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Checking AI model availability.... + /// + public static string Input_AiModelChecking { + get { + return ResourceManager.GetString("Input_AiModelChecking", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AI feature is disabled by system settings.. + /// + public static string Input_AiModelDisabledByUser { + get { + return ResourceManager.GetString("Input_AiModelDisabledByUser", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Download. + /// + public static string Input_AiModelDownloadButton { + get { + return ResourceManager.GetString("Input_AiModelDownloadButton", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to download AI model. Please try again.. + /// + public static string Input_AiModelDownloadFailed { + get { + return ResourceManager.GetString("Input_AiModelDownloadFailed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Downloading AI model.... + /// + public static string Input_AiModelDownloading { + get { + return ResourceManager.GetString("Input_AiModelDownloading", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AI model not downloaded. Click Download to get started.. + /// + public static string Input_AiModelNotAvailable { + get { + return ResourceManager.GetString("Input_AiModelNotAvailable", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to AI feature is not supported on this system.. + /// + public static string Input_AiModelNotSupported { + get { + return ResourceManager.GetString("Input_AiModelNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to New:. + /// + public static string Input_AiNewLabel { + get { + return ResourceManager.GetString("Input_AiNewLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0}×. + /// + public static string Input_AiScaleFormat { + get { + return ResourceManager.GetString("Input_AiScaleFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Scale. + /// + public static string Input_AiScaleLabel { + get { + return ResourceManager.GetString("Input_AiScaleLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Super resolution. + /// + public static string Input_AiSuperResolution { + get { + return ResourceManager.GetString("Input_AiSuperResolution", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Upscale images using on-device AI. + /// + public static string Input_AiSuperResolutionDescription { + get { + return ResourceManager.GetString("Input_AiSuperResolutionDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unavailable. + /// + public static string Input_AiUnknownSize { + get { + return ResourceManager.GetString("Input_AiUnknownSize", resourceCulture); + } + } + /// /// Looks up a localized string similar to (auto). /// @@ -194,187 +347,7 @@ namespace ImageResizer.Properties { return ResourceManager.GetString("Input_ShrinkOnly.Content", resourceCulture); } } - - /// - /// Looks up a localized string similar to AI Super Resolution. - /// - public static string Input_AiSuperResolution { - get { - return ResourceManager.GetString("Input_AiSuperResolution", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Original size. - /// - public static string Input_AiOriginalSizeLabel { - get { - return ResourceManager.GetString("Input_AiOriginalSizeLabel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Enhanced size. - /// - public static string Input_AiEnhancedSizeLabel { - get { - return ResourceManager.GetString("Input_AiEnhancedSizeLabel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Unavailable. - /// - public static string Input_AiUnknownSize { - get { - return ResourceManager.GetString("Input_AiUnknownSize", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Multiple files selected. - /// - public static string Input_AiMultipleFiles { - get { - return ResourceManager.GetString("Input_AiMultipleFiles", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0}×. - /// - public static string Input_AiScaleFormat { - get { - return ResourceManager.GetString("Input_AiScaleFormat", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Upscale to {0} times the original size.. - /// - public static string Input_AiScaleHelp { - get { - return ResourceManager.GetString("Input_AiScaleHelp", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Scale. - /// - public static string Input_AiScaleLabel { - get { - return ResourceManager.GetString("Input_AiScaleLabel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Current. - /// - public static string Input_AiCurrentLabel { - get { - return ResourceManager.GetString("Input_AiCurrentLabel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to New. - /// - public static string Input_AiNewLabel { - get { - return ResourceManager.GetString("Input_AiNewLabel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Checking AI model availability... - /// - public static string Input_AiModelChecking { - get { - return ResourceManager.GetString("Input_AiModelChecking", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to AI model not downloaded. Click Download to get started. - /// - public static string Input_AiModelNotAvailable { - get { - return ResourceManager.GetString("Input_AiModelNotAvailable", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to AI feature is disabled by system settings. - /// - public static string Input_AiModelDisabledByUser { - get { - return ResourceManager.GetString("Input_AiModelDisabledByUser", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to AI feature is not supported on this system. - /// - public static string Input_AiModelNotSupported { - get { - return ResourceManager.GetString("Input_AiModelNotSupported", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Downloading AI model... - /// - public static string Input_AiModelDownloading { - get { - return ResourceManager.GetString("Input_AiModelDownloading", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Failed to download AI model. Please try again. - /// - public static string Input_AiModelDownloadFailed { - get { - return ResourceManager.GetString("Input_AiModelDownloadFailed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Download AI Model. - /// - public static string Input_AiModelDownloadButton { - get { - return ResourceManager.GetString("Input_AiModelDownloadButton", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to AI super resolution processing failed: {0}. - /// - public static string Error_AiProcessingFailed { - get { - return ResourceManager.GetString("Error_AiProcessingFailed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Failed to convert image format for AI processing.. - /// - public static string Error_AiConversionFailed { - get { - return ResourceManager.GetString("Error_AiConversionFailed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to AI scaling operation failed.. - /// - public static string Error_AiScalingFailed { - get { - return ResourceManager.GetString("Error_AiScalingFailed", resourceCulture); - } - } - + /// /// Looks up a localized string similar to Large. /// diff --git a/src/modules/imageresizer/ui/Properties/Resources.resx b/src/modules/imageresizer/ui/Properties/Resources.resx index c7067bc0d0..b549e2b06d 100644 --- a/src/modules/imageresizer/ui/Properties/Resources.resx +++ b/src/modules/imageresizer/ui/Properties/Resources.resx @@ -297,7 +297,7 @@ _Make pictures smaller but not larger - AI Super Resolution + Super resolution Unavailable @@ -309,10 +309,10 @@ Scale - Current + Current: - New + New: Checking AI model availability... @@ -333,7 +333,7 @@ Failed to download AI model. Please try again. - Download AI Model + Download AI super resolution processing failed: {0} @@ -344,4 +344,7 @@ AI scaling operation failed. + + Upscale images using on-device AI + \ No newline at end of file diff --git a/src/modules/imageresizer/ui/ViewModels/InputViewModel.cs b/src/modules/imageresizer/ui/ViewModels/InputViewModel.cs index 48128a9f21..c05768d9e0 100644 --- a/src/modules/imageresizer/ui/ViewModels/InputViewModel.cs +++ b/src/modules/imageresizer/ui/ViewModels/InputViewModel.cs @@ -111,8 +111,6 @@ namespace ImageResizer.ViewModels public string AiScaleDisplay => Settings?.AiSize?.ScaleDisplay ?? string.Empty; - public string AiScaleDescription => FormatLabeledSize(Resources.Input_AiScaleLabel, AiScaleDisplay); - public string CurrentResolutionDescription { get => _currentResolutionDescription; @@ -269,16 +267,14 @@ namespace ImageResizer.ViewModels EnsureOriginalDimensionsLoaded(); var hasConcreteSize = _originalWidth.HasValue && _originalHeight.HasValue; - var currentValue = hasConcreteSize + CurrentResolutionDescription = hasConcreteSize ? FormatDimensions(_originalWidth!.Value, _originalHeight!.Value) : Resources.Input_AiUnknownSize; - CurrentResolutionDescription = FormatLabeledSize(Resources.Input_AiCurrentLabel, currentValue); var scale = Settings.AiSize.Scale; - var newValue = hasConcreteSize + NewResolutionDescription = hasConcreteSize ? FormatDimensions((long)_originalWidth!.Value * scale, (long)_originalHeight!.Value * scale) : Resources.Input_AiUnknownSize; - NewResolutionDescription = FormatLabeledSize(Resources.Input_AiNewLabel, newValue); } private static string FormatDimensions(long width, long height) @@ -286,11 +282,6 @@ namespace ImageResizer.ViewModels return string.Format(CultureInfo.CurrentCulture, "{0} × {1}", width, height); } - private static string FormatLabeledSize(string label, string value) - { - return string.Format(CultureInfo.CurrentCulture, "{0}: {1}", label, value); - } - private void EnsureOriginalDimensionsLoaded() { if (_originalDimensionsLoaded) @@ -390,7 +381,6 @@ namespace ImageResizer.ViewModels { OnPropertyChanged(nameof(AiSuperResolutionScale)); OnPropertyChanged(nameof(AiScaleDisplay)); - OnPropertyChanged(nameof(AiScaleDescription)); UpdateAiDetails(); } diff --git a/src/modules/imageresizer/ui/Views/InputPage.xaml b/src/modules/imageresizer/ui/Views/InputPage.xaml index 49964f1572..b45b2a66bd 100644 --- a/src/modules/imageresizer/ui/Views/InputPage.xaml +++ b/src/modules/imageresizer/ui/Views/InputPage.xaml @@ -85,15 +85,30 @@ - - - + + + + + + + + + + + + + + - + @@ -143,7 +158,11 @@ - + + + + + - - - + + + + + + + + + - - - - - - - - - - -