[Peek][Settings] Peek OOBE page (#25895)

This commit is contained in:
Seraphima Zykova 2023-05-08 19:30:57 +02:00 committed by GitHub
parent 42d570b210
commit c6182a43bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 124 additions and 2 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
@ -155,6 +155,7 @@ namespace Microsoft.PowerToys.Settings.UI
case "Hosts": StartupPage = typeof(Views.HostsPage); break;
case "RegistryPreview": StartupPage = typeof(Views.RegistryPreviewPage); break;
case "PastePlain": StartupPage = typeof(Views.PastePlainPage); break;
case "Peek": StartupPage = typeof(Views.PeekPage); break;
default: Debug.Assert(false, "Unexpected SettingsWindow argument value"); break;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -16,6 +16,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Enums
ImageResizer,
KBM,
MouseUtils,
Peek,
PowerRename,
Run,
QuickAccent,

View File

@ -0,0 +1,48 @@
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
<!-- Licensed under the MIT License. -->
<Page
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobePeek"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkitcontrols="using:CommunityToolkit.WinUI.UI.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<controls:OOBEPageControl
x:Uid="Oobe_Peek"
HeroImage="ms-appx:///Assets/Modules/OOBE/Peek.gif">
<controls:OOBEPageControl.PageContent>
<StackPanel Orientation="Vertical">
<TextBlock
x:Uid="Oobe_HowToUse"
Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutWithTextLabelControl
x:Name="HotkeyControl"
x:Uid="Oobe_Peek_HowToUse" />
<StackPanel
Margin="0,24,0,0"
Orientation="Horizontal"
Spacing="12">
<Button
x:Uid="OOBE_Settings"
Click="SettingsLaunchButton_Click" />
<HyperlinkButton
NavigateUri="https://aka.ms/PowerToysOverview_Peek"
Style="{StaticResource TextButtonStyle}">
<TextBlock
x:Uid="LearnMore_Peek"
TextWrapping="Wrap" />
</HyperlinkButton>
</StackPanel>
</StackPanel>
</controls:OOBEPageControl.PageContent>
</controls:OOBEPageControl>
</Page>

View File

@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
using Microsoft.PowerToys.Settings.UI.Views;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Navigation;
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class OobePeek : Page
{
public OobePowerToysModule ViewModel { get; set; }
public OobePeek()
{
this.InitializeComponent();
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModules.Peek]);
DataContext = ViewModel;
}
private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
OobeShellPage.OpenMainWindowCallback(typeof(PeekPage));
}
ViewModel.LogOpeningSettingsEvent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
ViewModel.LogOpeningModuleEvent();
HotkeyControl.Keys = SettingsRepository<PeekSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.ActivationShortcut.GetKeysList();
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
ViewModel.LogClosingModuleEvent();
}
}
}

View File

@ -72,6 +72,10 @@
x:Uid="Shell_PastePlain"
Icon="{ui:BitmapIcon Source=/Assets/FluentIcons/FluentIconsPastePlain.png}"
Tag="PastePlain" />
<NavigationViewItem
x:Uid="Shell_Peek"
Icon="{ui:BitmapIcon Source=/Assets/FluentIcons/FluentIconsPeek.png}"
Tag="Peek" />
<NavigationViewItem
x:Uid="Shell_PowerRename"
Icon="{ui:BitmapIcon Source=/Assets/FluentIcons/FluentIconsPowerRename.png}"

View File

@ -115,6 +115,11 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
ModuleName = "MouseUtils",
IsNew = false,
});
Modules.Insert((int)PowerToysModules.Peek, new OobePowerToysModule()
{
ModuleName = "Peek",
IsNew = true,
});
Modules.Insert((int)PowerToysModules.PowerRename, new OobePowerToysModule()
{
ModuleName = "PowerRename",
@ -248,6 +253,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
case "Hosts": NavigationFrame.Navigate(typeof(OobeHosts)); break;
case "RegistryPreview": NavigationFrame.Navigate(typeof(OobeRegistryPreview)); break;
case "PastePlain": NavigationFrame.Navigate(typeof(OobePastePlain)); break;
case "Peek": NavigationFrame.Navigate(typeof(OobePeek)); break;
}
}
}

View File

@ -2035,6 +2035,10 @@ From there, simply click on one of the supported files in the File Explorer and
<value>Learn more about File Explorer add-ons</value>
<comment>File Explorer is a product name, localize as Windows does</comment>
</data>
<data name="LearnMore_Peek.Text" xml:space="preserve">
<value>Learn more about Peek</value>
<comment>Peek is a product name, do not loc</comment>
</data>
<data name="LearnMore_PowerRename.Text" xml:space="preserve">
<value>Learn more about PowerRename</value>
<comment>PowerRename is a product name, do not loc</comment>
@ -2503,7 +2507,7 @@ From there, simply click on one of the supported files in the File Explorer and
<data name="Shell_Peek.Content" xml:space="preserve">
<value>Peek</value>
<comment>Product name: Navigation view item name for Peek</comment>
</data>
</data>
<data name="Peek.ModuleTitle" xml:space="preserve">
<value>Peek</value>
</data>
@ -3189,4 +3193,13 @@ Activate by holding the key for the character you want to add an accent to, then
<value>Maximum width (px)</value>
<comment>px = pixels</comment>
</data>
<data name="Oobe_Peek.Description" xml:space="preserve">
<value>A lightning fast file preview feature for Windows.</value>
</data>
<data name="Oobe_Peek.Title" xml:space="preserve">
<value>Peek</value>
</data>
<data name="Oobe_Peek_HowToUse.Text" xml:space="preserve">
<value>to preview the selected file.</value>
</data>
</root>