Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@
<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>
Expand Down Expand Up @@ -303,6 +300,9 @@
<system:String x:Key="userdatapath">User Data Location</system:String>
<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>
<system:String x:Key="userdatapathButton">Open Folder</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>

<!-- FileManager Setting Dialog -->
<system:String x:Key="fileManagerWindow">Select File Manager</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -45,10 +46,35 @@ public string LogFolderSize
_settings.ActivateTimes
);

public class LogLevelData : DropdownDataGeneric<LOGLEVEL> { }

public List<LogLevelData> LogLevels { get; } =
DropdownDataGeneric<LOGLEVEL>.GetValues<LogLevelData>("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<LOGLEVEL>.UpdateLabels(LogLevels);
}

[RelayCommand]
Expand Down Expand Up @@ -138,5 +164,4 @@ private static string BytesToReadableString(long bytes)

return "0 B";
}

}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -32,7 +30,6 @@ public class SearchWindowScreenData : DropdownDataGeneric<SearchWindowScreens> {
public class SearchWindowAlignData : DropdownDataGeneric<SearchWindowAligns> { }
public class SearchPrecisionData : DropdownDataGeneric<SearchPrecisionScore> { }
public class LastQueryModeData : DropdownDataGeneric<LastQueryMode> { }
public class LogLevelData : DropdownDataGeneric<LOGLEVEL> { }

public bool StartFlowLauncherOnSystemStartup
{
Expand Down Expand Up @@ -145,16 +142,12 @@ public bool PortableMode
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
Expand Down Expand Up @@ -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()
{
Expand Down
8 changes: 8 additions & 0 deletions Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
</StackPanel>
</cc:Card>

<cc:Card Title="{DynamicResource logLevel}" Icon="&#xE749;">
<ComboBox
DisplayMemberPath="Display"
ItemsSource="{Binding LogLevels}"
SelectedValue="{Binding LogLevel}"
SelectedValuePath="Value" />
</cc:Card>

<TextBlock
Margin="14 20 0 0"
HorizontalAlignment="Center"
Expand Down
8 changes: 0 additions & 8 deletions Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,6 @@
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