From e8be131221a55d84a4d60fd5680c4006ab5f096f Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 13 Mar 2025 12:53:26 +0800 Subject: [PATCH 1/3] Move log level to about page --- .../ViewModels/SettingsPaneAboutViewModel.cs | 27 ++++++++++++++++++- .../SettingsPaneGeneralViewModel.cs | 23 ---------------- .../SettingPages/Views/SettingsPaneAbout.xaml | 8 ++++++ .../Views/SettingsPaneGeneral.xaml | 8 ------ 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs index ade65028472..6b44be7c1bb 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs @@ -8,6 +8,7 @@ using Flow.Launcher.Core; using Flow.Launcher.Core.Resource; using Flow.Launcher.Infrastructure; +using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; @@ -45,10 +46,35 @@ public string LogFolderSize _settings.ActivateTimes ); + public class LogLevelData : DropdownDataGeneric { } + + public List LogLevels { get; } = + DropdownDataGeneric.GetValues("LogLevel"); + + public LOGLEVEL LogLevel + { + get => _settings.LogLevel; + set + { + if (_settings.LogLevel != value) + { + _settings.LogLevel = value; + + Log.SetLogLevel(value); + } + } + } + public SettingsPaneAboutViewModel(Settings settings, Updater updater) { _settings = settings; _updater = updater; + UpdateEnumDropdownLocalizations(); + } + + private void UpdateEnumDropdownLocalizations() + { + DropdownDataGeneric.UpdateLabels(LogLevels); } [RelayCommand] @@ -138,5 +164,4 @@ private static string BytesToReadableString(long bytes) return "0 B"; } - } diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs index e4f88432a39..de4f158ad04 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs @@ -1,13 +1,11 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Windows.Forms; using CommunityToolkit.Mvvm.Input; using Flow.Launcher.Core; using Flow.Launcher.Core.Configuration; using Flow.Launcher.Core.Resource; using Flow.Launcher.Helper; -using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedModels; @@ -32,7 +30,6 @@ public class SearchWindowScreenData : DropdownDataGeneric { public class SearchWindowAlignData : DropdownDataGeneric { } public class SearchPrecisionData : DropdownDataGeneric { } public class LastQueryModeData : DropdownDataGeneric { } - public class LogLevelData : DropdownDataGeneric { } public bool StartFlowLauncherOnSystemStartup { @@ -145,16 +142,12 @@ public bool PortableMode public List LastQueryModes { get; } = DropdownDataGeneric.GetValues("LastQuery"); - public List LogLevels { get; } = - DropdownDataGeneric.GetValues("LogLevel"); - private void UpdateEnumDropdownLocalizations() { DropdownDataGeneric.UpdateLabels(SearchWindowScreens); DropdownDataGeneric.UpdateLabels(SearchWindowAligns); DropdownDataGeneric.UpdateLabels(SearchPrecisionScores); DropdownDataGeneric.UpdateLabels(LastQueryModes); - DropdownDataGeneric.UpdateLabels(LogLevels); } public string Language @@ -222,22 +215,6 @@ public bool AutoUpdates } } - public LOGLEVEL LogLevel - { - get => Settings.LogLevel; - set - { - if (Settings.LogLevel != value) - { - Settings.LogLevel = value; - - Log.SetLogLevel(value); - - UpdateEnumDropdownLocalizations(); - } - } - } - [RelayCommand] private void SelectPython() { diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml index e33fee02b52..3ca8e163af5 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml @@ -123,6 +123,14 @@ + + + + - - - - From f24d64afec925923a81b1e2735f06be761e6d5de Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 13 Mar 2025 13:06:25 +0800 Subject: [PATCH 2/3] Add log level glyph --- Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml index 3ca8e163af5..75c51341133 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml @@ -123,7 +123,7 @@ - + Date: Thu, 13 Mar 2025 13:13:14 +0800 Subject: [PATCH 3/3] Fix strings --- Flow.Launcher/Languages/en.xaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 2ead21cf5b3..a3f87cd30d4 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -104,9 +104,6 @@ Always Preview Always open preview panel when Flow activates. Press {0} to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled - Log level - Debug - Info Search Plugin @@ -303,6 +300,9 @@ User Data Location 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. Open Folder + Log Level + Debug + Info Select File Manager