From b3c8201c8aa77e4807bba4e5702b5ec0a655b316 Mon Sep 17 00:00:00 2001 From: Jaex Date: Fri, 22 Dec 2017 13:59:52 +0300 Subject: [PATCH] Added RotateImageByExifOrientationData option to application settings advanced tab --- ShareX.HelpersLib/Helpers/ImageHelpers.cs | 7 +++- ShareX.HelpersLib/HelpersOptions.cs | 1 + ShareX/ApplicationConfig.cs | 41 +++++++++++++---------- ShareX/Forms/MainForm.cs | 1 + 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/ShareX.HelpersLib/Helpers/ImageHelpers.cs b/ShareX.HelpersLib/Helpers/ImageHelpers.cs index a2bf96596..704087f12 100644 --- a/ShareX.HelpersLib/Helpers/ImageHelpers.cs +++ b/ShareX.HelpersLib/Helpers/ImageHelpers.cs @@ -1552,7 +1552,12 @@ public static Image LoadImage(string filePath) if (!string.IsNullOrEmpty(filePath) && Helpers.IsImageFile(filePath) && File.Exists(filePath)) { Image img = Image.FromStream(new MemoryStream(File.ReadAllBytes(filePath))); - RotateImageByExifOrientationData(img); + + if (HelpersOptions.RotateImageByExifOrientationData) + { + RotateImageByExifOrientationData(img); + } + return img; } } diff --git a/ShareX.HelpersLib/HelpersOptions.cs b/ShareX.HelpersLib/HelpersOptions.cs index 3473ea0d0..81f84b1c0 100644 --- a/ShareX.HelpersLib/HelpersOptions.cs +++ b/ShareX.HelpersLib/HelpersOptions.cs @@ -32,6 +32,7 @@ public static class HelpersOptions public static bool DefaultCopyImageFillBackground = true; public static bool UseAlternativeCopyImage = true; public static bool UseAlternativeGetImage = true; + public static bool RotateImageByExifOrientationData = true; public static string BrowserPath = null; } } \ No newline at end of file diff --git a/ShareX/ApplicationConfig.cs b/ShareX/ApplicationConfig.cs index d59175f49..334644629 100644 --- a/ShareX/ApplicationConfig.cs +++ b/ShareX/ApplicationConfig.cs @@ -45,8 +45,6 @@ public class ApplicationConfig : SettingsBase public int NameParserAutoIncrementNumber = 0; public bool DisableHotkeys = false; public List QuickTaskPresets = QuickTaskInfo.DefaultPresets; - public bool ShowPatreonButton { get; set; } = true; - public bool ShowDiscordButton { get; set; } = true; public ApplicationConfig() { @@ -167,15 +165,6 @@ public ApplicationConfig() [Category("Application"), DefaultValue(false), Description("Show most recent task first in main window.")] public bool ShowMostRecentTaskFirst { get; set; } - [Category("Application"), DefaultValue(true), Description("Default .NET method can't copy image with alpha channel to clipboard. Alternatively, when this setting is false, ShareX copies \"PNG\" and 32 bit \"DIB\" to clipboard in order to retain image transparency. If you are experiencing issues then set this setting to true to use the default .NET method.")] - public bool UseDefaultClipboardCopyImage { get; set; } - - [Category("Application"), DefaultValue(true), Description("Default .NET method can't get image with alpha channel from clipboard. Alternatively, when this setting is false, ShareX checks if clipboard contains \"PNG\" or 32 bit \"DIB\" in order to retain image transparency. If you are experiencing issues then set this setting to true to use the default .NET method.")] - public bool UseDefaultClipboardGetImage { get; set; } - - [Category("Application"), DefaultValue(true), Description("Because default .NET image copying not supports alpha channel, background of image will be black. This option will fill background white.")] - public bool DefaultClipboardCopyImageFillBackground { get; set; } - [Category("Application"), DefaultValue(false), Description("Show only customized tasks in main window workflows.")] public bool WorkflowsOnlyShowEdited { get; set; } @@ -188,10 +177,16 @@ public ApplicationConfig() [Category("Application"), DefaultValue(true), Description("Automatically expand capture menu when you open the tray menu.")] public bool TrayAutoExpandCaptureMenu { get; set; } - [Category("Application"), DefaultValue(true), Description("Show tips in main window list when list is empty.")] + [Category("Application"), DefaultValue(true), Description("Show tips and hotkeys in main window when task list is empty.")] public bool ShowMainWindowTip { get; set; } - [Category("Application"), DefaultValue(100), Description("Large file size defined in MiB or MB. ShareX will warn before uploading large files. 0 disables this feature.")] + [Category("Application"), DefaultValue(true), Description("Show Patreon button in main window when task list is empty.")] + public bool ShowPatreonButton { get; set; } + + [Category("Application"), DefaultValue(true), Description("Show Discord button in main window when task list is empty.")] + public bool ShowDiscordButton { get; set; } + + [Category("Application"), DefaultValue(100), Description("Large file size defined in MB. ShareX will warn before uploading large files. 0 disables this feature.")] public int LargeFileSizeWarning { get; set; } [Category("Application"), DefaultValue(""), Description("URLs will open using this path instead of default browser. Example path: chrome.exe")] @@ -204,8 +199,20 @@ public ApplicationConfig() [Category("Application"), DefaultValue(true), Description("Save settings after task completed but only if there is no other active tasks. This setting will be handy for situations where setting save fails when Windows shutdown and not let ShareX to save in time.")] public bool SaveSettingsAfterTaskCompleted { get; set; } - [Category("Application"), DefaultValue(false), Description("Writes verbose web request logs to \"{PersonalFolder}\\Logs\\ShareX-Request-Logs.txt\" file for debugging purposes.")] - public bool VerboseRequestLogs { get; set; } + [Category("Clipboard"), DefaultValue(true), Description("Show clipboard content viewer when using clipboard upload in main window.")] + public bool ShowClipboardContentViewer { get; set; } + + [Category("Clipboard"), DefaultValue(true), Description("Default .NET method can't copy image with alpha channel to clipboard. Alternatively, when this setting is false, ShareX copies \"PNG\" and 32 bit \"DIB\" to clipboard in order to retain image transparency. If you are experiencing issues then set this setting to true to use the default .NET method.")] + public bool UseDefaultClipboardCopyImage { get; set; } + + [Category("Clipboard"), DefaultValue(true), Description("Default .NET method can't get image with alpha channel from clipboard. Alternatively, when this setting is false, ShareX checks if clipboard contains \"PNG\" or 32 bit \"DIB\" in order to retain image transparency. If you are experiencing issues then set this setting to true to use the default .NET method.")] + public bool UseDefaultClipboardGetImage { get; set; } + + [Category("Clipboard"), DefaultValue(true), Description("Because default .NET image copying not supports alpha channel, background of image will be black. This option will fill background white.")] + public bool DefaultClipboardCopyImageFillBackground { get; set; } + + [Category("Image"), DefaultValue(true), Description("If JPEG exif contains orientation data then rotate image accordingly.")] + public bool RotateImageByExifOrientationData { get; set; } [Category("Upload"), DefaultValue(false), Description("Can be used to disable uploading application wide.")] public bool DisableUpload { get; set; } @@ -213,8 +220,8 @@ public ApplicationConfig() [Category("Upload"), DefaultValue(false), Description("Accept invalid SSL certificates when uploading.")] public bool AcceptInvalidSSLCertificates { get; set; } - [Category("Clipboard upload"), DefaultValue(true), Description("Show clipboard content viewer when using clipboard upload in main window.")] - public bool ShowClipboardContentViewer { get; set; } + [Category("Upload"), DefaultValue(false), Description("Writes verbose web request logs to \"{PersonalFolder}\\Logs\\ShareX-Request-Logs.txt\" file for debugging purposes.")] + public bool VerboseRequestLogs { get; set; } [Category("Paths"), Description("Custom uploaders configuration path. If you have already configured this setting in another device and you are attempting to use the same location, then backup the file before configuring this setting and restore after exiting ShareX.")] [Editor(typeof(DirectoryNameEditor), typeof(UITypeEditor))] diff --git a/ShareX/Forms/MainForm.cs b/ShareX/Forms/MainForm.cs index 28de8b3bf..0f15e1af9 100644 --- a/ShareX/Forms/MainForm.cs +++ b/ShareX/Forms/MainForm.cs @@ -707,6 +707,7 @@ private void AfterSettingsJobs() HelpersOptions.UseAlternativeCopyImage = !Program.Settings.UseDefaultClipboardCopyImage; HelpersOptions.UseAlternativeGetImage = !Program.Settings.UseDefaultClipboardGetImage; HelpersOptions.DefaultCopyImageFillBackground = Program.Settings.DefaultClipboardCopyImageFillBackground; + HelpersOptions.RotateImageByExifOrientationData = Program.Settings.RotateImageByExifOrientationData; HelpersOptions.BrowserPath = Program.Settings.BrowserPath; TaskManager.RecentManager.MaxCount = Program.Settings.RecentTasksMaxCount;