Flow.Launcher/Flow.Launcher.Infrastructure/UserSettings/Settings.cs

116 lines
4.1 KiB
C#
Raw Permalink Normal View History

2019-08-13 10:02:26 +00:00
using System;
using System.Collections.ObjectModel;
2015-10-30 23:17:34 +00:00
using System.Drawing;
using System.Text.Json.Serialization;
2020-04-21 09:12:17 +00:00
using Flow.Launcher.Plugin;
2021-01-26 07:01:39 +00:00
using Flow.Launcher.Plugin.SharedModels;
2020-04-21 09:12:17 +00:00
namespace Flow.Launcher.Infrastructure.UserSettings
{
public class Settings : BaseModel
{
private string language = "en";
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
public bool ShowOpenResultHotkey { get; set; } = true;
public string Language
{
get => language; set
{
language = value;
OnPropertyChanged();
}
}
2020-05-07 04:30:55 +00:00
public string Theme { get; set; } = Constant.DefaultTheme;
public bool UseDropShadowEffect { get; set; } = false;
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-15 22:34:27 +00:00
/// <summary>
/// when false Alphabet static service will always return empty results
/// </summary>
public bool ShouldUsePinyin { get; set; } = false;
2019-11-15 22:34:27 +00:00
internal SearchPrecisionScore QuerySearchPrecision { get; private set; } = SearchPrecisionScore.Regular;
2020-01-24 22:12:32 +00:00
[JsonIgnore]
public string QuerySearchPrecisionString
{
get { return QuerySearchPrecision.ToString(); }
set
{
try
{
var precisionScore = (SearchPrecisionScore)Enum
.Parse(typeof(SearchPrecisionScore), value);
QuerySearchPrecision = precisionScore;
StringMatcher.Instance.UserSettingSearchPrecision = precisionScore;
}
catch (ArgumentException e)
{
Logger.Log.Exception(nameof(Settings), "Failed to load QuerySearchPrecisionString value from Settings file", e);
QuerySearchPrecision = SearchPrecisionScore.Regular;
StringMatcher.Instance.UserSettingSearchPrecision = SearchPrecisionScore.Regular;
throw;
}
}
}
2019-08-13 10:02:26 +00:00
public bool AutoUpdates { get; set; } = false;
2016-05-12 02:01:33 +00:00
2014-06-16 06:06:24 +00:00
public double WindowLeft { get; set; }
public double WindowTop { get; set; }
public int MaxResultsToShow { get; set; } = 5;
public int ActivateTimes { get; set; }
2014-06-16 06:06:24 +00:00
public ObservableCollection<CustomPluginHotkey> CustomPluginHotkeys { get; set; } = new ObservableCollection<CustomPluginHotkey>();
2014-03-23 08:17:41 +00:00
public bool DontPromptUpdateMsg { get; set; }
public bool EnableUpdateLog { get; set; }
2020-04-21 12:16:10 +00:00
public bool StartFlowLauncherOnSystemStartup { get; set; } = true;
public bool HideOnStartup { get; set; }
2018-12-19 03:46:27 +00:00
bool _hideNotifyIcon { get; set; }
public bool HideNotifyIcon
{
get { return _hideNotifyIcon; }
set
{
_hideNotifyIcon = value;
OnPropertyChanged();
}
}
public bool LeaveCmdOpen { get; set; }
2019-10-23 21:20:12 +00:00
public bool HideWhenDeactive { get; set; } = true;
2015-02-20 13:45:42 +00:00
public bool RememberLastLaunchLocation { get; set; }
public bool IgnoreHotkeysOnFullscreen { get; set; }
2016-06-19 15:18:43 +00:00
public HttpProxy Proxy { get; set; } = new HttpProxy();
[JsonConverter(typeof(JsonStringEnumConverter))]
public LastQueryMode LastQueryMode { get; set; } = LastQueryMode.Selected;
2021-01-07 08:52:05 +00:00
// This needs to be loaded last by staying at the bottom
public PluginsSettings PluginSettings { get; set; } = new PluginsSettings();
}
public enum LastQueryMode
{
Selected,
Empty,
Preserved
2014-03-26 09:34:19 +00:00
}
2015-07-17 07:08:39 +00:00
}