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