From 72f20585319ccf7c4a0c6f938cf26f7171f0d55a Mon Sep 17 00:00:00 2001 From: Jaex Date: Wed, 10 May 2023 13:06:42 +0300 Subject: [PATCH] Added "Image beautifier" hotkey --- .../Properties/Resources.Designer.cs | 9 ++++ ShareX.HelpersLib/Properties/Resources.resx | 3 ++ ShareX/Enums.cs | 4 +- ShareX/HotkeyTypeEnumConverter.cs | 49 ------------------- ShareX/ShareX.csproj | 1 - ShareX/TaskHelpers.cs | 11 +++++ 6 files changed, 25 insertions(+), 52 deletions(-) delete mode 100644 ShareX/HotkeyTypeEnumConverter.cs diff --git a/ShareX.HelpersLib/Properties/Resources.Designer.cs b/ShareX.HelpersLib/Properties/Resources.Designer.cs index ec347e5b6..0b1f804d7 100644 --- a/ShareX.HelpersLib/Properties/Resources.Designer.cs +++ b/ShareX.HelpersLib/Properties/Resources.Designer.cs @@ -1425,6 +1425,15 @@ internal class Resources { } } + /// + /// Looks up a localized string similar to Image beautifier. + /// + internal static string HotkeyType_ImageBeautifier { + get { + return ResourceManager.GetString("HotkeyType_ImageBeautifier", resourceCulture); + } + } + /// /// Looks up a localized string similar to Image combiner. /// diff --git a/ShareX.HelpersLib/Properties/Resources.resx b/ShareX.HelpersLib/Properties/Resources.resx index c87a2e08e..ae648e376 100644 --- a/ShareX.HelpersLib/Properties/Resources.resx +++ b/ShareX.HelpersLib/Properties/Resources.resx @@ -1310,4 +1310,7 @@ Would you like to download and install it? Freehand arrow + + Image beautifier + \ No newline at end of file diff --git a/ShareX/Enums.cs b/ShareX/Enums.cs index 9f5d9f606..d35751752 100644 --- a/ShareX/Enums.cs +++ b/ShareX/Enums.cs @@ -23,7 +23,6 @@ #endregion License Information (GPL v3) -using Newtonsoft.Json; using ShareX.HelpersLib; using System; using System.ComponentModel; @@ -175,7 +174,6 @@ public enum ScreenRecordStartMethod LastRegion } - [JsonConverter(typeof(HotkeyTypeEnumConverter))] public enum HotkeyType // Localized { None, @@ -264,6 +262,8 @@ public enum HotkeyType // Localized [Category(EnumExtensions.HotkeyType_Category_Tools)] ImageEditor, [Category(EnumExtensions.HotkeyType_Category_Tools)] + ImageBeautifier, + [Category(EnumExtensions.HotkeyType_Category_Tools)] ImageEffects, [Category(EnumExtensions.HotkeyType_Category_Tools)] ImageViewer, diff --git a/ShareX/HotkeyTypeEnumConverter.cs b/ShareX/HotkeyTypeEnumConverter.cs deleted file mode 100644 index 659589c8a..000000000 --- a/ShareX/HotkeyTypeEnumConverter.cs +++ /dev/null @@ -1,49 +0,0 @@ -#region License Information (GPL v3) - -/* - ShareX - A program that allows you to take screenshots and share any file type - Copyright (c) 2007-2023 ShareX Team - - 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 2 - 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Optionally you can also view the license at . -*/ - -#endregion License Information (GPL v3) - -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using System; - -namespace ShareX -{ - internal class HotkeyTypeEnumConverter : StringEnumConverter - { - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType == JsonToken.String) - { - string enumText = reader.Value.ToString(); - - if (!string.IsNullOrEmpty(enumText) && enumText.Equals("WindowRectangle")) - { - return HotkeyType.RectangleRegion; - } - } - - return base.ReadJson(reader, objectType, existingValue, serializer); - } - } -} \ No newline at end of file diff --git a/ShareX/ShareX.csproj b/ShareX/ShareX.csproj index e9a56143e..0278be63f 100644 --- a/ShareX/ShareX.csproj +++ b/ShareX/ShareX.csproj @@ -297,7 +297,6 @@ Form - diff --git a/ShareX/TaskHelpers.cs b/ShareX/TaskHelpers.cs index 7aed050b2..df277cb9b 100644 --- a/ShareX/TaskHelpers.cs +++ b/ShareX/TaskHelpers.cs @@ -203,6 +203,16 @@ public static async Task ExecuteJob(TaskSettings taskSettings, HotkeyType job, C OpenImageEditor(safeTaskSettings); } break; + case HotkeyType.ImageBeautifier: + if (command != null && !string.IsNullOrEmpty(command.Parameter) && File.Exists(command.Parameter)) + { + OpenImageBeautifier(command.Parameter, safeTaskSettings); + } + else + { + OpenImageBeautifier(safeTaskSettings); + } + break; case HotkeyType.ImageEffects: if (command != null && !string.IsNullOrEmpty(command.Parameter) && File.Exists(command.Parameter)) { @@ -1673,6 +1683,7 @@ public static void OpenCustomUploaderSettingsWindow() case HotkeyType.PinToScreenFromClipboard: return Resources.pin; case HotkeyType.PinToScreenFromFile: return Resources.pin; case HotkeyType.ImageEditor: return Resources.image_pencil; + case HotkeyType.ImageBeautifier: return Resources.picture_sunset; case HotkeyType.ImageEffects: return Resources.image_saturation; case HotkeyType.ImageViewer: return Resources.images_flickr; case HotkeyType.ImageCombiner: return Resources.document_break;