Skip to content

Commit c1f562e

Browse files
authored
Merge branch 'dev' into UpdateWizard
2 parents 157f8f8 + e7128f9 commit c1f562e

38 files changed

+1340
-793
lines changed

Flow.Launcher.Core/Resource/Internationalization.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,16 @@ public void ChangeLanguage(Language language)
9696
{
9797
LoadLanguage(language);
9898
}
99-
Settings.Language = language.LanguageCode;
100-
CultureInfo.CurrentCulture = new CultureInfo(language.LanguageCode);
99+
// Culture of this thread
100+
// Use CreateSpecificCulture to preserve possible user-override settings in Windows
101+
CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture(language.LanguageCode);
101102
CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture;
103+
// App domain
104+
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture(language.LanguageCode);
105+
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.DefaultThreadCurrentCulture;
106+
107+
// Raise event after culture is set
108+
Settings.Language = language.LanguageCode;
102109
_ = Task.Run(() =>
103110
{
104111
UpdatePluginMetadataTranslations();
@@ -186,7 +193,7 @@ private void UpdatePluginMetadataTranslations()
186193
{
187194
p.Metadata.Name = pluginI18N.GetTranslatedPluginTitle();
188195
p.Metadata.Description = pluginI18N.GetTranslatedPluginDescription();
189-
pluginI18N.OnCultureInfoChanged(CultureInfo.CurrentCulture);
196+
pluginI18N.OnCultureInfoChanged(CultureInfo.DefaultThreadCurrentCulture);
190197
}
191198
catch (Exception e)
192199
{

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Windows;
77
using Flow.Launcher.Plugin;
88
using Flow.Launcher.Plugin.SharedModels;
9-
using Flow.Launcher;
109
using Flow.Launcher.ViewModel;
1110

1211
namespace Flow.Launcher.Infrastructure.UserSettings

Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur
5252

5353
// Check if Text will be larger then our QueryTextBox
5454
System.Windows.Media.Typeface typeface = new Typeface(QueryTextBox.FontFamily, QueryTextBox.FontStyle, QueryTextBox.FontWeight, QueryTextBox.FontStretch);
55-
System.Windows.Media.FormattedText ft = new FormattedText(QueryTextBox.Text, System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, QueryTextBox.FontSize, Brushes.Black);
55+
// TODO: Obsolete warning?
56+
System.Windows.Media.FormattedText ft = new FormattedText(QueryTextBox.Text, System.Globalization.CultureInfo.DefaultThreadCurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, QueryTextBox.FontSize, Brushes.Black);
5657

5758
var offset = QueryTextBox.Padding.Right;
5859

@@ -75,4 +76,4 @@ public object[] ConvertBack(object value, Type[] targetTypes, object parameter,
7576
throw new NotImplementedException();
7677
}
7778
}
78-
}
79+
}

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@
126126
<Analyzer Include="@(FilteredAnalyzer)" />
127127
</ItemGroup>
128128
</Target>
129-
</Project>
129+
</Project>

Flow.Launcher/MainWindow.xaml

Lines changed: 189 additions & 177 deletions
Large diffs are not rendered by default.

Flow.Launcher/ResultListBox.xaml

Lines changed: 78 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
88
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
99
MaxHeight="{Binding MaxHeight}"
10-
Margin="{Binding Margin}"
10+
Margin="{DynamicResource ResultMargin}"
1111
HorizontalContentAlignment="Stretch"
1212
d:DataContext="{d:DesignInstance vm:ResultsViewModel}"
1313
d:DesignHeight="100"
@@ -17,6 +17,10 @@
1717
ItemsSource="{Binding Results}"
1818
KeyboardNavigation.DirectionalNavigation="Cycle"
1919
PreviewMouseDown="ListBox_PreviewMouseDown"
20+
PreviewMouseLeftButtonDown="ResultList_PreviewMouseLeftButtonDown"
21+
PreviewMouseLeftButtonUp="ResultListBox_OnPreviewMouseUp"
22+
PreviewMouseMove="ResultList_MouseMove"
23+
PreviewMouseRightButtonDown="ResultListBox_OnPreviewMouseRightButtonDown"
2024
SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}"
2125
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
2226
SelectionChanged="OnSelectionChanged"
@@ -25,17 +29,12 @@
2529
VirtualizingStackPanel.IsVirtualizing="True"
2630
VirtualizingStackPanel.VirtualizationMode="Standard"
2731
Visibility="{Binding Visbility}"
28-
mc:Ignorable="d"
29-
PreviewMouseMove="ResultList_MouseMove"
30-
PreviewMouseLeftButtonDown="ResultList_PreviewMouseLeftButtonDown"
31-
PreviewMouseLeftButtonUp="ResultListBox_OnPreviewMouseUp"
32-
PreviewMouseRightButtonDown="ResultListBox_OnPreviewMouseRightButtonDown">
32+
mc:Ignorable="d">
3333
<!-- IsSynchronizedWithCurrentItem: http://stackoverflow.com/a/7833798/2833083 -->
3434

3535
<ListBox.ItemTemplate>
3636
<DataTemplate>
37-
<Button
38-
HorizontalAlignment="Stretch">
37+
<Button HorizontalAlignment="Stretch">
3938
<Button.Template>
4039
<ControlTemplate>
4140
<ContentPresenter Content="{TemplateBinding Button.Content}" />
@@ -56,19 +55,19 @@
5655
<Grid.ColumnDefinitions>
5756
<ColumnDefinition Width="60" />
5857
<ColumnDefinition Width="9*" />
59-
<ColumnDefinition Width="Auto" />
58+
<ColumnDefinition Width="Auto" MinWidth="8" />
6059
</Grid.ColumnDefinitions>
6160
<StackPanel
6261
Grid.Column="2"
6362
Margin="0,0,10,0"
63+
VerticalAlignment="Center"
6464
Visibility="{Binding ShowOpenResultHotkey}">
6565
<TextBlock
6666
x:Name="Hotkey"
6767
Margin="12,0,12,0"
68-
Padding="0,10,0,10"
68+
Padding="0,0,0,0"
6969
HorizontalAlignment="Right"
7070
VerticalAlignment="Center"
71-
Opacity="0.8"
7271
Style="{DynamicResource ItemHotkeyStyle}">
7372
<TextBlock.Visibility>
7473
<Binding Converter="{StaticResource ResourceKey=OpenResultHotkeyVisibilityConverter}" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}" />
@@ -81,69 +80,93 @@
8180
</TextBlock.Text>
8281
</TextBlock>
8382
</StackPanel>
84-
<Border
85-
Margin="9,0,0,0"
86-
BorderBrush="Transparent"
87-
BorderThickness="0">
88-
<Image
89-
x:Name="ImageIcon"
90-
Width="{Binding IconXY}"
91-
Height="{Binding IconXY}"
92-
Margin="0,0,0,0" IsHitTestVisible="False"
93-
HorizontalAlignment="Center"
94-
Source="{Binding Image, TargetNullValue={x:Null}}"
95-
Stretch="Uniform"
96-
Visibility="{Binding ShowIcon}">
97-
<Image.Clip>
98-
<EllipseGeometry RadiusX="{Binding IconRadius}" RadiusY="{Binding IconRadius}" Center="16 16"/>
99-
</Image.Clip>
100-
</Image>
101-
</Border>
102-
<Border
103-
Margin="9,0,0,0"
104-
BorderBrush="Transparent"
105-
BorderThickness="0">
106-
<TextBlock
83+
84+
<Grid Grid.Column="0">
85+
<Grid.ColumnDefinitions>
86+
<ColumnDefinition Width="Auto" />
87+
<ColumnDefinition />
88+
</Grid.ColumnDefinitions>
89+
90+
<Border
91+
x:Name="Bullet"
10792
Grid.Column="0"
108-
HorizontalAlignment="Center"
109-
VerticalAlignment="Center"
110-
FontFamily="{Binding Glyph.FontFamily}"
111-
Style="{DynamicResource ItemGlyph}"
112-
Text="{Binding Glyph.Glyph}"
113-
Visibility="{Binding ShowGlyph}" />
114-
</Border>
93+
Style="{DynamicResource BulletStyle}" />
94+
95+
<Border
96+
Grid.Column="1"
97+
Margin="9,0,0,0"
98+
BorderBrush="Transparent"
99+
BorderThickness="1">
100+
<Image
101+
x:Name="ImageIcon"
102+
Width="{Binding IconXY}"
103+
Height="{Binding IconXY}"
104+
Margin="0,0,0,0"
105+
HorizontalAlignment="Center"
106+
IsHitTestVisible="False"
107+
Source="{Binding Image, TargetNullValue={x:Null}}"
108+
Stretch="Uniform"
109+
Visibility="{Binding ShowIcon}">
110+
<Image.Clip>
111+
<EllipseGeometry
112+
Center="16 16"
113+
RadiusX="{Binding IconRadius}"
114+
RadiusY="{Binding IconRadius}" />
115+
</Image.Clip>
116+
</Image>
117+
</Border>
118+
<Border
119+
Grid.Column="1"
120+
Margin="9,0,0,0"
121+
BorderBrush="Transparent"
122+
BorderThickness="0">
123+
<TextBlock
124+
x:Name="GlyphIcon"
125+
HorizontalAlignment="Center"
126+
VerticalAlignment="Center"
127+
FontFamily="{Binding Glyph.FontFamily}"
128+
Style="{DynamicResource ItemGlyph}"
129+
Text="{Binding Glyph.Glyph}"
130+
Visibility="{Binding ShowGlyph}" />
131+
</Border>
132+
</Grid>
133+
115134
<Grid
116135
Grid.Column="1"
117136
Margin="6,0,10,0"
118-
HorizontalAlignment="Stretch">
137+
HorizontalAlignment="Stretch"
138+
VerticalAlignment="Center">
119139
<Grid.RowDefinitions>
120-
<RowDefinition />
140+
<RowDefinition Height="Auto" />
121141
<RowDefinition x:Name="SubTitleRowDefinition" Height="Auto" />
122142
</Grid.RowDefinitions>
123143
<ProgressBar
124144
x:Name="progressbarResult"
145+
Grid.Row="0"
125146
Foreground="{Binding Result.ProgressBarColor}"
126147
Value="{Binding ResultProgress, Mode=OneWay}">
127148
<ProgressBar.Style>
128-
<Style TargetType="ProgressBar" BasedOn="{StaticResource ProgressBarResult}">
129-
<Setter Property="Visibility" Value="Visible"/>
149+
<Style BasedOn="{StaticResource ProgressBarResult}" TargetType="ProgressBar">
150+
<Setter Property="Visibility" Value="Visible" />
130151
<Style.Triggers>
131152
<DataTrigger Binding="{Binding Result.ProgressBar}" Value="{x:Null}">
132-
<Setter Property="Visibility" Value="Collapsed"/>
153+
<Setter Property="Visibility" Value="Collapsed" />
133154
</DataTrigger>
134155
</Style.Triggers>
135156
</Style>
136157
</ProgressBar.Style>
137158
</ProgressBar>
138159
<TextBlock
139160
x:Name="Title"
161+
Grid.Row="0"
140162
VerticalAlignment="Center"
141163
DockPanel.Dock="Left"
164+
IsEnabled="False"
142165
Style="{DynamicResource ItemTitleStyle}"
143166
Text="{Binding Result.Title}"
167+
TextTrimming="CharacterEllipsis"
144168
ToolTip="{Binding ShowTitleToolTip}"
145-
ToolTipService.ShowOnDisabled="True"
146-
IsEnabled="False">
169+
ToolTipService.ShowOnDisabled="True">
147170
<vm:ResultsViewModel.FormattedText>
148171
<MultiBinding Converter="{StaticResource HighlightTextConverter}">
149172
<Binding Path="Result.Title" />
@@ -155,10 +178,11 @@
155178
x:Name="SubTitle"
156179
Grid.Row="1"
157180
IsEnabled="False"
158-
ToolTipService.ShowOnDisabled="True"
159181
Style="{DynamicResource ItemSubTitleStyle}"
160182
Text="{Binding Result.SubTitle}"
161-
ToolTip="{Binding ShowSubTitleToolTip}"/>
183+
TextTrimming="CharacterEllipsis"
184+
ToolTip="{Binding ShowSubTitleToolTip}"
185+
ToolTipService.ShowOnDisabled="True" />
162186
</Grid>
163187

164188
</Grid>
@@ -167,10 +191,12 @@
167191
<!-- a result item height is 52 including margin -->
168192
<DataTemplate.Triggers>
169193
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
194+
<Setter TargetName="Bullet" Property="Style" Value="{DynamicResource ItemBulletSelectedStyle}" />
170195
<Setter TargetName="Title" Property="Style" Value="{DynamicResource ItemTitleSelectedStyle}" />
171196
<Setter TargetName="SubTitle" Property="Style" Value="{DynamicResource ItemSubTitleSelectedStyle}" />
172197
<Setter TargetName="Hotkey" Property="Style" Value="{DynamicResource ItemHotkeySelectedStyle}" />
173198
<Setter TargetName="ImageIcon" Property="Style" Value="{DynamicResource ItemImageSelectedStyle}" />
199+
<Setter TargetName="GlyphIcon" Property="Style" Value="{DynamicResource ItemGlyphSelectedStyle}" />
174200
</DataTrigger>
175201
</DataTemplate.Triggers>
176202
</DataTemplate>
@@ -189,8 +215,10 @@
189215
<ControlTemplate TargetType="{x:Type ListBoxItem}">
190216
<Border
191217
x:Name="Bd"
218+
Margin="{DynamicResource ItemMargin}"
192219
Background="{TemplateBinding Background}"
193220
BorderBrush="{TemplateBinding BorderBrush}"
221+
CornerRadius="{DynamicResource ItemRadius}"
194222
SnapsToDevicePixels="True">
195223
<ContentPresenter
196224
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"

0 commit comments

Comments
 (0)