-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettings.cs
72 lines (68 loc) · 2.56 KB
/
Settings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using System.Collections.Generic;
using System.Linq;
using Community.PowerToys.Run.Plugin.TabPort.Properties;
using Microsoft.PowerToys.Settings.UI.Library;
namespace Community.PowerToys.Run.Plugin.TabPort;
public class Settings
{
public int Port { get; set; } = 8899;
public string CustomFaviconDbPath { get; set; }
public double TitleWeight { get; set; } = 1;
public double UrlWeight { get; set; } = 0;
public FaviconDbPathPriorityItem FaviconDbPathPriority { get; set; }
public enum FaviconDbPathPriorityItem
{
Chrome,
Edge,
Firefox,
Opera
}
public IEnumerable<PluginAdditionalOption> AdditionalOptions =>
[
new()
{
Key = nameof(Port),
DisplayDescription = Resources.custom_port_description,
DisplayLabel = Resources.custom_port,
PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Numberbox,
NumberValue = Port
},
new()
{
Key = nameof(TitleWeight),
DisplayDescription = Resources.title_weight_description,
DisplayLabel = Resources.title_weight,
PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Numberbox,
NumberValue = TitleWeight
},
new()
{
Key = nameof(UrlWeight),
DisplayDescription = Resources.url_weight_description,
DisplayLabel = Resources.url_weight,
PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Numberbox,
NumberValue = UrlWeight
},
new()
{
Key = nameof(FaviconDbPathPriority),
DisplayDescription = Resources.favicon_db_path_priority_description,
DisplayLabel = Resources.favicon_db_path_priority,
PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Combobox,
ComboBoxItems = Enum.GetValues(typeof(FaviconDbPathPriorityItem)).Cast<int>()
.Select(v =>
new KeyValuePair<string, string>(((FaviconDbPathPriorityItem)v).ToString(), v + string.Empty))
.ToList(),
ComboBoxValue = (int)FaviconDbPathPriority
},
new()
{
Key = nameof(CustomFaviconDbPath),
DisplayDescription = Resources.custom_favicon_db_path_description,
DisplayLabel = Resources.custom_favicon_db_path,
PluginOptionType = PluginAdditionalOption.AdditionalOptionType.Textbox,
TextValue = CustomFaviconDbPath
}
];
}