Added "Image beautifier" hotkey

This commit is contained in:
Jaex 2023-05-10 13:06:42 +03:00
parent 7d46061ed3
commit 72f2058531
6 changed files with 25 additions and 52 deletions

View file

@ -1425,6 +1425,15 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Image beautifier.
/// </summary>
internal static string HotkeyType_ImageBeautifier {
get {
return ResourceManager.GetString("HotkeyType_ImageBeautifier", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Image combiner.
/// </summary>

View file

@ -1310,4 +1310,7 @@ Would you like to download and install it?</value>
<data name="ShapeType_DrawingFreehandArrow" xml:space="preserve">
<value>Freehand arrow</value>
</data>
<data name="HotkeyType_ImageBeautifier" xml:space="preserve">
<value>Image beautifier</value>
</data>
</root>

View file

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

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#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);
}
}
}

View file

@ -297,7 +297,6 @@
<Compile Include="Forms\ActionsToolbarForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="HotkeyTypeEnumConverter.cs" />
<Compile Include="IntegrationHelpers.cs" />
<Compile Include="QuickTaskInfo.cs" />
<Compile Include="QuickTaskMenu.cs" />

View file

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