Add Browser Setting Popup

This commit is contained in:
DB p 2021-11-08 18:40:20 +09:00
parent 12b6f30033
commit fb97bc46f0
5 changed files with 349 additions and 71 deletions

View file

@ -36,6 +36,8 @@
<system:String x:Key="ignoreHotkeysOnFullscreenToolTip">Disable Flow Launcher activation when a full screen application is active (Recommended for games).</system:String>
<system:String x:Key="defaultFileManager">Default File Manager</system:String>
<system:String x:Key="defaultFileManagerToolTip">Select the file manager to use when opening the folder.</system:String>
<system:String x:Key="defaultBrowser">Default Web Browser</system:String>
<system:String x:Key="defaultBrowserToolTip">Setting for New Tab, New Window, Private Mode.</system:String>
<system:String x:Key="pythonDirectory">Python Directory</system:String>
<system:String x:Key="autoUpdates">Auto Update</system:String>
<system:String x:Key="selectPythonDirectory">Select</system:String>
@ -145,6 +147,16 @@
<system:String x:Key="fileManager_directory_arg">Arguments For Folder</system:String>
<system:String x:Key="fileManager_file_arg">Arguments For File</system:String>
<!-- DefaultBrowser Setting Dialog -->
<system:String x:Key="defaultBrowserTitle">Default Web Browser</system:String>
<system:String x:Key="defaultBrowser_tips">The default setting follows the OS default browser setting. If specified separately, flow uses that browser.</system:String>
<system:String x:Key="defaultBrowser_name">Browser</system:String>
<system:String x:Key="defaultBrowser_profile_name">Browser Name</system:String>
<system:String x:Key="defaultBrowser_path">Browser Path</system:String>
<system:String x:Key="defaultBrowser_newtab">New Window</system:String>
<system:String x:Key="defaultBrowser_newWindow">New Tab</system:String>
<system:String x:Key="defaultBrowser_parameter">Priviate Mode</system:String>
<!-- Priority Setting Dialog -->
<system:String x:Key="changePriorityWindow">Change Priority</system:String>
<system:String x:Key="priority_tips">Greater the number, the higher the result will be ranked. Try setting it as 5. If you want the results to be lower than any other plugin's, provide a negative number</system:String>

View file

@ -0,0 +1,214 @@
<Window
x:Class="Flow.Launcher.SelectBrowserWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Flow.Launcher"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
Title="{DynamicResource defaultBrowserTitle}"
Background="#f3f3f3"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
ResizeMode="NoResize"
SizeToContent="WidthAndHeight"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid Width="530">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="80" />
</Grid.RowDefinitions>
<Border
Padding="26,26,26,0"
Background="#ffffff"
BorderBrush="#e5e5e5"
BorderThickness="0,0,0,1">
<Grid>
<StackPanel>
<StackPanel Grid.Row="0" Margin="0,0,0,12">
<TextBlock
Grid.Column="0"
Margin="0,0,0,0"
FontFamily="Segoe UI"
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource defaultBrowserTitle}"
TextAlignment="Left" />
</StackPanel>
<StackPanel>
<TextBlock
FontSize="14"
Foreground="#1b1b1b"
Text="{DynamicResource defaultBrowser_tips}"
TextAlignment="Left"
TextWrapping="WrapWithOverflow" />
</StackPanel>
<StackPanel Margin="14,28,0,0" Orientation="Horizontal">
<TextBlock
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource defaultBrowser_name}" />
<ComboBox
Name="comboBox"
Width="200"
Height="35"
Margin="14,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
ItemsSource="{Binding CustomExplorers}"
SelectedIndex="{Binding SelectedCustomExplorerIndex}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button
Margin="10,0,0,0"
Click="btnAdd_Click"
Content="{DynamicResource add}" />
<Button
Margin="10,0,0,0"
Click="btnDelete_Click"
Content="{DynamicResource delete}"
IsEnabled="{Binding CustomExplorer.Editable}" />
</StackPanel>
<Rectangle
Height="1"
Margin="0,20,0,12"
Fill="#cecece" />
<StackPanel
Margin="0,0,0,0"
HorizontalAlignment="Stretch"
DataContext="{Binding CustomExplorer}"
Orientation="Horizontal">
<Grid Width="480">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="14,5,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource defaultBrowser_profile_name}" />
<TextBox
x:Name="ProfileTextBox"
Grid.Row="0"
Grid.Column="1"
Width="Auto"
Margin="10,5,15,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
IsEnabled="{Binding Editable}"
Text="{Binding Name}" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="14,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource defaultBrowser_path}" />
<TextBox
x:Name="PathTextBox"
Grid.Row="1"
Grid.Column="1"
Width="Auto"
Margin="10,10,15,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
IsEnabled="{Binding Editable}"
Text="{Binding Path}" />
<StackPanel
Grid.Row="2"
Grid.Column="1"
Margin="14,10,14,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<RadioButton GroupName="browser" IsChecked="True">New Tab</RadioButton>
<RadioButton GroupName="browser">New Window</RadioButton>
</StackPanel>
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="14,10,0,20"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource defaultBrowser_parameter}" />
<StackPanel
Grid.Row="3"
Grid.Column="1"
Margin="0,10,0,15"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBox
x:Name="fileArgTextBox"
Width="180"
Margin="10,0,0,0"
IsEnabled="{Binding Editable}"
Text="{Binding FileArgument}" />
<CheckBox Margin="12,0,0,0" VerticalAlignment="Center" />
</StackPanel>
</Grid>
</StackPanel>
</StackPanel>
</Grid>
</Border>
<StackPanel
Grid.Row="1"
HorizontalAlignment="Center"
Orientation="Horizontal">
<Button
x:Name="btnCancel"
Width="100"
Height="30"
Margin="0,0,5,0"
Click="btnCancel_Click"
Content="{DynamicResource cancel}" />
<Button
x:Name="btnDone"
Width="100"
Height="30"
Margin="5,0,0,0"
Click="btnDone_Click"
Content="{DynamicResource done}"
ForceCursor="True">
<Button.Style>
<Style BasedOn="{StaticResource DefaultButtonStyle}" TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding Text.Length, ElementName=ProfileTextBox, UpdateSourceTrigger=PropertyChanged}" Value="0">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
<DataTrigger Binding="{Binding Text.Length, ElementName=PathTextBox, UpdateSourceTrigger=PropertyChanged}" Value="0">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
<DataTrigger Binding="{Binding Text.Length, ElementName=directoryArgTextBox, UpdateSourceTrigger=PropertyChanged}" Value="0">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
<DataTrigger Binding="{Binding Text.Length, ElementName=fileArgTextBox, UpdateSourceTrigger=PropertyChanged}" Value="0">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</StackPanel>
</Grid>
</Window>

View file

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Flow.Launcher
{
/// <summary>
/// SelectBrowserWindow.xaml에 대한 상호 작용 논리
/// </summary>
public partial class SelectBrowserWindow : Window
{
public SelectBrowserWindow()
{
InitializeComponent();
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
}
private void btnDone_Click(object sender, RoutedEventArgs e)
{
}
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
}
private void btnDelete_Click(object sender, RoutedEventArgs e)
{
}
}
}

View file

@ -688,78 +688,79 @@
</StackPanel>
</Border>
<Border Margin="0,30,0,0" Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Text="{DynamicResource defaultFileManager}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource defaultFileManagerToolTip}" />
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal">
<Button
Width="160"
MaxWidth="250"
Margin="10,0,18,0"
Click="OnSelectFileManagerClick"
Content="{Binding Settings.CustomExplorer.Name}">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2" />
<Setter Property="BorderThickness" Value="1,1,1,2" />
<Setter Property="BorderBrush" Value="#ececec" />
<Setter Property="Background" Value="#ffffff" />
</Style>
</Button.Resources>
</Button>
</StackPanel>
<TextBlock
Grid.Column="0"
Margin="24,0,16,0"
VerticalAlignment="Center"
FontFamily="/Resources/#Segoe Fluent Icons"
FontSize="20">
&#xe838;
</TextBlock>
</ItemsControl>
</Border>
<Border Margin="0,30,0,0" Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Text="{DynamicResource defaultFileManager}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource defaultFileManagerToolTip}" />
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal">
<Button
Width="160"
MaxWidth="250"
Margin="10,0,18,0"
Click="OnSelectFileManagerClick"
Content="{Binding Settings.CustomExplorer.Name}">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2" />
<Setter Property="BorderThickness" Value="1,1,1,2" />
<Setter Property="BorderBrush" Value="#ececec" />
<Setter Property="Background" Value="#ffffff" />
</Style>
</Button.Resources>
</Button>
</StackPanel>
<TextBlock
Grid.Column="0"
Margin="24,0,16,0"
VerticalAlignment="Center"
FontFamily="/Resources/#Segoe Fluent Icons"
FontSize="20">
&#xe838;
</TextBlock>
</ItemsControl>
<Border
Margin="0,30,0,0"
Padding="0"
CornerRadius="5"
Style="{DynamicResource SettingGroupBox}">
<StackPanel Orientation="Vertical">
<Border
Margin="0,0,0,0"
BorderThickness="0"
Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Text="{DynamicResource defaultFileManager}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource defaultFileManagerToolTip}" />
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal">
<Button
Width="160"
MaxWidth="250"
Margin="10,0,18,0"
Click="OnSelectFileManagerClick"
Content="{Binding Settings.CustomExplorer.Name}" />
</StackPanel>
<TextBlock
Grid.Column="0"
Margin="24,0,16,0"
VerticalAlignment="Center"
FontFamily="/Resources/#Segoe Fluent Icons"
FontSize="20">
&#xe838;
</TextBlock>
</ItemsControl>
</Border>
<Separator
Width="Auto"
BorderBrush="#e5e5e5"
BorderThickness="1" />
<Border
Margin="0,0,0,0"
BorderThickness="0"
Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Text="{DynamicResource defaultBrowser}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource defaultBrowserToolTip}" />
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal">
<Button
Width="160"
MaxWidth="250"
Margin="10,0,18,0"
Click="OnSelectDefaultBrowserClick"
Content="Google Chrome" />
</StackPanel>
<TextBlock
Grid.Column="0"
Margin="24,0,16,0"
VerticalAlignment="Center"
FontFamily="/Resources/#Segoe Fluent Icons"
FontSize="20">
&#xf6fa;
</TextBlock>
</ItemsControl>
</Border>
</StackPanel>
</Border>
<Border Margin="0,30,0,0" Style="{DynamicResource SettingGroupBox}">

View file

@ -121,6 +121,12 @@ namespace Flow.Launcher
fileManagerChangeWindow.ShowDialog();
}
private void OnSelectDefaultBrowserClick(object sender, RoutedEventArgs e)
{
SelectBrowserWindow test = new SelectBrowserWindow();
test.ShowDialog();
}
#endregion
#region Hotkey