mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add log level change to general settings page
This commit is contained in:
parent
05ff797613
commit
66bf04642a
3 changed files with 33 additions and 0 deletions
|
|
@ -104,6 +104,9 @@
|
|||
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
|
||||
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow activates. Press {0} to toggle preview.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
|
||||
<system:String x:Key="logLevel">Log level</system:String>
|
||||
<system:String x:Key="LogLevelDEBUG">Debug</system:String>
|
||||
<system:String x:Key="LogLevelINFO">Info</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
<system:String x:Key="searchplugin">Search Plugin</system:String>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ 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;
|
||||
|
|
@ -31,6 +32,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
|||
public class SearchWindowAlignData : DropdownDataGeneric<SearchWindowAligns> { }
|
||||
public class SearchPrecisionData : DropdownDataGeneric<SearchPrecisionScore> { }
|
||||
public class LastQueryModeData : DropdownDataGeneric<LastQueryMode> { }
|
||||
public class LogLevelData : DropdownDataGeneric<LOGLEVEL> { }
|
||||
|
||||
public bool StartFlowLauncherOnSystemStartup
|
||||
{
|
||||
|
|
@ -143,12 +145,16 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
|||
public List<LastQueryModeData> LastQueryModes { get; } =
|
||||
DropdownDataGeneric<LastQueryMode>.GetValues<LastQueryModeData>("LastQuery");
|
||||
|
||||
public List<LogLevelData> LogLevels { get; } =
|
||||
DropdownDataGeneric<LOGLEVEL>.GetValues<LogLevelData>("LogLevel");
|
||||
|
||||
private void UpdateEnumDropdownLocalizations()
|
||||
{
|
||||
DropdownDataGeneric<SearchWindowScreens>.UpdateLabels(SearchWindowScreens);
|
||||
DropdownDataGeneric<SearchWindowAligns>.UpdateLabels(SearchWindowAligns);
|
||||
DropdownDataGeneric<SearchPrecisionScore>.UpdateLabels(SearchPrecisionScores);
|
||||
DropdownDataGeneric<LastQueryMode>.UpdateLabels(LastQueryModes);
|
||||
DropdownDataGeneric<LOGLEVEL>.UpdateLabels(LogLevels);
|
||||
}
|
||||
|
||||
public string Language
|
||||
|
|
@ -216,6 +222,22 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
|
|||
}
|
||||
}
|
||||
|
||||
public LOGLEVEL LogLevel
|
||||
{
|
||||
get => Settings.LogLevel;
|
||||
set
|
||||
{
|
||||
if (Settings.LogLevel != value)
|
||||
{
|
||||
Settings.LogLevel = value;
|
||||
|
||||
Log.SetLogLevel(value);
|
||||
|
||||
UpdateEnumDropdownLocalizations();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void SelectPython()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -278,6 +278,14 @@
|
|||
SelectedValue="{Binding Language}"
|
||||
SelectedValuePath="LanguageCode" />
|
||||
</cc:Card>
|
||||
|
||||
<cc:Card Title="{DynamicResource logLevel}" Margin="0 14 0 0">
|
||||
<ComboBox
|
||||
DisplayMemberPath="Display"
|
||||
ItemsSource="{Binding LogLevels}"
|
||||
SelectedValue="{Binding LogLevel}"
|
||||
SelectedValuePath="Value" />
|
||||
</cc:Card>
|
||||
</VirtualizingStackPanel>
|
||||
</ScrollViewer>
|
||||
</ui:Page>
|
||||
|
|
|
|||
Loading…
Reference in a new issue