Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
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