Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3b0551f
- Add Clock Code
onesounds Aug 31, 2022
5c2a885
- Adjust Date Cultural info
onesounds Aug 31, 2022
a8bdb34
- Adjust Clock Color
onesounds Aug 31, 2022
4bb6ea9
- Adjust Alignment and color
onesounds Sep 1, 2022
9dc86fd
- Add Clock/Date Colors in Themes
onesounds Sep 1, 2022
d2332ab
- Add Clock/Date in SettingWindow
onesounds Sep 1, 2022
5758d96
Merge branch 'dev' into clock
onesounds Sep 3, 2022
8e6af08
Add Clock/Date Format Combobox UI in settingswindow
onesounds Sep 5, 2022
7ae6f2a
- Add Timeformat to changable list
onesounds Sep 5, 2022
7e0ef2a
- Refresh Preview when Change Time/Date Format
onesounds Sep 5, 2022
61cdc73
- Toggle Clock/Date Display in Theme Preview
onesounds Sep 5, 2022
0566a6c
Change the clock to it cannot be clicked
onesounds Sep 27, 2022
e4fddab
Merge branch 'dev' into clock
onesounds Sep 29, 2022
cd79a2a
Merge branch 'dev' into clock
onesounds Sep 29, 2022
52cd8a8
Adjust Clock Code
onesounds Oct 3, 2022
1af8101
Merge branch 'dev' into clock
onesounds Oct 3, 2022
aa75aa6
Fix Formatting
onesounds Oct 3, 2022
03d8b50
Fix Default TimeFormat
onesounds Oct 11, 2022
f97fdaf
Merge Dev
onesounds Oct 11, 2022
50702d8
Refactor Clcok/Date code to viewmodel
taooceros Oct 12, 2022
c733b95
Merge branch 'dev' into clock
onesounds Oct 14, 2022
de5c039
Merge Dev
onesounds Oct 25, 2022
cd6140d
Fix Conflicts
onesounds Oct 25, 2022
0357b32
Merge remote-tracking branch 'onesounds/dev' into clock
jjw24 Nov 1, 2022
6da3ca5
revert deleted sln config
jjw24 Nov 1, 2022
e54c91d
formatting
jjw24 Nov 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public string Language
public bool UseGlyphIcons { get; set; } = true;
public bool UseAnimation { get; set; } = true;
public bool UseSound { get; set; } = true;
public bool UseClock { get; set; } = true;
public bool UseDate { get; set; } = false;
public string TimeFormat { get; set; } = "hh:mm tt";
public string DateFormat { get; set; } = "MM'/'dd ddd";
public bool FirstLaunch { get; set; } = true;

public double SettingWindowWidth { get; set; } = 1000;
Expand Down
2 changes: 1 addition & 1 deletion Flow.Launcher/Helper/HotKeyMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal static class HotKeyMapper
internal static void Initialize(MainViewModel mainVM)
{
mainViewModel = mainVM;
settings = mainViewModel._settings;
settings = mainViewModel.Settings;

SetHotkey(settings.Hotkey, OnToggleHotkey);
LoadCustomPluginHotkey();
Expand Down
2 changes: 2 additions & 0 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@
<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="AnimationTip">Use Animation in UI</system:String>
<system:String x:Key="Clock">Clock</system:String>
<system:String x:Key="Date">Date</system:String>

<!-- Setting Hotkey -->
<system:String x:Key="hotkey">Hotkey</system:String>
Expand Down
222 changes: 120 additions & 102 deletions Flow.Launcher/MainWindow.xaml

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
using System.Windows.Media;
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Plugin.SharedCommands;
using System.Windows.Threading;
using System.Windows.Data;
using System.Diagnostics;

namespace Flow.Launcher
{
Expand All @@ -45,6 +45,7 @@ public MainWindow(Settings settings, MainViewModel mainVM)
DataContext = mainVM;
_viewModel = mainVM;
_settings = settings;

InitializeComponent();
InitializePosition();
animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav"));
Expand All @@ -54,6 +55,7 @@ public MainWindow()
{
InitializeComponent();
}

private void OnCopy(object sender, ExecutedRoutedEventArgs e)
{
if (QueryTextBox.SelectionLength == 0)
Expand Down
89 changes: 86 additions & 3 deletions Flow.Launcher/SettingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"
Expand Down Expand Up @@ -1810,8 +1809,11 @@
IsReadOnly="True"
Style="{DynamicResource QueryBoxStyle}"
Text="{DynamicResource hiThere}" />

</Border>
<StackPanel x:Name="ClockPanel" Style="{DynamicResource ClockPanel}">
<TextBlock x:Name="DateBox" Style="{DynamicResource DateBox}" />
<TextBlock x:Name="ClockBox" Style="{DynamicResource ClockBox}" />
</StackPanel>
<Canvas Style="{DynamicResource SearchIconPosition}">
<Path
Margin="0"
Expand Down Expand Up @@ -2134,7 +2136,88 @@
<StackPanel>

<Border
Margin="0,30,0,0"
Margin="0,24,0,12"
Padding="0"
CornerRadius="5"
Style="{DynamicResource SettingGroupBox}">
<StackPanel Orientation="Vertical">
<Border
Margin="0"
BorderThickness="0"
Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource Clock}" />
</StackPanel>
<StackPanel
Grid.Row="0"
Grid.Column="2"
Orientation="Horizontal">
<ComboBox
x:Name="TimeFormat"
Grid.Column="2"
MinWidth="180"
Margin="0,0,18,0"
VerticalAlignment="Center"
FontSize="14"
ItemsSource="{Binding TimeFormatList}"
SelectedValue="{Binding Settings.TimeFormat}"
SelectionChanged="PreviewClockAndDate" />
<ui:ToggleSwitch
IsOn="{Binding UseClock, Mode=TwoWay}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}"
Style="{DynamicResource SideToggleSwitch}"
Toggled="PreviewClockAndDate" />
</StackPanel>
<TextBlock Style="{StaticResource Glyph}">
&#xec92;
</TextBlock>
</ItemsControl>
</Border>
<Separator
Width="Auto"
BorderThickness="1"
Style="{StaticResource SettingSeparatorStyle}" />
<Border
Margin="0"
BorderThickness="0"
Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource Date}" />
</StackPanel>
<StackPanel
Grid.Row="0"
Grid.Column="2"
Orientation="Horizontal">
<ComboBox
x:Name="DateFormat"
Grid.Column="2"
MinWidth="180"
Margin="0,0,18,0"
VerticalAlignment="Center"
FontSize="14"
ItemsSource="{Binding DateFormatList}"
SelectedValue="{Binding Settings.DateFormat}"
SelectionChanged="PreviewClockAndDate" />
<ui:ToggleSwitch
IsOn="{Binding UseDate, Mode=TwoWay}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}"
Style="{DynamicResource SideToggleSwitch}"
Toggled="PreviewClockAndDate" />
</StackPanel>
<TextBlock Style="{StaticResource Glyph}">
&#xe787;
</TextBlock>
</ItemsControl>
</Border>
</StackPanel>
</Border>

<Border
Margin="0,12,0,12"
Padding="0"
CornerRadius="5"
Style="{DynamicResource SettingGroupBox}">
Expand Down
38 changes: 29 additions & 9 deletions Flow.Launcher/SettingWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
using Droplex;
using Flow.Launcher.Core.ExternalPlugins;
using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Core.Resource;
using Flow.Launcher.Helper;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.ViewModel;
using Microsoft.Win32;
using ModernWpf;
using System;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Navigation;
using Button = System.Windows.Controls.Button;
using Control = System.Windows.Controls.Control;
using ListViewItem = System.Windows.Controls.ListViewItem;
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
using MessageBox = System.Windows.MessageBox;
using TextBox = System.Windows.Controls.TextBox;
Expand Down Expand Up @@ -71,6 +63,7 @@ private void OnLoaded(object sender, RoutedEventArgs e)
pluginStoreView.Filter = PluginStoreFilter;

InitializePosition();
ClockDisplay();
}

private void OnSelectPythonDirectoryClick(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -466,6 +459,33 @@ private void PluginStore_OnKeyDown(object sender, KeyEventArgs e)
}
}

private void PreviewClockAndDate(object sender, RoutedEventArgs e)
{
ClockDisplay();
}
public void ClockDisplay()
{
if (settings.UseClock)
{
ClockBox.Visibility = Visibility.Visible;
ClockBox.Text = DateTime.Now.ToString(settings.TimeFormat);
}
else
{
ClockBox.Visibility = Visibility.Collapsed;
}

if (settings.UseDate)
{
DateBox.Visibility = Visibility.Visible;
DateBox.Text = DateTime.Now.ToString(settings.DateFormat);
}
else
{
DateBox.Visibility = Visibility.Collapsed;
}
}

public void InitializePosition()
{
if (settings.SettingWindowTop >= 0 && settings.SettingWindowLeft >= 0)
Expand Down
Loading