Flow.Launcher/Flow.Launcher/SettingWindow.xaml
2021-02-13 22:01:52 +11:00

457 lines
No EOL
29 KiB
XML

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
x:Class="Flow.Launcher.SettingWindow"
mc:Ignorable="d"
Icon="Images\app.ico"
Title="{DynamicResource flowlauncher_settings}"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Height="600" Width="800"
Closed="OnClosed"
d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}">
<Window.InputBindings>
<KeyBinding Key="Escape" Command="Close"/>
</Window.InputBindings>
<Window.CommandBindings>
<CommandBinding Command="Close" Executed="OnCloseExecuted"/>
</Window.CommandBindings>
<Window.Resources>
<CollectionViewSource Source="{Binding Source={x:Static Fonts.SystemFontFamilies}}" x:Key="SortedFonts">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="Source"/>
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
</Window.Resources>
<TabControl Height="auto" SelectedIndex="0">
<TabItem Header="{DynamicResource general}">
<ScrollViewer ui:ScrollViewerHelper.AutoHideScrollBars="True" Margin="60,30,0,30">
<StackPanel Orientation="Vertical">
<ui:ToggleSwitch Margin="10" IsOn="{Binding PortableMode}">
<TextBlock Text="{DynamicResource portableMode}" />
</ui:ToggleSwitch>
<CheckBox Margin="10" IsChecked="{Binding Settings.StartFlowLauncherOnSystemStartup}"
Checked="OnAutoStartupChecked" Unchecked="OnAutoStartupUncheck">
<TextBlock Text="{DynamicResource startFlowLauncherOnSystemStartup}" />
</CheckBox>
<CheckBox Margin="10" IsChecked="{Binding Settings.HideOnStartup}">
<TextBlock Text="{DynamicResource hideOnStartup}" />
</CheckBox>
<CheckBox Margin="10" IsChecked="{Binding Settings.HideWhenDeactive}">
<TextBlock Text="{DynamicResource hideFlowLauncherWhenLoseFocus}" />
</CheckBox>
<CheckBox Margin="10" IsChecked="{Binding Settings.HideNotifyIcon}">
<TextBlock Text="{DynamicResource hideNotifyIcon}" />
</CheckBox>
<CheckBox Margin="10" IsChecked="{Binding Settings.RememberLastLaunchLocation}">
<TextBlock Text="{DynamicResource rememberLastLocation}" />
</CheckBox>
<CheckBox Margin="10" IsChecked="{Binding Settings.IgnoreHotkeysOnFullscreen}">
<TextBlock Text="{DynamicResource ignoreHotkeysOnFullscreen}" />
</CheckBox>
<ui:ToggleSwitch Margin="10" IsOn="{Binding AutoUpdates}">
<TextBlock Text="{DynamicResource autoUpdates}" />
</ui:ToggleSwitch>
<CheckBox Margin="10" IsChecked="{Binding ShouldUsePinyin}">
<TextBlock Text="{DynamicResource ShouldUsePinyin}" />
</CheckBox>
<StackPanel Margin="10" Orientation="Horizontal">
<TextBlock Text="{DynamicResource querySearchPrecision}" FontSize="14" />
<ComboBox Margin="10 0 0 0" MaxWidth="200"
ItemsSource="{Binding QuerySearchPrecisionStrings}"
SelectedItem="{Binding Settings.QuerySearchPrecisionString}" />
</StackPanel>
<StackPanel Margin="10" Orientation="Horizontal">
<TextBlock Text="{DynamicResource lastQueryMode}" FontSize="14" />
<ComboBox Margin="10 0 0 0" MaxWidth="200"
ItemsSource="{Binding LastQueryModes}" SelectedValue="{Binding Settings.LastQueryMode}"
DisplayMemberPath="Display" SelectedValuePath="Value" />
</StackPanel>
<StackPanel Margin="10" Orientation="Horizontal">
<TextBlock Text="{DynamicResource language}" FontSize="14" />
<ComboBox Margin="10 0 0 0" MaxWidth="200"
ItemsSource="{Binding Languages}" SelectedValue="{Binding Language}"
DisplayMemberPath="Display" SelectedValuePath="LanguageCode" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="10">
<TextBlock Text="{DynamicResource maxShowResults}" FontSize="14" />
<ComboBox Margin="10 0 0 0" MaxWidth="100" ItemsSource="{Binding MaxResultsRange}"
SelectedItem="{Binding Settings.MaxResultsToShow}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="10" Text="{DynamicResource pythonDirectory}" FontSize="14" />
<TextBox Width="300" Margin="10" Text="{Binding Settings.PluginSettings.PythonDirectory}" />
<Button Margin="10" Click="OnSelectPythonDirectoryClick"
Content="{DynamicResource selectPythonDirectory}" />
</StackPanel>
</StackPanel>
</ScrollViewer>
</TabItem>
<TabItem Header="{DynamicResource plugin}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="215" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<DockPanel Grid.Column="0">
<TextBlock DockPanel.Dock="Top" Margin="10">
<Hyperlink NavigateUri="{Binding Plugin, Mode=OneWay}" RequestNavigate="OnRequestNavigate">
<Run Text="{DynamicResource browserMorePlugins}" />
</Hyperlink>
</TextBlock>
<ListBox SelectedIndex="0" SelectedItem="{Binding SelectedPlugin}"
ItemsSource="{Binding PluginViewModels}"
Margin="10, 0, 10, 10" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ui:ScrollViewerHelper.AutoHideScrollBars="True">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="3">
<Image Source="{Binding Image, IsAsync=True}"
Width="32" Height="32" />
<StackPanel Margin="3 0 3 0">
<TextBlock Text="{Binding PluginPair.Metadata.Name}"
ToolTip="{Binding PluginPair.Metadata.Description}" />
<TextBlock Opacity="0.5">
<Run Text="Version" />
<Run Text="{Binding PluginPair.Metadata.Version}" />
</TextBlock>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ContentControl DataContext="{Binding Path=SelectedPlugin}"
Grid.ColumnSpan="1" Grid.Row="0" Margin="10 10 10 0">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="48" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image Source="{Binding Image, IsAsync=True}"
Width="48" Height="48" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Grid Margin="10,0,0,0" Grid.Column="1" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding PluginPair.Metadata.Name}"
Grid.Column="0"
Cursor="Hand" MouseUp="OnPluginNameClick" FontSize="24"
HorizontalAlignment="Left">
<ToolTipService.ToolTip>
<TextBlock>
<Run Text="{DynamicResource author}" />
<Run Text=": " />
<Run Text="{Binding PluginPair.Metadata.Author}" />
</TextBlock>
</ToolTipService.ToolTip>
</TextBlock>
<ui:ToggleSwitch Grid.Column="1" OffContent="{DynamicResource disable}" OnContent="{DynamicResource enable}"
MaxWidth="110" HorizontalAlignment="Right"
IsOn="{Binding PluginState}"/>
</Grid>
<TextBlock Text="{Binding PluginPair.Metadata.Description}"
Grid.Row="1" Opacity="0.5" />
<DockPanel Grid.Row="2" Margin="0 10 0 8" HorizontalAlignment="Right">
<TextBlock Text="Priority" Margin="20,0,0,0"/>
<TextBlock Text="{Binding Priority}"
ToolTip="Change Plugin Results Priority"
Margin="5 0 0 0" Cursor="Hand" Foreground="Blue"
MouseUp="OnPluginPriorityClick"/>
<TextBlock Text="{DynamicResource actionKeywords}"
Visibility="{Binding ActionKeywordsVisibility}"
Margin="5 0 0 0"/>
<TextBlock Text="{Binding ActionKeywordsText}"
Visibility="{Binding ActionKeywordsVisibility}"
ToolTip="Change Action Keywords"
Margin="5 0 0 0" Cursor="Hand" Foreground="Blue"
MouseUp="OnPluginActionKeywordsClick" MaxWidth="100" />
<TextBlock Text="{DynamicResource plugin_init_time}" Margin="10 0 0 0" MaxWidth="100"/>
<TextBlock Text="{Binding InitilizaTime}" Margin="5 0 0 0" MaxWidth="100"/>
<TextBlock Text="{DynamicResource plugin_query_time}" Margin="10 0 0 0" MaxWidth="100"/>
<TextBlock Text="{Binding QueryTime}" Margin="5 0 0 0" MaxWidth="100"/>
<TextBlock Text="{DynamicResource pluginDirectory}"
MaxWidth="100" Cursor="Hand" Margin="40 0 0 0"
MouseUp="OnPluginDirecotyClick" Foreground="Blue" />
</DockPanel>
</Grid>
</Grid>
</ContentControl>
<ContentControl Content="{Binding SettingProvider}"
Grid.ColumnSpan="1" Grid.Row="1"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Grid>
</Grid>
</TabItem>
<TabItem Header="{DynamicResource theme}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<DockPanel Grid.Column="0">
<TextBlock DockPanel.Dock="Top" Margin="10" HorizontalAlignment="Left">
<Hyperlink NavigateUri="{Binding Theme, Mode=OneWay}" RequestNavigate="OnRequestNavigate">
<Run Text="{DynamicResource browserMoreThemes}" />
</Hyperlink>
</TextBlock>
<Button DockPanel.Dock="Top" Margin="0,10,0,0" Width="180" HorizontalAlignment="Center" Click="OpenPluginFolder">Open Theme Folder</Button>
<ListBox DockPanel.Dock="Top" SelectedItem="{Binding SelectedTheme}" ItemsSource="{Binding Themes}"
Margin="10, 0, 10, 10" Width="180" Height="394" />
</DockPanel>
<Grid Margin="0" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition />
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="15"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{DynamicResource queryWindowShadowEffect}" Margin="0 30 0 0" FontSize="14" />
<ui:ToggleSwitch Grid.Row="0" IsOn="{Binding DropShadowEffect}" Margin="210 23 0 0" Width="80"/>
<TextBlock Grid.Row="1" Text="{DynamicResource shadowEffectCPUUsage}"
Width="280"
FontSize="10" HorizontalAlignment="Left"/>
<TextBlock Grid.Row="2" Text="{DynamicResource shadowEffectPerformance}"
Width="320"
FontSize="10" HorizontalAlignment="Left"/>
</Grid>
</StackPanel>
<StackPanel Background="{Binding PreviewBackground}" Grid.Row="1" Margin="0">
<StackPanel Orientation="Horizontal" Margin="10"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Border Width="500" Style="{DynamicResource WindowBorderStyle}" CornerRadius="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBox Grid.Row="0"
Text="{DynamicResource hiThere}" IsReadOnly="True"
Style="{DynamicResource QueryBoxStyle}"
Margin="18 0 56 0" />
<svgc:SvgControl Source="{Binding ThemeImage}" Height="48" Width="48" HorizontalAlignment="Right"
Background="Transparent" />
<ContentControl Grid.Row="1">
<flowlauncher:ResultListBox DataContext="{Binding PreviewResults, Mode=OneTime}" Visibility="Visible" />
</ContentControl>
</Grid>
</Border>
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="2" Margin="0 10 0 10" Orientation="Vertical">
<StackPanel Orientation="Horizontal" Margin="2">
<TextBlock Text="{DynamicResource queryBoxFont}" FontSize="14" Margin="0 6 0 0" />
<ComboBox ItemsSource="{Binding Source={StaticResource SortedFonts}}"
SelectedItem="{Binding SelectedQueryBoxFont}"
HorizontalAlignment="Left" VerticalAlignment="Top" Width="180" Margin="25 -2 5 0" />
<ComboBox ItemsSource="{Binding SelectedQueryBoxFont.FamilyTypefaces}"
SelectedItem="{Binding SelectedQueryBoxFontFaces}"
HorizontalAlignment="Left" VerticalAlignment="Top"
Width="130" Margin="25 -2 0 0">
<ComboBox.ItemTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding AdjustedFaceNames}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Value}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="2 10 2 2">
<TextBlock Text="{DynamicResource resultItemFont}" FontSize="14" Margin="0 4 0 0" />
<ComboBox ItemsSource="{Binding Source={StaticResource SortedFonts}}"
SelectedItem="{Binding SelectedResultFont}"
HorizontalAlignment="Left" VerticalAlignment="Top"
Width="180" Margin="20 -2 5 0" />
<ComboBox ItemsSource="{Binding SelectedResultFont.FamilyTypefaces}"
SelectedItem="{Binding SelectedResultFontFaces}"
HorizontalAlignment="Left" VerticalAlignment="Top"
Width="130" Margin="26 -2 0 0">
<ComboBox.ItemTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding AdjustedFaceNames}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Value}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
</StackPanel>
</Grid>
</Grid>
</TabItem>
<TabItem Header="{DynamicResource hotkey}">
<Grid Margin="30 10 30 10">
<Grid.RowDefinitions>
<RowDefinition Height="80" />
<RowDefinition Height="35" />
<RowDefinition Height="70" />
<RowDefinition Height="250" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center"
Margin="0,4,0,3">
<TextBlock VerticalAlignment="Center" Margin="0 0 10 0" Text="{DynamicResource flowlauncherHotkey}" FontSize="14" />
<flowlauncher:HotkeyControl x:Name="HotkeyControl" HotkeyChanged="OnHotkeyChanged"
Loaded="OnHotkeyControlLoaded" Height="35"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center"
Margin="0,4,0,3">
<TextBlock VerticalAlignment="Center" Margin="0 0 10 0" Text="{DynamicResource openResultModifiers}" FontSize="14" />
<ComboBox Margin="0 0 0 0" Width="120"
ItemsSource="{Binding OpenResultModifiersList}"
SelectedItem="{Binding Settings.OpenResultModifiers}" FontSize="14" />
<CheckBox Margin="30 0 0 0" IsChecked="{Binding Settings.ShowOpenResultHotkey}" VerticalAlignment="Center">
<TextBlock Text="{DynamicResource showOpenResultHotkey}" FontSize="14" />
</CheckBox>
</StackPanel>
<TextBlock Grid.Row="2" VerticalAlignment="Center" Margin="0 23 10 2" Text="{DynamicResource customQueryHotkey}" FontSize="14" />
<ListView Grid.Row="3" ItemsSource="{Binding Settings.CustomPluginHotkeys}"
SelectedItem="{Binding SelectedCustomPluginHotkey}"
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}"
BorderBrush="DarkGray" BorderThickness="1"
Margin="0 5 0 0">
<ListView.View>
<GridView>
<GridViewColumn Header="{DynamicResource hotkey}" Width="180">
<GridViewColumn.CellTemplate>
<DataTemplate DataType="userSettings:CustomPluginHotkey">
<TextBlock Text="{Binding Hotkey}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="{DynamicResource actionKeywords}" Width="546">
<GridViewColumn.CellTemplate>
<DataTemplate DataType="userSettings:CustomPluginHotkey">
<TextBlock Text="{Binding ActionKeyword}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<StackPanel Grid.Row="4" HorizontalAlignment="Right" VerticalAlignment="Bottom"
Orientation="Horizontal" Width="360">
<Button Click="OnDeleteCustomHotkeyClick" Width="100"
Margin="10" Content="{DynamicResource delete}" />
<Button Click="OnnEditCustomHotkeyClick" Width="100" Margin="10"
Content="{DynamicResource edit}" />
<Button Click="OnAddCustomeHotkeyClick" Width="100" Margin="10"
Content="{DynamicResource add}" />
</StackPanel>
</Grid>
</TabItem>
<TabItem Header="{DynamicResource proxy}">
<StackPanel Height="400" Margin="65,0">
<CheckBox Margin="15 10 10 10" IsChecked="{Binding Settings.Proxy.Enabled}">
<TextBlock Text="{DynamicResource enableProxy}" FontSize="14" />
</CheckBox>
<Grid Margin="10" IsEnabled="{Binding Settings.Proxy.Enabled}">
<Grid.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="14" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="135" />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<TextBlock Text="{DynamicResource server}" Grid.Row="0" Grid.Column="0" Padding="5" />
<TextBox Text="{Binding Settings.Proxy.Server}" Grid.Row="0" Grid.Column="1" Padding="5" Margin="0 0 0 20" />
<TextBlock Text="{DynamicResource port}" Grid.Row="0" Grid.Column="2" Padding="5" Margin ="40 0 0 0" />
<TextBox Text="{Binding Settings.Proxy.Port, TargetNullValue={x:Static sys:String.Empty} }" Grid.Row="0"
Grid.Column="3" Padding="5" Margin="0 0 0 20"/>
<TextBlock Text="{DynamicResource userName}" Grid.Row="1" Grid.Column="0" Padding="5" />
<TextBox Text="{Binding Settings.Proxy.UserName}" Grid.Row="1" Grid.Column="1" Padding="5" />
<TextBlock Text="{DynamicResource password}" Grid.Row="1" Grid.Column="2" Padding="5" Margin ="40 0 0 0" />
<TextBox Text="{Binding Settings.Proxy.Password}" Grid.Row="1" Grid.Column="3" Padding="5" />
</Grid>
<Button Content="{DynamicResource testProxy}" IsEnabled="{Binding Settings.Proxy.Enabled}"
HorizontalAlignment="Right" Margin="10 15 10 10" Click="OnTestProxyClick" />
</StackPanel>
</TabItem>
<TabItem Header="{DynamicResource about}">
<Grid Height="400" Margin="65,0">
<Grid.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Margin" Value="10, 25, 0, 0" />
<Setter Property="FontSize" Value="14" />
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding ActivatedTimes, Mode=OneWay}" FontSize="12" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource website}"/>
<TextBlock Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left">
<Hyperlink NavigateUri="{Binding Website, Mode=OneWay}" RequestNavigate="OnRequestNavigate">
<Run Text="{Binding Website, Mode=OneWay}" />
</Hyperlink>
</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Version" />
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Version}" />
<TextBlock Grid.Row="3" Grid.Column="0" Text="{DynamicResource releaseNotes}" />
<TextBlock Grid.Row="3" Grid.Column="1">
<Hyperlink NavigateUri="{Binding ReleaseNotes, Mode=OneWay}"
RequestNavigate="OnRequestNavigate">
<Run Text="{Binding ReleaseNotes, Mode=OneWay}" />
</Hyperlink>
</TextBlock>
<Button Grid.Row="4" Grid.Column="0"
Content="{DynamicResource checkUpdates}" Click="OnCheckUpdates"
HorizontalAlignment="Left" Margin="10 30 10 10" />
</Grid>
</TabItem>
</TabControl>
</Window>