Skip to content

Commit d2332ab

Browse files
committed
- Add Clock/Date in SettingWindow
1 parent 9dc86fd commit d2332ab

File tree

5 files changed

+114
-11
lines changed

5 files changed

+114
-11
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public string Language
4242
public bool UseAnimation { get; set; } = true;
4343
public bool UseSound { get; set; } = true;
4444
public bool UseClock { get; set; } = true;
45-
public bool UseDate { get; set; } = true;
45+
public bool UseDate { get; set; } = false;
4646
public bool FirstLaunch { get; set; } = true;
4747

4848
public int CustomExplorerIndex { get; set; } = 0;

Flow.Launcher/Languages/en.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@
105105
<system:String x:Key="SoundEffectTip">Play a small sound when the search window opens</system:String>
106106
<system:String x:Key="Animation">Animation</system:String>
107107
<system:String x:Key="AnimationTip">Use Animation in UI</system:String>
108+
<system:String x:Key="Clock">Clock</system:String>
109+
<system:String x:Key="Date">Date</system:String>
108110

109111
<!-- Setting Hotkey -->
110112
<system:String x:Key="hotkey">Hotkey</system:String>

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,29 @@ private void Timer_Tick(object sender, EventArgs e)
8181
}
8282

8383

84+
}
85+
86+
public void ClockDisplay()
87+
{
88+
if (_settings.UseClock == true)
89+
{
90+
ClockBox.Visibility = Visibility.Visible;
91+
ClockBox.Text = System.DateTime.Now.ToString("tt hh:mm");
92+
}
93+
else if (_settings.UseClock == false)
94+
{
95+
ClockBox.Visibility = Visibility.Collapsed;
96+
}
97+
if (_settings.UseDate == true)
98+
{
99+
DateBox.Visibility = Visibility.Visible;
100+
DateBox.Text = System.DateTime.Now.ToString("MM/dd ddd");
101+
}
102+
else if (_settings.UseDate == false)
103+
{
104+
DateBox.Visibility = Visibility.Collapsed;
105+
}
106+
84107
}
85108
private void OnCopy(object sender, ExecutedRoutedEventArgs e)
86109
{
@@ -206,6 +229,12 @@ private void OnLoaded(object sender, RoutedEventArgs _)
206229
case nameof(Settings.Hotkey):
207230
UpdateNotifyIconText();
208231
break;
232+
case nameof(Settings.UseClock):
233+
ClockDisplay();
234+
break;
235+
case nameof(Settings.UseDate):
236+
ClockDisplay();
237+
break;
209238
}
210239
};
211240
}
@@ -378,7 +407,6 @@ public void WindowAnimator()
378407
_settings.WindowLeft = Left;
379408
_settings.WindowTop = Top;
380409
iconsb.Begin(SearchIcon);
381-
iconsb.Begin(ClockPanel);
382410
sb.Begin(FlowMainWindow);
383411
}
384412

Flow.Launcher/SettingWindow.xaml

Lines changed: 69 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,7 @@
597597
<StackPanel Style="{StaticResource TextPanel}">
598598
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource startFlowLauncherOnSystemStartup}" />
599599
</StackPanel>
600-
<CheckBox
601-
IsChecked="{Binding StartFlowLauncherOnSystemStartup}"
602-
Style="{DynamicResource SideControlCheckBox}" />
600+
<CheckBox IsChecked="{Binding StartFlowLauncherOnSystemStartup}" Style="{DynamicResource SideControlCheckBox}" />
603601
<TextBlock Style="{StaticResource Glyph}">
604602
&#xe8fc;
605603
</TextBlock>
@@ -1555,8 +1553,17 @@
15551553
IsReadOnly="True"
15561554
Style="{DynamicResource QueryBoxStyle}"
15571555
Text="{DynamicResource hiThere}" />
1558-
15591556
</Border>
1557+
<StackPanel x:Name="ClockPanel" Style="{DynamicResource ClockPanel}">
1558+
<TextBlock
1559+
x:Name="DateBox"
1560+
Style="{DynamicResource DateBox}"
1561+
Text="09-01 Thu" />
1562+
<TextBlock
1563+
x:Name="ClockBox"
1564+
Style="{DynamicResource ClockBox}"
1565+
Text="PM 12:04" />
1566+
</StackPanel>
15601567
<Canvas Style="{DynamicResource SearchIconPosition}">
15611568
<Path
15621569
Margin="0"
@@ -1792,9 +1799,9 @@
17921799
Margin="20,0,0,0"
17931800
HorizontalAlignment="Left"
17941801
VerticalAlignment="Top"
1802+
IsSynchronizedWithCurrentItem="False"
17951803
ItemsSource="{Binding Source={StaticResource SortedFonts}}"
1796-
SelectedItem="{Binding SelectedQueryBoxFont}"
1797-
IsSynchronizedWithCurrentItem="False" />
1804+
SelectedItem="{Binding SelectedQueryBoxFont}" />
17981805
<ComboBox
17991806
Width="130"
18001807
Margin="10,0,0,0"
@@ -1843,9 +1850,9 @@
18431850
Margin="20,-2,0,0"
18441851
HorizontalAlignment="Left"
18451852
VerticalAlignment="Top"
1853+
IsSynchronizedWithCurrentItem="False"
18461854
ItemsSource="{Binding Source={StaticResource SortedFonts}}"
1847-
SelectedItem="{Binding SelectedResultFont}"
1848-
IsSynchronizedWithCurrentItem="False" />
1855+
SelectedItem="{Binding SelectedResultFont}" />
18491856
<ComboBox
18501857
Width="130"
18511858
Margin="10,-2,0,0"
@@ -1877,7 +1884,60 @@
18771884
<StackPanel>
18781885

18791886
<Border
1880-
Margin="0,30,0,0"
1887+
Margin="0,24,0,12"
1888+
Padding="0"
1889+
CornerRadius="5"
1890+
Style="{DynamicResource SettingGroupBox}">
1891+
<StackPanel Orientation="Vertical">
1892+
<Border
1893+
Margin="0"
1894+
BorderThickness="0"
1895+
Style="{DynamicResource SettingGroupBox}">
1896+
<ItemsControl Style="{StaticResource SettingGrid}">
1897+
<StackPanel Style="{StaticResource TextPanel}">
1898+
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource Clock}" />
1899+
</StackPanel>
1900+
<ui:ToggleSwitch
1901+
Grid.Row="0"
1902+
Grid.Column="2"
1903+
IsOn="{Binding UseClock, Mode=TwoWay}"
1904+
OffContent="{DynamicResource disable}"
1905+
OnContent="{DynamicResource enable}"
1906+
Style="{DynamicResource SideToggleSwitch}" />
1907+
<TextBlock Style="{StaticResource Glyph}">
1908+
&#xec92;
1909+
</TextBlock>
1910+
</ItemsControl>
1911+
</Border>
1912+
<Separator
1913+
Width="Auto"
1914+
BorderThickness="1"
1915+
Style="{StaticResource SettingSeparatorStyle}" />
1916+
<Border
1917+
Margin="0"
1918+
BorderThickness="0"
1919+
Style="{DynamicResource SettingGroupBox}">
1920+
<ItemsControl Style="{StaticResource SettingGrid}">
1921+
<StackPanel Style="{StaticResource TextPanel}">
1922+
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource Date}" />
1923+
</StackPanel>
1924+
<ui:ToggleSwitch
1925+
Grid.Row="0"
1926+
Grid.Column="2"
1927+
IsOn="{Binding UseDate, Mode=TwoWay}"
1928+
OffContent="{DynamicResource disable}"
1929+
OnContent="{DynamicResource enable}"
1930+
Style="{DynamicResource SideToggleSwitch}" />
1931+
<TextBlock Style="{StaticResource Glyph}">
1932+
&#xe787;
1933+
</TextBlock>
1934+
</ItemsControl>
1935+
</Border>
1936+
</StackPanel>
1937+
</Border>
1938+
1939+
<Border
1940+
Margin="0,12,0,12"
18811941
Padding="0"
18821942
CornerRadius="5"
18831943
Style="{DynamicResource SettingGroupBox}">

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,19 @@ public bool UseSound
385385
set => Settings.UseSound = value;
386386
}
387387

388+
public bool UseClock
389+
{
390+
get => Settings.UseClock;
391+
set => Settings.UseClock = value;
392+
}
393+
394+
public bool UseDate
395+
{
396+
get => Settings.UseDate;
397+
set => Settings.UseDate = value;
398+
}
399+
400+
388401
public Brush PreviewBackground
389402
{
390403
get

0 commit comments

Comments
 (0)