Merge remote-tracking branch 'upstream/dev' into pr/835

This commit is contained in:
Kevin Zhang 2021-11-29 18:41:14 -06:00
commit 264aed9408
7 changed files with 37 additions and 36 deletions

View file

@ -15,7 +15,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
private string language = "en"; private string language = "en";
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}"; public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
public string OpenResultModifiers { get; set; } = KeyConstant.Alt; public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
public string DarkMode { get; set; } = "System"; public string ColorScheme { get; set; } = "System";
public bool ShowOpenResultHotkey { get; set; } = true; public bool ShowOpenResultHotkey { get; set; } = true;
public double WindowSize { get; set; } = 580; public double WindowSize { get; set; } = 580;
@ -133,7 +133,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public bool DontPromptUpdateMsg { get; set; } public bool DontPromptUpdateMsg { get; set; }
public bool EnableUpdateLog { get; set; } public bool EnableUpdateLog { get; set; }
public bool StartFlowLauncherOnSystemStartup { get; set; } = true; public bool StartFlowLauncherOnSystemStartup { get; set; } = false;
public bool HideOnStartup { get; set; } public bool HideOnStartup { get; set; }
bool _hideNotifyIcon { get; set; } bool _hideNotifyIcon { get; set; }
public bool HideNotifyIcon public bool HideNotifyIcon
@ -167,7 +167,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
Preserved Preserved
} }
public enum DarkMode public enum ColorSchemes
{ {
System, System,
Light, Light,

View file

@ -87,10 +87,10 @@
<system:String x:Key="theme_load_failure_parse_error">Fail to load theme {0}, fallback to default theme</system:String> <system:String x:Key="theme_load_failure_parse_error">Fail to load theme {0}, fallback to default theme</system:String>
<system:String x:Key="ThemeFolder">Theme Folder</system:String> <system:String x:Key="ThemeFolder">Theme Folder</system:String>
<system:String x:Key="OpenThemeFolder">Open Theme Folder</system:String> <system:String x:Key="OpenThemeFolder">Open Theme Folder</system:String>
<system:String x:Key="DarkMode">Dark Mode</system:String> <system:String x:Key="ColorScheme">Color Scheme</system:String>
<system:String x:Key="DarkModeSystem">System Default</system:String> <system:String x:Key="ColorSchemeSystem">System Default</system:String>
<system:String x:Key="DarkModeLight">Light</system:String> <system:String x:Key="ColorSchemeLight">Light</system:String>
<system:String x:Key="DarkModeDark">Dark</system:String> <system:String x:Key="ColorSchemeDark">Dark</system:String>
<system:String x:Key="SoundEffect">Sound Effect</system:String> <system:String x:Key="SoundEffect">Sound Effect</system:String>
<system:String x:Key="SoundEffectTip">Play a small sound when the search window opens</system:String> <system:String x:Key="SoundEffectTip">Play a small sound when the search window opens</system:String>
<system:String x:Key="Animation">Animation</system:String> <system:String x:Key="Animation">Animation</system:String>

View file

@ -87,11 +87,10 @@
<system:String x:Key="theme_load_failure_parse_error">{0} 테마 로드에 실패했습니다. 기본 테마로 변경합니다.</system:String> <system:String x:Key="theme_load_failure_parse_error">{0} 테마 로드에 실패했습니다. 기본 테마로 변경합니다.</system:String>
<system:String x:Key="ThemeFolder">테마 폴더</system:String> <system:String x:Key="ThemeFolder">테마 폴더</system:String>
<system:String x:Key="OpenThemeFolder">테마 폴더 열기</system:String> <system:String x:Key="OpenThemeFolder">테마 폴더 열기</system:String>
<system:String x:Key="DarkMode">다크 모드</system:String> <system:String x:Key="ColorScheme">앱 색상</system:String>
<system:String x:Key="DarkModeTip">System settings will take effect from the next run</system:String> <system:String x:Key="ColorSchemeSystem">시스템 기본</system:String>
<system:String x:Key="DarkModeSystem">시스템 기본</system:String> <system:String x:Key="ColorSchemeLight">밝게</system:String>
<system:String x:Key="DarkModeLight">밝게</system:String> <system:String x:Key="ColorSchemeDark">어둡게</system:String>
<system:String x:Key="DarkModeDark">어둡게</system:String>
<system:String x:Key="SoundEffect">소리 효과</system:String> <system:String x:Key="SoundEffect">소리 효과</system:String>
<system:String x:Key="SoundEffectTip">검색창을 열 때 작은 소리를 재생합니다.</system:String> <system:String x:Key="SoundEffectTip">검색창을 열 때 작은 소리를 재생합니다.</system:String>
<system:String x:Key="Animation">애니메이션</system:String> <system:String x:Key="Animation">애니메이션</system:String>

View file

@ -68,7 +68,7 @@ namespace Flow.Launcher
HideStartup(); HideStartup();
// show notify icon when flowlauncher is hidden // show notify icon when flowlauncher is hidden
InitializeNotifyIcon(); InitializeNotifyIcon();
InitializeDarkMode(); InitializeColorScheme();
WindowsInteropHelper.DisableControlBox(this); WindowsInteropHelper.DisableControlBox(this);
InitProgressbarAnimation(); InitProgressbarAnimation();
// since the default main window visibility is visible // since the default main window visibility is visible
@ -480,13 +480,13 @@ namespace Flow.Launcher
QueryTextBox.CaretIndex = QueryTextBox.Text.Length; QueryTextBox.CaretIndex = QueryTextBox.Text.Length;
} }
public void InitializeDarkMode() public void InitializeColorScheme()
{ {
if (_settings.DarkMode == Constant.Light) if (_settings.ColorScheme == Constant.Light)
{ {
ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Light; ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Light;
} }
else if (_settings.DarkMode == Constant.Dark) else if (_settings.ColorScheme == Constant.Dark)
{ {
ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Dark; ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Dark;
} }

View file

@ -1919,21 +1919,21 @@
<Border Margin="0,12,0,12" Style="{DynamicResource SettingGroupBox}"> <Border Margin="0,12,0,12" Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}"> <ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}"> <StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource DarkMode}" /> <TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource ColorScheme}" />
</StackPanel> </StackPanel>
<ComboBox <ComboBox
x:Name="DarkModeComboBox" x:Name="ColorSchemeComboBox"
Grid.Column="2" Grid.Column="2"
Width="180" Width="180"
Margin="0,0,18,0" Margin="0,0,18,0"
DisplayMemberPath="Display" DisplayMemberPath="Display"
FontSize="14" FontSize="14"
ItemsSource="{Binding DarkModes}" ItemsSource="{Binding ColorSchemes}"
SelectedValue="{Binding Settings.DarkMode}" SelectedValue="{Binding Settings.ColorScheme}"
SelectedValuePath="Value" SelectedValuePath="Value"
SelectionChanged="DarkModeSelectedIndexChanged" /> SelectionChanged="ColorSchemeSelectedIndexChanged" />
<TextBlock Style="{StaticResource Glyph}"> <TextBlock Style="{StaticResource Glyph}">
&#xe708; &#xe793;
</TextBlock> </TextBlock>
</ItemsControl> </ItemsControl>
</Border> </Border>

View file

@ -306,13 +306,14 @@ namespace Flow.Launcher
textBox.MoveFocus(tRequest); textBox.MoveFocus(tRequest);
} }
private void DarkModeSelectedIndexChanged(object sender, EventArgs e) => ThemeManager.Current.ApplicationTheme = settings.DarkMode switch private void ColorSchemeSelectedIndexChanged(object sender, EventArgs e)
{ => ThemeManager.Current.ApplicationTheme = settings.ColorScheme switch
Constant.Light => ApplicationTheme.Light, {
Constant.Dark => ApplicationTheme.Dark, Constant.Light => ApplicationTheme.Light,
Constant.System => null, Constant.Dark => ApplicationTheme.Dark,
_ => ThemeManager.Current.ApplicationTheme Constant.System => null,
}; _ => ThemeManager.Current.ApplicationTheme
};
/* Custom TitleBar */ /* Custom TitleBar */

View file

@ -315,22 +315,23 @@ namespace Flow.Launcher.ViewModel
} }
} }
public class DarkMode public class ColorScheme
{ {
public string Display { get; set; } public string Display { get; set; }
public Infrastructure.UserSettings.DarkMode Value { get; set; } public ColorSchemes Value { get; set; }
} }
public List<DarkMode> DarkModes
public List<ColorScheme> ColorSchemes
{ {
get get
{ {
List<DarkMode> modes = new List<DarkMode>(); List<ColorScheme> modes = new List<ColorScheme>();
var enums = (Infrastructure.UserSettings.DarkMode[])Enum.GetValues(typeof(Infrastructure.UserSettings.DarkMode)); var enums = (ColorSchemes[])Enum.GetValues(typeof(ColorSchemes));
foreach (var e in enums) foreach (var e in enums)
{ {
var key = $"DarkMode{e}"; var key = $"ColorScheme{e}";
var display = _translater.GetTranslation(key); var display = _translater.GetTranslation(key);
var m = new DarkMode { Display = display, Value = e, }; var m = new ColorScheme { Display = display, Value = e, };
modes.Add(m); modes.Add(m);
} }
return modes; return modes;