Adjust advanced control UI

This commit is contained in:
DB p 2025-04-05 01:06:06 +09:00
parent 3ca958c860
commit a65e89b86f
4 changed files with 117 additions and 32 deletions

View file

@ -14,6 +14,28 @@ public class SettingsPanePluginsViewModel : BaseModel
{
private readonly Settings _settings;
public void UpdateDisplayModeFromSelection()
{
switch (CurrentDisplayMode)
{
case "OnOff":
IsOnOffSelected = true;
IsPrioritySelected = false;
IsSearchDelaySelected = false;
break;
case "Priority":
IsOnOffSelected = false;
IsPrioritySelected = true;
IsSearchDelaySelected = false;
break;
case "SearchDelay":
IsOnOffSelected = false;
IsPrioritySelected = false;
IsSearchDelaySelected = true;
break;
}
}
private bool _isOnOffSelected = true;
public bool IsOnOffSelected
{

View file

@ -196,6 +196,27 @@
</cc:Card>
</cc:CardGroup>
<cc:ExCard Margin="0 14 0 0" Title="{DynamicResource searchDelay}"
Icon="&#xE961;"
Sub="{DynamicResource searchDelayToolTip}">
<cc:ExCard.SideContent>
<ui:ToggleSwitch
IsOn="{Binding Settings.SearchQueryResultsWithDelay}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" />
</cc:ExCard.SideContent>
<cc:Card Type="InsideFit"
Title="{DynamicResource searchDelayTime}"
Sub="{DynamicResource searchDelayTimeToolTip}">
<ComboBox
MaxWidth="200"
DisplayMemberPath="Display"
ItemsSource="{Binding SearchDelayTimes}"
SelectedItem="{Binding SearchDelayTime}"
SelectedValuePath="Value" />
</cc:Card>
</cc:ExCard>
<cc:Card
Title="{DynamicResource defaultFileManager}"
Margin="0 14 0 0"

View file

@ -2,19 +2,19 @@
x:Class="Flow.Launcher.SettingPages.Views.SettingsPanePlugins"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls"
xmlns:converters="clr-namespace:Flow.Launcher.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:converters="clr-namespace:Flow.Launcher.Converters"
xmlns:viewModels="clr-namespace:Flow.Launcher.SettingPages.ViewModels"
xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls"
Title="Plugins"
FocusManager.FocusedElement="{Binding ElementName=PluginFilterTextbox}"
KeyDown="SettingsPanePlugins_OnKeyDown"
d:DataContext="{d:DesignInstance viewModels:SettingsPanePluginsViewModel}"
d:DesignHeight="450"
d:DesignWidth="800"
FocusManager.FocusedElement="{Binding ElementName=PluginFilterTextbox}"
KeyDown="SettingsPanePlugins_OnKeyDown"
mc:Ignorable="d">
<ui:Page.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
@ -34,34 +34,35 @@
Text="{DynamicResource plugins}"
TextAlignment="Left" />
<StackPanel
DockPanel.Dock="Right"
Orientation="Horizontal"
HorizontalAlignment="Right"
VerticalAlignment="Center">
<RadioButton
x:Name="OnOffToggle"
Content="OnOff"
VerticalAlignment="Center"
DockPanel.Dock="Right"
Orientation="Horizontal">
<TextBlock
Margin="0 0 6 0"
VerticalAlignment="Center"
FontSize="14"
Foreground="{DynamicResource Color15B}"
Text="Advanced Settings:" />
<ComboBox
x:Name="DisplayModeComboBox"
Width="150"
Height="34"
Margin="0 0 8 0"
IsChecked="{Binding IsOnOffSelected, Mode=TwoWay}"
GroupName="PluginToggleGroup"
Style="{StaticResource {x:Type ToggleButton}}" />
<RadioButton
x:Name="PriorityToggle"
Content="Priority"
Margin="0 0 4 0"
Background="{DynamicResource Color00B}"
SelectedValue="{Binding CurrentDisplayMode, Mode=TwoWay}"
SelectedValuePath="Content"
SelectionChanged="DisplayModeComboBox_SelectionChanged">
<ComboBoxItem Content="OnOff" IsSelected="True" />
<ComboBoxItem Content="Priority" />
<ComboBoxItem Content="SearchDelay" />
</ComboBox>
<Button
Width="34"
Height="34"
Margin="0 0 8 0"
IsChecked="{Binding IsPrioritySelected, Mode=TwoWay}"
GroupName="PluginToggleGroup"
Style="{StaticResource {x:Type ToggleButton}}" />
<RadioButton
x:Name="SearchDelayToggle"
Content="Search Delay"
Height="34"
Margin="0 0 8 0"
IsChecked="{Binding IsSearchDelaySelected, Mode=TwoWay}"
GroupName="PluginToggleGroup"
Style="{StaticResource {x:Type ToggleButton}}" />
Margin="0 0 20 0"
Content="?"
FontSize="14" />
<TextBox
Name="PluginFilterTextbox"
Width="150"
@ -74,17 +75,49 @@
ToolTip="{DynamicResource searchpluginToolTip}"
ToolTipService.InitialShowDelay="200"
ToolTipService.Placement="Top">
<TextBox.Style>
<Style BasedOn="{StaticResource DefaultTextBoxStyle}" TargetType="TextBox">
<Style.Resources>
<VisualBrush
x:Key="CueBannerBrush"
AlignmentX="Left"
AlignmentY="Center"
Stretch="None">
<VisualBrush.Visual>
<Label
Padding="10 0 0 0"
Content="{DynamicResource searchplugin}"
Foreground="{DynamicResource CustomContextDisabled}" />
</VisualBrush.Visual>
</VisualBrush>
</Style.Resources>
<Style.Triggers>
<Trigger Property="Text" Value="{x:Static sys:String.Empty}">
<Setter Property="Background" Value="{StaticResource CueBannerBrush}" />
</Trigger>
<Trigger Property="Text" Value="{x:Null}">
<Setter Property="Background" Value="{StaticResource CueBannerBrush}" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter Property="Background" Value="{DynamicResource Color02B}" />
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
</StackPanel>
</DockPanel>
<Border Grid.Row="1" Grid.Column="0" Background="{DynamicResource Color01B}">
<Border
Grid.Row="1"
Grid.Column="0"
Background="{DynamicResource Color01B}">
<ListBox
Margin="5 0 7 10"
Background="{DynamicResource Color01B}"
FontSize="14"
ItemsSource="{Binding FilteredPluginViewModels}"
ItemContainerStyle="{StaticResource PluginList}"
ItemsSource="{Binding FilteredPluginViewModels}"
ScrollViewer.CanContentScroll="False"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
SelectedItem="{Binding SelectedPlugin}"

View file

@ -3,6 +3,7 @@ using System.Windows.Navigation;
using CommunityToolkit.Mvvm.DependencyInjection;
using Flow.Launcher.SettingPages.ViewModels;
using Flow.Launcher.Infrastructure.UserSettings;
using System.Windows.Controls;
namespace Flow.Launcher.SettingPages.Views;
@ -21,6 +22,14 @@ public partial class SettingsPanePlugins
}
base.OnNavigatedTo(e);
}
private void DisplayModeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (DataContext is SettingsPanePluginsViewModel viewModel)
{
viewModel.UpdateDisplayModeFromSelection();
}
}
private void SettingsPanePlugins_OnKeyDown(object sender, KeyEventArgs e)
{