PowerToys/Wox.Infrastructure/UserSettings/Settings.cs

121 lines
4.1 KiB
C#
Raw Normal View History

2019-08-13 18:02:26 +08:00
using System;
using System.Collections.ObjectModel;
2015-10-31 07:17:34 +08:00
using System.Drawing;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Wox.Plugin;
2016-06-19 23:18:43 +08:00
namespace Wox.Infrastructure.UserSettings
{
public class Settings : BaseModel
{
public string Hotkey { get; set; } = "Alt + Space";
public string Language { get; set; } = "en";
public string Theme { get; set; } = "Dark";
public string QueryBoxFont { get; set; } = FontFamily.GenericSansSerif.Name;
public string QueryBoxFontStyle { get; set; }
public string QueryBoxFontWeight { get; set; }
public string QueryBoxFontStretch { get; set; }
public string ResultFont { get; set; } = FontFamily.GenericSansSerif.Name;
public string ResultFontStyle { get; set; }
public string ResultFontWeight { get; set; }
public string ResultFontStretch { get; set; }
2019-11-16 06:34:27 +08:00
/// <summary>
/// when false Alphabet static service will always return empty results
/// </summary>
private bool _shouldUsePinyin = true;
public bool ShouldUsePinyin
{
get { return _shouldUsePinyin; }
set
{
_shouldUsePinyin = value;
StringMatcher.ShouldUsePinyin = value;
}
}
2019-11-16 06:34:27 +08:00
internal StringMatcher.SearchPrecisionScore QuerySearchPrecision { get; private set; } = StringMatcher.SearchPrecisionScore.Regular;
public string QuerySearchPrecisionString
{
get { return QuerySearchPrecision.ToString(); }
set
{
try
{
var precisionScore = (StringMatcher.SearchPrecisionScore)Enum.Parse(
typeof(StringMatcher.SearchPrecisionScore),
value);
QuerySearchPrecision = precisionScore;
StringMatcher.UserSettingSearchPrecision = (int)precisionScore;
}
catch (System.Exception e)
{
// what do we do here?!
Logger.Log.Exception(nameof(Settings), "Fail to set QuerySearchPrecision", e);
throw;
}
}
}
2019-08-13 18:02:26 +08:00
public bool AutoUpdates { get; set; } = false;
2016-05-12 10:01:33 +08:00
2014-06-16 14:06:24 +08:00
public double WindowLeft { get; set; }
public double WindowTop { get; set; }
public int MaxResultsToShow { get; set; } = 6;
public int ActivateTimes { get; set; }
2014-06-16 14:06:24 +08:00
// Order defaults to 0 or -1, so 1 will let this property appear last
[JsonProperty(Order = 1)]
public PluginsSettings PluginSettings { get; set; } = new PluginsSettings();
public ObservableCollection<CustomPluginHotkey> CustomPluginHotkeys { get; set; } = new ObservableCollection<CustomPluginHotkey>();
2014-03-23 16:17:41 +08:00
[Obsolete]
public double Opacity { get; set; } = 1;
2014-03-26 17:34:19 +08:00
[Obsolete]
public OpacityMode OpacityMode { get; set; } = OpacityMode.Normal;
2014-03-26 17:34:19 +08:00
public bool DontPromptUpdateMsg { get; set; }
public bool EnableUpdateLog { get; set; }
2016-05-19 02:35:34 +08:00
public bool StartWoxOnSystemStartup { get; set; } = true;
public bool HideOnStartup { get; set; }
2018-12-19 11:46:27 +08:00
bool _hideNotifyIcon { get; set; }
public bool HideNotifyIcon
{
get { return _hideNotifyIcon; }
set
{
_hideNotifyIcon = value;
OnPropertyChanged();
}
}
public bool LeaveCmdOpen { get; set; }
2019-10-24 05:20:12 +08:00
public bool HideWhenDeactive { get; set; } = true;
2015-02-20 21:45:42 +08:00
public bool RememberLastLaunchLocation { get; set; }
public bool IgnoreHotkeysOnFullscreen { get; set; }
2016-06-19 23:18:43 +08:00
public HttpProxy Proxy { get; set; } = new HttpProxy();
[JsonConverter(typeof(StringEnumConverter))]
public LastQueryMode LastQueryMode { get; set; } = LastQueryMode.Selected;
}
public enum LastQueryMode
{
Selected,
Empty,
Preserved
2014-03-26 17:34:19 +08:00
}
[Obsolete]
2014-03-26 17:34:19 +08:00
public enum OpacityMode
{
Normal = 0,
LayeredWindow = 1,
DWM = 2
}
2015-07-17 15:08:39 +08:00
}