Skip to content

Commit 6c1730e

Browse files
committed
Merge Dev
2 parents dd1f439 + 424b575 commit 6c1730e

File tree

11 files changed

+179
-35
lines changed

11 files changed

+179
-35
lines changed

Flow.Launcher.Core/Resource/Theme.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public class Theme
4545
private string DirectoryPath => Path.Combine(Constant.ProgramDirectory, Folder);
4646
private string UserDirectoryPath => Path.Combine(DataLocation.DataDirectory(), Folder);
4747

48+
public string CurrentTheme => _settings.Theme;
49+
4850
public bool BlurEnabled { get; set; }
4951

5052
private double mainWindowWidth;

Flow.Launcher/Languages/en.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@
308308
<system:String x:Key="userdatapath">User Data Location</system:String>
309309
<system:String x:Key="userdatapathToolTip">User settings and installed plugins are saved in the user data folder. This location may vary depending on whether it's in portable mode or not.</system:String>
310310
<system:String x:Key="userdatapathButton">Open Folder</system:String>
311+
<system:String x:Key="logLevel">Log Level</system:String>
312+
<system:String x:Key="LogLevelDEBUG">Debug</system:String>
313+
<system:String x:Key="LogLevelINFO">Info</system:String>
311314

312315
<!-- FileManager Setting Dialog -->
313316
<system:String x:Key="fileManagerWindow">Select File Manager</system:String>

Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Flow.Launcher.Core;
99
using Flow.Launcher.Core.Resource;
1010
using Flow.Launcher.Infrastructure;
11+
using Flow.Launcher.Infrastructure.Logger;
1112
using Flow.Launcher.Infrastructure.UserSettings;
1213
using Flow.Launcher.Plugin;
1314

@@ -45,10 +46,35 @@ public string LogFolderSize
4546
_settings.ActivateTimes
4647
);
4748

49+
public class LogLevelData : DropdownDataGeneric<LOGLEVEL> { }
50+
51+
public List<LogLevelData> LogLevels { get; } =
52+
DropdownDataGeneric<LOGLEVEL>.GetValues<LogLevelData>("LogLevel");
53+
54+
public LOGLEVEL LogLevel
55+
{
56+
get => _settings.LogLevel;
57+
set
58+
{
59+
if (_settings.LogLevel != value)
60+
{
61+
_settings.LogLevel = value;
62+
63+
Log.SetLogLevel(value);
64+
}
65+
}
66+
}
67+
4868
public SettingsPaneAboutViewModel(Settings settings, Updater updater)
4969
{
5070
_settings = settings;
5171
_updater = updater;
72+
UpdateEnumDropdownLocalizations();
73+
}
74+
75+
private void UpdateEnumDropdownLocalizations()
76+
{
77+
DropdownDataGeneric<LOGLEVEL>.UpdateLabels(LogLevels);
5278
}
5379

5480
[RelayCommand]
@@ -138,5 +164,4 @@ private static string BytesToReadableString(long bytes)
138164

139165
return "0 B";
140166
}
141-
142167
}

Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
43
using System.Windows.Forms;
54
using CommunityToolkit.Mvvm.Input;
65
using Flow.Launcher.Core;
76
using Flow.Launcher.Core.Configuration;
87
using Flow.Launcher.Core.Resource;
98
using Flow.Launcher.Helper;
10-
using Flow.Launcher.Infrastructure.Logger;
119
using Flow.Launcher.Infrastructure.UserSettings;
1210
using Flow.Launcher.Plugin;
1311
using Flow.Launcher.Plugin.SharedModels;
@@ -32,7 +30,6 @@ public class SearchWindowScreenData : DropdownDataGeneric<SearchWindowScreens> {
3230
public class SearchWindowAlignData : DropdownDataGeneric<SearchWindowAligns> { }
3331
public class SearchPrecisionData : DropdownDataGeneric<SearchPrecisionScore> { }
3432
public class LastQueryModeData : DropdownDataGeneric<LastQueryMode> { }
35-
public class LogLevelData : DropdownDataGeneric<LOGLEVEL> { }
3633

3734
public bool StartFlowLauncherOnSystemStartup
3835
{
@@ -145,16 +142,12 @@ public bool PortableMode
145142
public List<LastQueryModeData> LastQueryModes { get; } =
146143
DropdownDataGeneric<LastQueryMode>.GetValues<LastQueryModeData>("LastQuery");
147144

148-
public List<LogLevelData> LogLevels { get; } =
149-
DropdownDataGeneric<LOGLEVEL>.GetValues<LogLevelData>("LogLevel");
150-
151145
private void UpdateEnumDropdownLocalizations()
152146
{
153147
DropdownDataGeneric<SearchWindowScreens>.UpdateLabels(SearchWindowScreens);
154148
DropdownDataGeneric<SearchWindowAligns>.UpdateLabels(SearchWindowAligns);
155149
DropdownDataGeneric<SearchPrecisionScore>.UpdateLabels(SearchPrecisionScores);
156150
DropdownDataGeneric<LastQueryMode>.UpdateLabels(LastQueryModes);
157-
DropdownDataGeneric<LOGLEVEL>.UpdateLabels(LogLevels);
158151
}
159152

160153
public string Language
@@ -222,22 +215,6 @@ public bool AutoUpdates
222215
}
223216
}
224217

225-
public LOGLEVEL LogLevel
226-
{
227-
get => Settings.LogLevel;
228-
set
229-
{
230-
if (Settings.LogLevel != value)
231-
{
232-
Settings.LogLevel = value;
233-
234-
Log.SetLogLevel(value);
235-
236-
UpdateEnumDropdownLocalizations();
237-
}
238-
}
239-
}
240-
241218
[RelayCommand]
242219
private void SelectPython()
243220
{

Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@
123123
</StackPanel>
124124
</cc:Card>
125125

126+
<cc:Card Title="{DynamicResource logLevel}" Icon="&#xE749;">
127+
<ComboBox
128+
DisplayMemberPath="Display"
129+
ItemsSource="{Binding LogLevels}"
130+
SelectedValue="{Binding LogLevel}"
131+
SelectedValuePath="Value" />
132+
</cc:Card>
133+
126134
<TextBlock
127135
Margin="14 20 0 0"
128136
HorizontalAlignment="Center"

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,6 @@
278278
SelectedValue="{Binding Language}"
279279
SelectedValuePath="LanguageCode" />
280280
</cc:Card>
281-
282-
<cc:Card Title="{DynamicResource logLevel}" Margin="0 14 0 0">
283-
<ComboBox
284-
DisplayMemberPath="Display"
285-
ItemsSource="{Binding LogLevels}"
286-
SelectedValue="{Binding LogLevel}"
287-
SelectedValuePath="Value" />
288-
</cc:Card>
289281
</VirtualizingStackPanel>
290282
</ScrollViewer>
291283
</ui:Page>

Plugins/Flow.Launcher.Plugin.Sys/Flow.Launcher.Plugin.Sys.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<ItemGroup>
4040
<ProjectReference Include="..\..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
4141
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
42+
<ProjectReference Include="..\..\Flow.Launcher.Core\Flow.Launcher.Core.csproj" />
4243
</ItemGroup>
4344

4445
<ItemGroup>
6.47 KB
Loading

Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<system:String x:Key="flowlauncher_plugin_sys_open_docs_tips_cmd">Flow Launcher Tips</system:String>
2828
<system:String x:Key="flowlauncher_plugin_sys_open_userdata_location_cmd">Flow Launcher UserData Folder</system:String>
2929
<system:String x:Key="flowlauncher_plugin_sys_toggle_game_mode_cmd">Toggle Game Mode</system:String>
30+
<system:String x:Key="flowlauncher_plugin_sys_theme_selector_cmd">Set the Flow Launcher Theme</system:String>
3031

3132
<!-- Command Descriptions -->
3233
<system:String x:Key="flowlauncher_plugin_sys_shutdown_computer">Shutdown Computer</system:String>
@@ -49,8 +50,9 @@
4950
<system:String x:Key="flowlauncher_plugin_sys_open_docs_tips">Visit Flow Launcher's documentation for more help and how to use tips</system:String>
5051
<system:String x:Key="flowlauncher_plugin_sys_open_userdata_location">Open the location where Flow Launcher's settings are stored</system:String>
5152
<system:String x:Key="flowlauncher_plugin_sys_toggle_game_mode">Toggle Game Mode</system:String>
53+
<system:String x:Key="flowlauncher_plugin_sys_theme_selector">Quickly change the Flow Launcher theme</system:String>
5254

53-
<!-- Dialogs -->
55+
<!-- Dialogs -->
5456
<system:String x:Key="flowlauncher_plugin_sys_dlgtitle_success">Success</system:String>
5557
<system:String x:Key="flowlauncher_plugin_sys_dlgtext_all_settings_saved">All Flow Launcher settings saved</system:String>
5658
<system:String x:Key="flowlauncher_plugin_sys_dlgtext_all_applicableplugins_reloaded">Reloaded all applicable plugin data</system:String>

Plugins/Flow.Launcher.Plugin.Sys/Main.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using Flow.Launcher.Infrastructure;
88
using Flow.Launcher.Infrastructure.Logger;
99
using Flow.Launcher.Infrastructure.UserSettings;
10-
using Flow.Launcher.Plugin.SharedCommands;
1110
using Windows.Win32;
1211
using Windows.Win32.Foundation;
1312
using Windows.Win32.Security;
@@ -20,6 +19,7 @@ namespace Flow.Launcher.Plugin.Sys
2019
public class Main : IPlugin, ISettingProvider, IPluginI18n
2120
{
2221
private PluginInitContext context;
22+
private ThemeSelector themeSelector;
2323
private Dictionary<string, string> KeywordTitleMappings = new Dictionary<string, string>();
2424

2525
// SHTDN_REASON_MAJOR_OTHER indicates a generic shutdown reason that isn't categorized under hardware failure, software updates, or other predefined reasons.
@@ -34,6 +34,11 @@ public Control CreateSettingPanel()
3434

3535
public List<Result> Query(Query query)
3636
{
37+
if(query.Search.StartsWith(ThemeSelector.Keyword))
38+
{
39+
return themeSelector.Query(query);
40+
}
41+
3742
var commands = Commands();
3843
var results = new List<Result>();
3944
foreach (var c in commands)
@@ -82,6 +87,7 @@ private string GetDynamicTitle(Query query, Result result)
8287
public void Init(PluginInitContext context)
8388
{
8489
this.context = context;
90+
themeSelector = new ThemeSelector(context);
8591
KeywordTitleMappings = new Dictionary<string, string>{
8692
{"Shutdown", "flowlauncher_plugin_sys_shutdown_computer_cmd"},
8793
{"Restart", "flowlauncher_plugin_sys_restart_computer_cmd"},
@@ -102,7 +108,8 @@ public void Init(PluginInitContext context)
102108
{"Open Log Location", "flowlauncher_plugin_sys_open_log_location_cmd"},
103109
{"Flow Launcher Tips", "flowlauncher_plugin_sys_open_docs_tips_cmd"},
104110
{"Flow Launcher UserData Folder", "flowlauncher_plugin_sys_open_userdata_location_cmd"},
105-
{"Toggle Game Mode", "flowlauncher_plugin_sys_toggle_game_mode_cmd"}
111+
{"Toggle Game Mode", "flowlauncher_plugin_sys_toggle_game_mode_cmd"},
112+
{"Set Flow Launcher Theme", "flowlauncher_plugin_sys_theme_selector_cmd"}
106113
};
107114
}
108115

@@ -451,6 +458,18 @@ private List<Result> Commands()
451458
context.API.ToggleGameMode();
452459
return true;
453460
}
461+
},
462+
new Result
463+
{
464+
Title = "Set Flow Launcher Theme",
465+
SubTitle = context.API.GetTranslation("flowlauncher_plugin_sys_theme_selector"),
466+
IcoPath = "Images\\app.png",
467+
Glyph = new GlyphInfo (FontFamily:"/Resources/#Segoe Fluent Icons", Glyph:"\ue7fc"),
468+
Action = c =>
469+
{
470+
context.API.ChangeQuery($"{ThemeSelector.Keyword} ");
471+
return false;
472+
}
454473
}
455474
});
456475

0 commit comments

Comments
 (0)