Skip to content

Commit 171ac07

Browse files
Merge branch 'dev' into Fix-1476
2 parents 51f5b42 + e17ec6a commit 171ac07

29 files changed

+1541
-505
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public string Language
4141
public bool UseGlyphIcons { get; set; } = true;
4242
public bool UseAnimation { get; set; } = true;
4343
public bool UseSound { get; set; } = true;
44+
public bool UseClock { get; set; } = true;
45+
public bool UseDate { get; set; } = false;
46+
public string TimeFormat { get; set; } = "hh:mm tt";
47+
public string DateFormat { get; set; } = "MM'/'dd ddd";
4448
public bool FirstLaunch { get; set; } = true;
4549

4650
public double SettingWindowWidth { get; set; } = 1000;

Flow.Launcher/Helper/HotKeyMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal static class HotKeyMapper
1717
internal static void Initialize(MainViewModel mainVM)
1818
{
1919
mainViewModel = mainVM;
20-
settings = mainViewModel._settings;
20+
settings = mainViewModel.Settings;
2121

2222
SetHotkey(settings.Hotkey, OnToggleHotkey);
2323
LoadCustomPluginHotkey();

Flow.Launcher/Languages/en.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@
132132
<system:String x:Key="SoundEffectTip">Play a small sound when the search window opens</system:String>
133133
<system:String x:Key="Animation">Animation</system:String>
134134
<system:String x:Key="AnimationTip">Use Animation in UI</system:String>
135+
<system:String x:Key="Clock">Clock</system:String>
136+
<system:String x:Key="Date">Date</system:String>
135137

136138
<!-- Setting Hotkey -->
137139
<system:String x:Key="hotkey">Hotkey</system:String>

Flow.Launcher/MainWindow.xaml

Lines changed: 120 additions & 102 deletions
Large diffs are not rendered by default.

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
using System.Windows.Media;
2121
using Flow.Launcher.Infrastructure.Hotkey;
2222
using Flow.Launcher.Plugin.SharedCommands;
23+
using System.Windows.Threading;
2324
using System.Windows.Data;
24-
using System.Diagnostics;
2525

2626
namespace Flow.Launcher
2727
{
@@ -45,6 +45,7 @@ public MainWindow(Settings settings, MainViewModel mainVM)
4545
DataContext = mainVM;
4646
_viewModel = mainVM;
4747
_settings = settings;
48+
4849
InitializeComponent();
4950
InitializePosition();
5051
animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav"));
@@ -54,6 +55,7 @@ public MainWindow()
5455
{
5556
InitializeComponent();
5657
}
58+
5759
private void OnCopy(object sender, ExecutedRoutedEventArgs e)
5860
{
5961
if (QueryTextBox.SelectionLength == 0)

Flow.Launcher/SettingWindow.xaml

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
88
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
99
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
10-
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
1110
xmlns:sys="clr-namespace:System;assembly=mscorlib"
1211
xmlns:ui="http://schemas.modernwpf.com/2019"
1312
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"
@@ -1810,8 +1809,11 @@
18101809
IsReadOnly="True"
18111810
Style="{DynamicResource QueryBoxStyle}"
18121811
Text="{DynamicResource hiThere}" />
1813-
18141812
</Border>
1813+
<StackPanel x:Name="ClockPanel" Style="{DynamicResource ClockPanel}">
1814+
<TextBlock x:Name="DateBox" Style="{DynamicResource DateBox}" />
1815+
<TextBlock x:Name="ClockBox" Style="{DynamicResource ClockBox}" />
1816+
</StackPanel>
18151817
<Canvas Style="{DynamicResource SearchIconPosition}">
18161818
<Path
18171819
Margin="0"
@@ -2134,7 +2136,88 @@
21342136
<StackPanel>
21352137

21362138
<Border
2137-
Margin="0,30,0,0"
2139+
Margin="0,24,0,12"
2140+
Padding="0"
2141+
CornerRadius="5"
2142+
Style="{DynamicResource SettingGroupBox}">
2143+
<StackPanel Orientation="Vertical">
2144+
<Border
2145+
Margin="0"
2146+
BorderThickness="0"
2147+
Style="{DynamicResource SettingGroupBox}">
2148+
<ItemsControl Style="{StaticResource SettingGrid}">
2149+
<StackPanel Style="{StaticResource TextPanel}">
2150+
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource Clock}" />
2151+
</StackPanel>
2152+
<StackPanel
2153+
Grid.Row="0"
2154+
Grid.Column="2"
2155+
Orientation="Horizontal">
2156+
<ComboBox
2157+
x:Name="TimeFormat"
2158+
Grid.Column="2"
2159+
MinWidth="180"
2160+
Margin="0,0,18,0"
2161+
VerticalAlignment="Center"
2162+
FontSize="14"
2163+
ItemsSource="{Binding TimeFormatList}"
2164+
SelectedValue="{Binding Settings.TimeFormat}"
2165+
SelectionChanged="PreviewClockAndDate" />
2166+
<ui:ToggleSwitch
2167+
IsOn="{Binding UseClock, Mode=TwoWay}"
2168+
OffContent="{DynamicResource disable}"
2169+
OnContent="{DynamicResource enable}"
2170+
Style="{DynamicResource SideToggleSwitch}"
2171+
Toggled="PreviewClockAndDate" />
2172+
</StackPanel>
2173+
<TextBlock Style="{StaticResource Glyph}">
2174+
&#xec92;
2175+
</TextBlock>
2176+
</ItemsControl>
2177+
</Border>
2178+
<Separator
2179+
Width="Auto"
2180+
BorderThickness="1"
2181+
Style="{StaticResource SettingSeparatorStyle}" />
2182+
<Border
2183+
Margin="0"
2184+
BorderThickness="0"
2185+
Style="{DynamicResource SettingGroupBox}">
2186+
<ItemsControl Style="{StaticResource SettingGrid}">
2187+
<StackPanel Style="{StaticResource TextPanel}">
2188+
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource Date}" />
2189+
</StackPanel>
2190+
<StackPanel
2191+
Grid.Row="0"
2192+
Grid.Column="2"
2193+
Orientation="Horizontal">
2194+
<ComboBox
2195+
x:Name="DateFormat"
2196+
Grid.Column="2"
2197+
MinWidth="180"
2198+
Margin="0,0,18,0"
2199+
VerticalAlignment="Center"
2200+
FontSize="14"
2201+
ItemsSource="{Binding DateFormatList}"
2202+
SelectedValue="{Binding Settings.DateFormat}"
2203+
SelectionChanged="PreviewClockAndDate" />
2204+
<ui:ToggleSwitch
2205+
IsOn="{Binding UseDate, Mode=TwoWay}"
2206+
OffContent="{DynamicResource disable}"
2207+
OnContent="{DynamicResource enable}"
2208+
Style="{DynamicResource SideToggleSwitch}"
2209+
Toggled="PreviewClockAndDate" />
2210+
</StackPanel>
2211+
<TextBlock Style="{StaticResource Glyph}">
2212+
&#xe787;
2213+
</TextBlock>
2214+
</ItemsControl>
2215+
</Border>
2216+
</StackPanel>
2217+
</Border>
2218+
2219+
<Border
2220+
Margin="0,12,0,12"
21382221
Padding="0"
21392222
CornerRadius="5"
21402223
Style="{DynamicResource SettingGroupBox}">

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
1-
using Droplex;
2-
using Flow.Launcher.Core.ExternalPlugins;
3-
using Flow.Launcher.Core.Plugin;
1+
using Flow.Launcher.Core.Plugin;
42
using Flow.Launcher.Core.Resource;
53
using Flow.Launcher.Helper;
64
using Flow.Launcher.Infrastructure;
75
using Flow.Launcher.Infrastructure.Hotkey;
8-
using Flow.Launcher.Infrastructure.Logger;
96
using Flow.Launcher.Infrastructure.UserSettings;
107
using Flow.Launcher.Plugin;
118
using Flow.Launcher.Plugin.SharedCommands;
129
using Flow.Launcher.ViewModel;
13-
using Microsoft.Win32;
1410
using ModernWpf;
1511
using System;
1612
using System.IO;
17-
using System.Linq;
1813
using System.Windows;
19-
using System.Windows.Controls;
2014
using System.Windows.Data;
2115
using System.Windows.Forms;
2216
using System.Windows.Input;
2317
using System.Windows.Interop;
24-
using System.Windows.Media;
2518
using System.Windows.Navigation;
2619
using Button = System.Windows.Controls.Button;
2720
using Control = System.Windows.Controls.Control;
28-
using ListViewItem = System.Windows.Controls.ListViewItem;
2921
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
3022
using MessageBox = System.Windows.MessageBox;
3123
using TextBox = System.Windows.Controls.TextBox;
@@ -71,6 +63,7 @@ private void OnLoaded(object sender, RoutedEventArgs e)
7163
pluginStoreView.Filter = PluginStoreFilter;
7264

7365
InitializePosition();
66+
ClockDisplay();
7467
}
7568

7669
private void OnSelectPythonDirectoryClick(object sender, RoutedEventArgs e)
@@ -466,6 +459,33 @@ private void PluginStore_OnKeyDown(object sender, KeyEventArgs e)
466459
}
467460
}
468461

462+
private void PreviewClockAndDate(object sender, RoutedEventArgs e)
463+
{
464+
ClockDisplay();
465+
}
466+
public void ClockDisplay()
467+
{
468+
if (settings.UseClock)
469+
{
470+
ClockBox.Visibility = Visibility.Visible;
471+
ClockBox.Text = DateTime.Now.ToString(settings.TimeFormat);
472+
}
473+
else
474+
{
475+
ClockBox.Visibility = Visibility.Collapsed;
476+
}
477+
478+
if (settings.UseDate)
479+
{
480+
DateBox.Visibility = Visibility.Visible;
481+
DateBox.Text = DateTime.Now.ToString(settings.DateFormat);
482+
}
483+
else
484+
{
485+
DateBox.Visibility = Visibility.Collapsed;
486+
}
487+
}
488+
469489
public void InitializePosition()
470490
{
471491
if (settings.SettingWindowTop >= 0 && settings.SettingWindowLeft >= 0)

0 commit comments

Comments
 (0)