ShareX/ShareX/ApplicationConfig.cs

317 lines
14 KiB
C#
Raw Normal View History

2013-11-03 23:53:49 +13:00
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
2018-01-02 03:59:14 +13:00
Copyright (c) 2007-2018 ShareX Team
2013-11-03 23:53:49 +13:00
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)
2014-12-11 09:25:20 +13:00
using ShareX.HelpersLib;
using ShareX.ScreenCaptureLib;
2014-12-11 12:19:28 +13:00
using ShareX.UploadersLib;
2016-05-15 20:47:30 +12:00
using ShareX.UploadersLib.OtherServices;
2017-06-12 10:21:12 +12:00
using System;
2013-11-03 23:53:49 +13:00
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
2013-11-03 23:53:49 +13:00
namespace ShareX
{
public class ApplicationConfig : SettingsBase<ApplicationConfig>
{
public TaskSettings DefaultTaskSettings = new TaskSettings();
public string FileUploadDefaultDirectory = "";
public int NameParserAutoIncrementNumber = 0;
2016-02-07 07:10:01 +13:00
public List<QuickTaskInfo> QuickTaskPresets = QuickTaskInfo.DefaultPresets;
2013-11-03 23:53:49 +13:00
2014-04-09 12:50:34 +12:00
public ApplicationConfig()
{
this.ApplyDefaultPropertyValues();
}
2013-11-03 23:53:49 +13:00
#region Main Form
public bool ShowMenu = true;
2016-01-30 00:54:35 +13:00
public bool ShowColumns = true;
2014-06-19 07:17:22 +12:00
public ImagePreviewVisibility ImagePreview = ImagePreviewVisibility.Automatic;
public ImagePreviewLocation ImagePreviewLocation = ImagePreviewLocation.Side;
public int PreviewSplitterDistance = 335;
2017-06-12 10:21:12 +12:00
public DateTime NewsLastReadDate;
2013-11-03 23:53:49 +13:00
#endregion Main Form
#region Settings Form
#region General
2014-10-04 02:54:41 +13:00
public SupportedLanguage Language = SupportedLanguage.Automatic;
2013-11-03 23:53:49 +13:00
public bool ShowTray = true;
public bool SilentRun = false;
2013-11-03 23:53:49 +13:00
public bool TrayIconProgressEnabled = true;
public bool TaskbarProgressEnabled = true;
public bool RememberMainFormPosition = false;
public Point MainFormPosition = Point.Empty;
public bool RememberMainFormSize = false;
public Size MainFormSize = Size.Empty;
2013-11-03 23:53:49 +13:00
2016-04-07 04:15:25 +12:00
public HotkeyType TrayLeftClickAction = HotkeyType.RectangleRegion;
public HotkeyType TrayLeftDoubleClickAction = HotkeyType.OpenMainWindow;
public HotkeyType TrayMiddleClickAction = HotkeyType.PrintScreen;
2016-07-31 12:56:03 +12:00
public bool CheckPreReleaseUpdates = false;
2013-11-03 23:53:49 +13:00
#endregion General
#region Paths
public bool UseCustomScreenshotsPath = false;
public string CustomScreenshotsPath = "";
2016-08-20 14:10:34 +12:00
2013-11-03 23:53:49 +13:00
public string SaveImageSubFolderPattern = "%y-%mo";
#endregion Paths
#region Proxy
public ProxyInfo ProxySettings = new ProxyInfo();
#endregion Proxy
#region Upload
public int UploadLimit = 5;
public int BufferSizePower = 5;
public List<ClipboardFormat> ClipboardContentFormats = new List<ClipboardFormat>();
public int MaxUploadFailRetry = 1;
2014-04-13 18:59:18 +12:00
public bool UseSecondaryUploaders = false;
public List<ImageDestination> SecondaryImageUploaders = new List<ImageDestination>();
public List<TextDestination> SecondaryTextUploaders = new List<TextDestination>();
public List<FileDestination> SecondaryFileUploaders = new List<FileDestination>();
2013-11-03 23:53:49 +13:00
#endregion Upload
#region History
public bool HistorySaveTasks = true;
public bool HistoryCheckURL = false;
public RecentTask[] RecentTasks = null;
public bool RecentTasksSave = true;
public int RecentTasksMaxCount = 10;
public bool RecentTasksShowInMainWindow = true;
public bool RecentTasksShowInTrayMenu = true;
public bool RecentTasksTrayMenuMostRecentFirst = false;
public WindowState HistoryWindowState = new WindowState();
public int HistoryMaxItemCount = 0;
public int HistorySplitterDistance = 550;
public WindowState ImageHistoryWindowState = new WindowState();
public int ImageHistoryViewMode = 3;
public Size ImageHistoryThumbnailSize = new Size(150, 150);
#endregion History
2013-11-03 23:53:49 +13:00
#region Print
public bool DontShowPrintSettingsDialog = false;
public PrintSettings PrintSettings = new PrintSettings();
#endregion Print
#region Profiles
public List<VideoEncoder> VideoEncoders = new List<VideoEncoder>();
#endregion Profiles
2013-11-03 23:53:49 +13:00
#region Advanced
[Category("Application"), DefaultValue(false), Description("Calculate and show file sizes in binary units (KiB, MiB etc.)")]
public bool BinaryUnits { get; set; }
2015-10-19 02:18:53 +13:00
[Category("Application"), DefaultValue(false), Description("Show most recent task first in main window.")]
2013-11-03 23:53:49 +13:00
public bool ShowMostRecentTaskFirst { get; set; }
2014-06-07 13:08:34 +12:00
[Category("Application"), DefaultValue(false), Description("Show only customized tasks in main window workflows.")]
public bool WorkflowsOnlyShowEdited { get; set; }
2015-02-16 02:13:40 +13:00
[Category("Application"), DefaultValue(true), Description("Automatically check updates.")]
#if STEAM || WindowsStore
[Browsable(false)]
#endif
public bool AutoCheckUpdate { get; set; }
[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 and hotkeys in main window when task list is empty.")]
2014-11-24 08:04:14 +13:00
public bool ShowMainWindowTip { get; set; }
[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.")]
2015-08-15 11:35:33 +12:00
public int LargeFileSizeWarning { get; set; }
[Category("Application"), DefaultValue(""), Description("URLs will open using this path instead of default browser. Example path: chrome.exe")]
[Editor(typeof(ExeFileNameEditor), typeof(UITypeEditor))]
public string BrowserPath { get; set; }
[Category("Application"), DefaultValue(false), Description("Show version and build info in tray text so if you are running more than one ShareX build you can differentiate them in tray bar.")]
public bool TrayTextMoreInfo { get; set; }
[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; }
2018-05-29 22:08:33 +12:00
[Category("Hotkey"), DefaultValue(false), Description("Disables hotkeys.")]
public bool DisableHotkeys { get; set; }
private int hotkeyRepeatLimit;
[Category("Hotkey"), DefaultValue(1000), Description("If you hold hotkeys then it will only trigger every this milliseconds.")]
public int HotkeyRepeatLimit
{
get
{
return hotkeyRepeatLimit;
}
set
{
hotkeyRepeatLimit = Math.Max(value, 200);
}
}
[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; }
[Category("Upload"), DefaultValue(false), Description("Accept invalid SSL certificates when uploading.")]
public bool AcceptInvalidSSLCertificates { 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; }
2013-11-03 23:53:49 +13:00
2018-06-01 01:27:39 +12:00
[Category("Upload"), DefaultValue(true), Description("Show first time upload warning.")]
public bool ShowUploadWarning { get; set; }
[Category("Upload"), DefaultValue(true), Description("Show more than 10 files upload warning.")]
public bool ShowMultiUploadWarning { 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))]
public string CustomUploadersConfigPath { get; set; }
[Category("Paths"), Description("Custom hotkeys 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))]
public string CustomHotkeysConfigPath { get; set; }
2016-08-20 14:10:34 +12:00
[Category("Paths"), Description("Custom screenshot path (secondary location). If custom screenshot path is temporarily unavailable (e.g. network share), ShareX will use this location (recommended to be a local path).")]
[Editor(typeof(DirectoryNameEditor), typeof(UITypeEditor))]
public string CustomScreenshotsPath2 { get; set; }
2014-04-09 12:50:34 +12:00
[Category("Drag and drop window"), DefaultValue(150), Description("Size of drop window.")]
public int DropSize { get; set; }
[Category("Drag and drop window"), DefaultValue(5), Description("Position offset of drop window.")]
public int DropOffset { get; set; }
[Category("Drag and drop window"), DefaultValue(ContentAlignment.BottomRight), Description("Where drop window will open.")]
public ContentAlignment DropAlignment { get; set; }
[Category("Drag and drop window"), DefaultValue(100), Description("Opacity of drop window.")]
public int DropOpacity { get; set; }
[Category("Drag and drop window"), DefaultValue(255), Description("When you drag file to drop window then opacity will change to this.")]
public int DropHoverOpacity { get; set; }
2013-11-03 23:53:49 +13:00
#endregion Advanced
#endregion Settings Form
#region AutoCapture Form
2014-03-11 22:28:07 +13:00
public Rectangle AutoCaptureRegion = Rectangle.Empty;
2013-11-03 23:53:49 +13:00
public decimal AutoCaptureRepeatTime = 60;
public bool AutoCaptureMinimizeToTray = true;
public bool AutoCaptureWaitUpload = true;
#endregion AutoCapture Form
#region ScreenRecord Form
public Rectangle ScreenRecordRegion = Rectangle.Empty;
#endregion ScreenRecord Form
2015-02-17 22:17:11 +13:00
#region Webpage Capture Form
public WebpageCaptureOptions WebpageCaptureOptions = new WebpageCaptureOptions();
#endregion Webpage Capture Form
2016-05-15 20:47:30 +12:00
#region OCR Form
public OCRSpaceLanguages OCRLanguage = OCRSpaceLanguages.eng;
#endregion OCR Form
#region Actions toolbar
public List<HotkeyType> ActionsToolbarList = new List<HotkeyType>() { HotkeyType.RectangleRegion, HotkeyType.PrintScreen, HotkeyType.ScreenRecorder,
2017-01-26 02:16:17 +13:00
HotkeyType.None, HotkeyType.FileUpload, HotkeyType.ClipboardUploadWithContentViewer };
2017-01-20 01:39:10 +13:00
public bool ActionsToolbarRunAtStartup = false;
public Point ActionsToolbarPosition = Point.Empty;
public bool ActionsToolbarLockPosition = false;
public bool ActionsToolbarStayTopMost = true;
#endregion Actions toolbar
2018-04-24 22:46:12 +12:00
#region Color Picker Form
public List<Color> RecentColors = new List<Color>();
#endregion Color Picker Form
2013-11-03 23:53:49 +13:00
}
}