Merge branch 'master' of https://github.com/microsoft/PowerToys into microsoft-master

This commit is contained in:
Den Delimarsky
2021-04-07 17:12:51 -07:00
610 changed files with 21033 additions and 18367 deletions

View File

@@ -1,4 +1,4 @@
<Page
<Page
x:Class="Microsoft.PowerToys.Settings.UI.Views.ColorPickerPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -147,17 +147,22 @@
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"
Margin="{StaticResource SmallTopMargin}"/>
<!-- Disabled reordering by dragging -->
<!-- CanReorderItems="True" AllowDrop="True" -->
<ListView ItemsSource="{Binding ColorFormats, Mode=TwoWay}"
AllowDrop="True"
MaxWidth="466"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
AutomationProperties.LabeledBy="{Binding ElementName=ColorFormatsListViewLabel}"
CanReorderItems="True"
HorizontalAlignment="Left"
Margin="-12,6,0,0">
<ItemsControl.ItemContainerTransitions>
<TransitionCollection/>
</ItemsControl.ItemContainerTransitions>
<ListView.ItemTemplate>
<DataTemplate>
<Grid Width="466" Background="Transparent">
<!-- Disabled reordering by dragging
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="PointerEntered">
<Core:ChangePropertyAction TargetObject="{Binding ElementName=GripperIcon}" PropertyName="Visibility" Value="Visible" />
@@ -165,7 +170,19 @@
<Core:EventTriggerBehavior EventName="PointerExited">
<Core:ChangePropertyAction TargetObject="{Binding ElementName=GripperIcon}" PropertyName="Visibility" Value="Collapsed" />
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors> -->
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="PointerEntered">
<Core:ChangePropertyAction TargetObject="{Binding ElementName=ButtonUp}" PropertyName="Visibility" Value="Visible" />
<Core:ChangePropertyAction TargetObject="{Binding ElementName=ButtonDown}" PropertyName="Visibility" Value="Visible" />
</Core:EventTriggerBehavior>
<Core:EventTriggerBehavior EventName="PointerExited">
<Core:ChangePropertyAction TargetObject="{Binding ElementName=ButtonUp}" PropertyName="Visibility" Value="Collapsed" />
<Core:ChangePropertyAction TargetObject="{Binding ElementName=ButtonDown}" PropertyName="Visibility" Value="Collapsed" />
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
@@ -179,8 +196,13 @@
Grid.Row="1"
Margin="0,0,0,8"/>
<ToggleSwitch IsOn="{Binding IsShown, Mode=TwoWay}"
OnContent=""
OffContent=""
Grid.RowSpan="2"
HorizontalAlignment="Right" />
HorizontalAlignment="Right"
Margin="0,0,-36,0"/>
<!-- Disabled reordering by dragging
<TextBlock Text="&#xE76F;"
Visibility="Collapsed"
x:Name="GripperIcon"
@@ -189,7 +211,44 @@
FontSize="16"
HorizontalAlignment="Right"
Margin="0,0,36,0"
FontFamily="Segoe MDL2 Assets" />
FontFamily="Segoe MDL2 Assets" /> -->
<Button x:Uid="ColorPicker_ButtonUp"
x:Name="ButtonUp"
Content="&#xE74A;"
IsEnabled="{Binding CanMoveUp}"
Grid.Row="0"
HorizontalAlignment="Right"
Margin="0,0,24,0"
Background="Transparent"
Visibility="Collapsed"
FontFamily="Segoe MDL2 Assets"
Click="ReorderButtonUp_Click">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Click">
<Core:ChangePropertyAction TargetObject="{Binding ElementName=ButtonUp}" PropertyName="Visibility" Value="Collapsed" />
<Core:ChangePropertyAction TargetObject="{Binding ElementName=ButtonDown}" PropertyName="Visibility" Value="Collapsed" />
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</Button>
<Button x:Uid="ColorPicker_ButtonDown"
x:Name="ButtonDown"
Content="&#xE74B;"
IsEnabled="{Binding CanMoveDown}"
Grid.Row="1"
HorizontalAlignment="Right"
Margin="0,0,24,0"
Background="Transparent"
Visibility="Collapsed"
FontFamily="Segoe MDL2 Assets"
Click="ReorderButtonDown_Click" >
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Click">
<Core:ChangePropertyAction TargetObject="{Binding ElementName=ButtonUp}" PropertyName="Visibility" Value="Collapsed" />
<Core:ChangePropertyAction TargetObject="{Binding ElementName=ButtonDown}" PropertyName="Visibility" Value="Collapsed" />
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</Button>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>

View File

@@ -2,7 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.IO.Abstractions;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
using Windows.UI.Xaml.Controls;
@@ -48,5 +47,35 @@ namespace Microsoft.PowerToys.Settings.UI.Views
ColorPicker_ComboBox.SelectedIndex = index;
}
private void ReorderButtonUp_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
ColorFormatModel color = ((Button)sender).DataContext as ColorFormatModel;
if (color == null)
{
return;
}
var index = ViewModel.ColorFormats.IndexOf(color);
if (index > 0)
{
ViewModel.ColorFormats.Move(index, index - 1);
}
}
private void ReorderButtonDown_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
ColorFormatModel color = ((Button)sender).DataContext as ColorFormatModel;
if (color == null)
{
return;
}
var index = ViewModel.ColorFormats.IndexOf(color);
if (index < ViewModel.ColorFormats.Count - 1)
{
ViewModel.ColorFormats.Move(index, index + 1);
}
}
}
}

View File

@@ -189,6 +189,20 @@
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
<TextBlock x:Uid="FancyZones_QuickLayoutSwitch_GroupSettings"
Style="{StaticResource SettingsGroupTitleStyle}"
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
<CheckBox x:Uid="FancyZones_QuickLayoutSwitch"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.QuickLayoutSwitch}"
Margin="{StaticResource XSmallTopMargin}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"/>
<CheckBox x:Uid="FancyZones_FlashZonesOnQuickSwitch"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.FlashZonesOnQuickSwitch}"
Margin="24,8,0,0"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.QuickSwitchEnabled}"/>
<TextBlock x:Uid="Appearance_GroupSettings"
Style="{StaticResource SettingsGroupTitleStyle}"
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>

View File

@@ -195,11 +195,11 @@
<TextBlock x:Uid="General_Repository"/>
</HyperlinkButton>
<HyperlinkButton NavigateUri="https://github.com/microsoft/PowerToys/issues">
<HyperlinkButton NavigateUri="https://aka.ms/powerToysReportBug">
<TextBlock x:Uid="GeneralPage_ReportAbug"/>
</HyperlinkButton>
<HyperlinkButton NavigateUri="https://github.com/microsoft/PowerToys/issues">
<HyperlinkButton NavigateUri="https://aka.ms/powerToysRequestFeature">
<TextBlock x:Uid="GeneralPage_RequestAFeature_URL"/>
</HyperlinkButton>

View File

@@ -148,9 +148,30 @@
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
/>
<TextBlock x:Uid="Appearance_GroupSettings"
<TextBlock x:Uid="Run_PositionAppearance_GroupSettings"
Style="{StaticResource SettingsGroupTitleStyle}"
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher, Converter={StaticResource ModuleEnabledToForegroundConverter}}" />
<TextBlock x:Uid="Run_PositionHeader"
x:Name="RadioButtons_Name_Position"
Margin="{StaticResource SmallTopMargin}"
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher, Converter={StaticResource ModuleEnabledToForegroundConverter}}" />
<RadioButton x:Uid="Run_Radio_Position_Primary_Monitor"
GroupName="Run_Position"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.IsPrimaryMonitorPositionRadioButtonChecked}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"/>
<RadioButton x:Uid="Run_Radio_Position_Cursor"
GroupName="Run_Position"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.IsCursorPositionRadioButtonChecked}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"/>
<RadioButton x:Uid="Run_Radio_Position_Focus"
GroupName="Run_Position"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.IsFocusPositionRadioButtonChecked}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"/>
<!-- We cannot navigate to all the radio buttons using the arrow keys because of an XYNavigation issue in the RadioButtons control.
The screen reader does not read the heading when we tab into a radio button, even though the LabeledBy automation property is set.
Link to the issue in the winui repository - https://github.com/microsoft/microsoft-ui-xaml/issues/3156 -->
@@ -191,6 +212,11 @@
TextWrapping="Wrap"
Margin="{StaticResource SmallTopMargin}"/>
<TextBlock x:Uid="Run_PluginsLoading"
Visibility="{x:Bind ViewModel.ShowPluginsLoadingMessage, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
TextWrapping="Wrap"
Margin="{StaticResource SmallTopMargin}"/>
<ListView ItemsSource="{x:Bind Path=ViewModel.Plugins, Mode=OneWay}"
IsItemClickEnabled="True"
SelectionChanged="PluginsListView_SelectionChanged"

View File

@@ -4,11 +4,10 @@
using System;
using System.Collections.ObjectModel;
using System.Globalization;
using System.IO;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
@@ -24,8 +23,30 @@ namespace Microsoft.PowerToys.Settings.UI.Views
{
InitializeComponent();
var settingsUtils = new SettingsUtils();
ViewModel = new PowerLauncherViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, (int)Windows.System.VirtualKey.Space, App.IsDarkTheme);
PowerLauncherSettings settings = settingsUtils.GetSettingsOrDefault<PowerLauncherSettings>(PowerLauncherSettings.ModuleName);
ViewModel = new PowerLauncherViewModel(settings, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, App.IsDarkTheme);
DataContext = ViewModel;
_ = Helper.GetFileWatcher(PowerLauncherSettings.ModuleName, "settings.json", () =>
{
PowerLauncherSettings powerLauncherSettings = null;
try
{
powerLauncherSettings = settingsUtils.GetSettingsOrDefault<PowerLauncherSettings>(PowerLauncherSettings.ModuleName);
}
catch (IOException ex)
{
Logger.LogInfo(ex.Message);
}
if (powerLauncherSettings != null && !ViewModel.IsUpToDate(powerLauncherSettings))
{
_ = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
DataContext = ViewModel = new PowerLauncherViewModel(powerLauncherSettings, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, App.IsDarkTheme);
this.Bindings.Update();
});
}
});
var loader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();

View File

@@ -123,7 +123,7 @@
<HyperlinkButton x:Uid="FileExplorerPreview_ImageHyperlinkToDocs">
<TextBlock x:Uid="Module_overview" />
</HyperlinkButton>
<HyperlinkButton NavigateUri="https://github.com/microsoft/PowerToys/issues">
<HyperlinkButton NavigateUri="https://aka.ms/powerToysGiveFeedback">
<TextBlock x:Uid="Give_Feedback" />
</HyperlinkButton>
</StackPanel>

View File

@@ -111,6 +111,23 @@
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
<TextBlock x:Uid="Windows_Color_Settings" />
</HyperlinkButton>
<TextBlock x:Uid="ShortcutGuide_DisabledApps"
Style="{StaticResource SettingsGroupTitleStyle}"
Foreground="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToForegroundConverter}}"/>
<TextBox x:Uid="ShortcutGuide_DisabledApps_TextBoxControl"
Margin="{StaticResource SmallTopMargin}"
Text="{x:Bind Mode=TwoWay, Path=ViewModel.DisabledApps}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
ScrollViewer.VerticalScrollBarVisibility ="Visible"
ScrollViewer.VerticalScrollMode="Enabled"
ScrollViewer.IsVerticalRailEnabled="True"
TextWrapping="Wrap"
AcceptsReturn="True"
HorizontalAlignment="Left"
MinWidth="240"
MinHeight="160" />
</StackPanel>
<RelativePanel x:Name="SidePanel"