mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-29 16:36:40 +01:00
Compare commits
15 Commits
shawn/fixA
...
dev/vanzue
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7c244da6c | ||
|
|
93bf653f9c | ||
|
|
b7eed480ba | ||
|
|
dce61bcb9d | ||
|
|
056328823f | ||
|
|
73f789b062 | ||
|
|
57f0b4b342 | ||
|
|
0e922a4dcb | ||
|
|
d7785977d8 | ||
|
|
bb604d87ca | ||
|
|
ccaa876af2 | ||
|
|
4a5e476a4e | ||
|
|
5c96cea31f | ||
|
|
e7de5c7b8d | ||
|
|
d737e22d16 |
1
.github/actions/spell-check/excludes.txt
vendored
1
.github/actions/spell-check/excludes.txt
vendored
@@ -105,6 +105,7 @@
|
||||
^src/common/notifications/BackgroundActivatorDLL/cpp\.hint$
|
||||
^src/common/sysinternals/Eula/
|
||||
^src/modules/cmdpal/doc/initial-sdk-spec/list-elements-mock-002\.pdn$
|
||||
^src/modules/cmdpal/ext/SamplePagesExtension/Pages/SampleMarkdownImagesPage\.cs$
|
||||
^src/modules/colorPicker/ColorPickerUI/Shaders/GridShader\.cso$
|
||||
^src/modules/launcher/Plugins/Microsoft\.PowerToys\.Run\.Plugin\.TimeDate/Properties/
|
||||
^src/modules/MouseUtils/MouseJumpUI/MainForm\.resx$
|
||||
|
||||
7
.github/actions/spell-check/expect.txt
vendored
7
.github/actions/spell-check/expect.txt
vendored
@@ -101,7 +101,6 @@ ATX
|
||||
ATRIOX
|
||||
aumid
|
||||
authenticode
|
||||
Authenticode
|
||||
AUTOBUDDY
|
||||
AUTOCHECKBOX
|
||||
AUTOHIDE
|
||||
@@ -316,7 +315,6 @@ CURSORINFO
|
||||
cursorpos
|
||||
CURSORSHOWING
|
||||
CURSORWRAP
|
||||
CursorWrap
|
||||
customaction
|
||||
CUSTOMACTIONTEST
|
||||
CUSTOMFORMATPLACEHOLDER
|
||||
@@ -432,7 +430,6 @@ DSTINVERT
|
||||
DString
|
||||
DSVG
|
||||
dto
|
||||
DTo
|
||||
DUMMYUNIONNAME
|
||||
dutil
|
||||
DVASPECT
|
||||
@@ -466,7 +463,6 @@ EDITKEYBOARD
|
||||
EDITSHORTCUTS
|
||||
EDITTEXT
|
||||
EFile
|
||||
ekus
|
||||
eku
|
||||
emojis
|
||||
ENABLEDELAYEDEXPANSION
|
||||
@@ -1152,7 +1148,6 @@ NONCLIENTMETRICSW
|
||||
NONELEVATED
|
||||
nonspace
|
||||
nonstd
|
||||
nullrefs
|
||||
NOOWNERZORDER
|
||||
NOPARENTNOTIFY
|
||||
NOPREFIX
|
||||
@@ -1192,8 +1187,8 @@ ntfs
|
||||
NTSTATUS
|
||||
NTSYSAPI
|
||||
NULLCURSOR
|
||||
nullref
|
||||
nullonfailure
|
||||
nullref
|
||||
numberbox
|
||||
nwc
|
||||
ocr
|
||||
|
||||
2
.github/actions/spell-check/patterns.txt
vendored
2
.github/actions/spell-check/patterns.txt
vendored
@@ -253,7 +253,7 @@ _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING
|
||||
|
||||
# hit-count: 1 file-count: 1
|
||||
# Amazon
|
||||
\bamazon\.com/[-\w]+/(?:dp/[0-9A-Z]+|)[^"'\s]+
|
||||
\bamazon\.com/[-\w]+/(?:dp/[0-9A-Z]+|)
|
||||
|
||||
# hit-count: 3 file-count: 3
|
||||
# imgur
|
||||
|
||||
@@ -52,8 +52,6 @@ extends:
|
||||
name: SHINE-INT-S
|
||||
${{ if eq(parameters.useVSPreview, true) }}:
|
||||
demands: ImageOverride -equals SHINE-VS17-Preview
|
||||
${{ else }}:
|
||||
image: SHINE-VS17-Latest
|
||||
os: windows
|
||||
sdl:
|
||||
tsa:
|
||||
@@ -75,7 +73,6 @@ extends:
|
||||
name: SHINE-INT-L
|
||||
demands:
|
||||
# Our INT agents have a large disk mounted at P:\
|
||||
- WorkFolder -equals P:\_work
|
||||
- ${{ if eq(parameters.useVSPreview, true) }}:
|
||||
- ImageOverride -equals SHINE-VS17-Preview
|
||||
os: windows
|
||||
@@ -126,7 +123,6 @@ extends:
|
||||
parameters:
|
||||
pool:
|
||||
name: SHINE-INT-L
|
||||
image: SHINE-VS17-Latest
|
||||
os: windows
|
||||
official: true
|
||||
codeSign: true
|
||||
|
||||
@@ -111,6 +111,7 @@ jobs:
|
||||
${{ else }}:
|
||||
OutputBuildPlatform: ${{ platform }}
|
||||
variables:
|
||||
NUGET_PACKAGES: 'C:\NuGetPackages' # Some of our build steps cache these here... and it was apparently part of the global environment
|
||||
MakeAppxPath: 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\MakeAppx.exe'
|
||||
# Azure DevOps abhors a vacuum
|
||||
# If these are blank, expansion will fail later on... which will result in direct substitution of the variable *names*
|
||||
@@ -139,6 +140,10 @@ jobs:
|
||||
- output: pipelineArtifact
|
||||
artifactName: $(JobOutputArtifactName)
|
||||
targetPath: $(Build.ArtifactStagingDirectory)
|
||||
- output: pipelineArtifact
|
||||
artifactName: $(JobOutputArtifactName)-failure-$(System.JobAttempt)
|
||||
targetPath: $(LogOutputDirectory)
|
||||
condition: or(failed(), canceled())
|
||||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
@@ -395,7 +400,7 @@ jobs:
|
||||
### HACK: On ARM64 builds, building an app with Windows App SDK copies the x64 WebView2 dll instead of the ARM64 one. This task makes sure the right dll is used.
|
||||
- task: CopyFiles@2
|
||||
displayName: HACK Copy core WebView2 ARM64 dll to output directory
|
||||
condition: eq(variables['BuildPlatform'],'arm64')
|
||||
condition: and(succeeded(), eq(variables['BuildPlatform'], 'arm64'))
|
||||
inputs:
|
||||
contents: packages/Microsoft.Web.WebView2.1.0.2903.40/runtimes/win-ARM64/native_uap/Microsoft.Web.WebView2.Core.dll
|
||||
targetFolder: $(Build.SourcesDirectory)/ARM64/Release/WinUI3Apps/
|
||||
@@ -434,11 +439,11 @@ jobs:
|
||||
inputs:
|
||||
testResultsFormat: VSTest
|
||||
testResultsFiles: '**/*.trx'
|
||||
condition: ne(variables['BuildPlatform'],'arm64')
|
||||
condition: and(succeeded(), ne(variables['BuildPlatform'], 'arm64'))
|
||||
|
||||
# Native dlls
|
||||
- task: VSTest@2
|
||||
condition: ne(variables['BuildPlatform'],'arm64') # No arm64 agents to run the tests.
|
||||
condition: and(succeeded(), ne(variables['BuildPlatform'], 'arm64')) # No arm64 agents to run the tests.
|
||||
displayName: 'Native Tests'
|
||||
inputs:
|
||||
platform: '$(BuildPlatform)'
|
||||
|
||||
175
src/common/UITestAutomation/SettingsConfigHelper.cs
Normal file
175
src/common/UITestAutomation/SettingsConfigHelper.cs
Normal file
@@ -0,0 +1,175 @@
|
||||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
|
||||
namespace Microsoft.PowerToys.UITest
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class for configuring PowerToys settings for UI tests.
|
||||
/// </summary>
|
||||
public class SettingsConfigHelper
|
||||
{
|
||||
private static readonly JsonSerializerOptions IndentedJsonOptions = new() { WriteIndented = true };
|
||||
private static readonly SettingsUtils SettingsUtils = new SettingsUtils();
|
||||
|
||||
/// <summary>
|
||||
/// Configures global PowerToys settings to enable only specified modules and disable all others.
|
||||
/// </summary>
|
||||
/// <param name="modulesToEnable">Array of module names to enable (e.g., "Peek", "FancyZones"). All other modules will be disabled.</param>
|
||||
/// <exception cref="ArgumentNullException">Thrown when modulesToEnable is null.</exception>
|
||||
/// <exception cref="InvalidOperationException">Thrown when settings file operations fail.</exception>
|
||||
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "This is test code and will not be trimmed")]
|
||||
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "This is test code and will not be AOT compiled")]
|
||||
public static void ConfigureGlobalModuleSettings(params string[] modulesToEnable)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(modulesToEnable);
|
||||
|
||||
try
|
||||
{
|
||||
GeneralSettings settings;
|
||||
try
|
||||
{
|
||||
settings = SettingsUtils.GetSettingsOrDefault<GeneralSettings>();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine($"Failed to load settings, creating defaults: {ex.Message}");
|
||||
settings = new GeneralSettings();
|
||||
}
|
||||
|
||||
string settingsJson = settings.ToJsonString();
|
||||
using (JsonDocument doc = JsonDocument.Parse(settingsJson))
|
||||
{
|
||||
var options = new JsonSerializerOptions { WriteIndented = true };
|
||||
var root = doc.RootElement.Clone();
|
||||
|
||||
if (root.TryGetProperty("enabled", out var enabledElement))
|
||||
{
|
||||
var enabledModules = new Dictionary<string, bool>();
|
||||
|
||||
foreach (var property in enabledElement.EnumerateObject())
|
||||
{
|
||||
string moduleName = property.Name;
|
||||
|
||||
bool shouldEnable = Array.Exists(modulesToEnable, m => string.Equals(m, moduleName, StringComparison.Ordinal));
|
||||
enabledModules[moduleName] = shouldEnable;
|
||||
}
|
||||
|
||||
var settingsDict = JsonSerializer.Deserialize<Dictionary<string, object>>(settingsJson);
|
||||
if (settingsDict != null)
|
||||
{
|
||||
settingsDict["enabled"] = enabledModules;
|
||||
settingsJson = JsonSerializer.Serialize(settingsDict, IndentedJsonOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SettingsUtils.SaveSettings(settingsJson);
|
||||
|
||||
string enabledList = modulesToEnable.Length > 0 ? string.Join(", ", modulesToEnable) : "none";
|
||||
Debug.WriteLine($"Successfully updated global settings");
|
||||
Debug.WriteLine($"Enabled modules: {enabledList}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine($"ERROR in ConfigureGlobalModuleSettings: {ex.Message}");
|
||||
throw new InvalidOperationException($"Failed to configure global module settings: {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates a module's settings file. If the file doesn't exist, creates it with default content.
|
||||
/// If the file exists, reads it and applies the provided update function to modify the settings.
|
||||
/// </summary>
|
||||
/// <param name="moduleName">The name of the module (e.g., "Peek", "FancyZones").</param>
|
||||
/// <param name="defaultSettingsContent">The default JSON content to use if the settings file doesn't exist.</param>
|
||||
/// <param name="updateSettingsAction">
|
||||
/// A callback function that modifies the settings dictionary. The function receives the deserialized settings
|
||||
/// and should modify it in-place. The function should accept a Dictionary<string, object> and not return a value.
|
||||
/// Example: (settings) => { ((Dictionary<string, object>)settings["properties"])["SomeSetting"] = newValue; }
|
||||
/// </param>
|
||||
/// <exception cref="ArgumentNullException">Thrown when moduleName or updateSettingsAction is null.</exception>
|
||||
/// <exception cref="InvalidOperationException">Thrown when settings file operations fail.</exception>
|
||||
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "This is test code and will not be trimmed")]
|
||||
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "This is test code and will not be AOT compiled")]
|
||||
public static void UpdateModuleSettings(
|
||||
string moduleName,
|
||||
string defaultSettingsContent,
|
||||
Action<Dictionary<string, object>> updateSettingsAction)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(moduleName);
|
||||
ArgumentNullException.ThrowIfNull(updateSettingsAction);
|
||||
|
||||
try
|
||||
{
|
||||
// Build the path to the module settings file
|
||||
string powerToysSettingsDirectory = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"Microsoft",
|
||||
"PowerToys");
|
||||
|
||||
string moduleDirectory = Path.Combine(powerToysSettingsDirectory, moduleName);
|
||||
string settingsPath = Path.Combine(moduleDirectory, "settings.json");
|
||||
|
||||
// Ensure directory exists
|
||||
Directory.CreateDirectory(moduleDirectory);
|
||||
|
||||
// Read existing settings or use default
|
||||
string existingJson = string.Empty;
|
||||
if (File.Exists(settingsPath))
|
||||
{
|
||||
existingJson = File.ReadAllText(settingsPath);
|
||||
}
|
||||
|
||||
Dictionary<string, object>? settings;
|
||||
|
||||
// If file doesn't exist or is empty, create from defaults
|
||||
if (string.IsNullOrWhiteSpace(existingJson))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(defaultSettingsContent))
|
||||
{
|
||||
throw new ArgumentException("Default settings content must be provided when file doesn't exist.", nameof(defaultSettingsContent));
|
||||
}
|
||||
|
||||
settings = JsonSerializer.Deserialize<Dictionary<string, object>>(defaultSettingsContent)
|
||||
?? throw new InvalidOperationException($"Failed to deserialize default settings for {moduleName}");
|
||||
|
||||
Debug.WriteLine($"Created default settings for {moduleName} at {settingsPath}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Parse existing settings
|
||||
settings = JsonSerializer.Deserialize<Dictionary<string, object>>(existingJson)
|
||||
?? throw new InvalidOperationException($"Failed to deserialize existing settings for {moduleName}");
|
||||
|
||||
Debug.WriteLine($"Loaded existing settings for {moduleName} from {settingsPath}");
|
||||
}
|
||||
|
||||
// Apply the update action to modify settings
|
||||
updateSettingsAction(settings);
|
||||
|
||||
// Serialize and save the updated settings using SettingsUtils
|
||||
string updatedJson = JsonSerializer.Serialize(settings, IndentedJsonOptions);
|
||||
SettingsUtils.SaveSettings(updatedJson, moduleName);
|
||||
|
||||
Debug.WriteLine($"Successfully updated settings for {moduleName}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine($"ERROR in UpdateModuleSettings for {moduleName}: {ex.Message}");
|
||||
throw new InvalidOperationException($"Failed to update settings for {moduleName}: {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<PublishAot>true</PublishAot>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
|
||||
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<PublishTrimmed>false</PublishTrimmed>
|
||||
</PropertyGroup>
|
||||
@@ -21,4 +21,8 @@
|
||||
<PackageReference Include="CoenM.ImageSharp.ImageHash" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -542,7 +542,10 @@
|
||||
Source="{x:Bind ViewModel.ActiveAIProvider?.ServiceType, Mode=OneWay, Converter={StaticResource ServiceTypeToIconConverter}}" />
|
||||
</DropDownButton.Content>
|
||||
<DropDownButton.Flyout>
|
||||
<Flyout Placement="Bottom" ShouldConstrainToRootBounds="False">
|
||||
<Flyout
|
||||
Opened="AIProviderFlyout_Opened"
|
||||
Placement="Bottom"
|
||||
ShouldConstrainToRootBounds="False">
|
||||
<Grid
|
||||
Width="386"
|
||||
Margin="-4"
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace AdvancedPaste.Controls
|
||||
{
|
||||
public OptionsViewModel ViewModel { get; private set; }
|
||||
|
||||
private bool _syncingProviderSelection;
|
||||
|
||||
public static readonly DependencyProperty PlaceholderTextProperty = DependencyProperty.Register(
|
||||
nameof(PlaceholderText),
|
||||
typeof(string),
|
||||
@@ -74,6 +76,11 @@ namespace AdvancedPaste.Controls
|
||||
var state = ViewModel.IsBusy ? "LoadingState" : ViewModel.PasteActionError.HasText ? "ErrorState" : "DefaultState";
|
||||
VisualStateManager.GoToState(this, state, true);
|
||||
}
|
||||
|
||||
if (e.PropertyName is nameof(ViewModel.ActiveAIProvider) or nameof(ViewModel.AIProviders))
|
||||
{
|
||||
SyncProviderSelection();
|
||||
}
|
||||
}
|
||||
|
||||
private void ViewModel_PreviewRequested(object sender, EventArgs e)
|
||||
@@ -87,6 +94,7 @@ namespace AdvancedPaste.Controls
|
||||
private void Grid_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
InputTxtBox.Focus(FocusState.Programmatic);
|
||||
SyncProviderSelection();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
@@ -126,18 +134,56 @@ namespace AdvancedPaste.Controls
|
||||
Loader.IsLoading = loading;
|
||||
}
|
||||
|
||||
private void SyncProviderSelection()
|
||||
{
|
||||
if (AIProviderListView is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_syncingProviderSelection = true;
|
||||
AIProviderListView.SelectedItem = ViewModel.ActiveAIProvider;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_syncingProviderSelection = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void AIProviderFlyout_Opened(object sender, object e)
|
||||
{
|
||||
SyncProviderSelection();
|
||||
}
|
||||
|
||||
private async void AIProviderListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (AIProviderListView.SelectedItem is PasteAIProviderDefinition provider)
|
||||
if (_syncingProviderSelection)
|
||||
{
|
||||
if (ViewModel.SetActiveProviderCommand.CanExecute(provider))
|
||||
{
|
||||
await ViewModel.SetActiveProviderCommand.ExecuteAsync(provider);
|
||||
}
|
||||
|
||||
var flyout = FlyoutBase.GetAttachedFlyout(AIProviderButton);
|
||||
flyout?.Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
var flyout = FlyoutBase.GetAttachedFlyout(AIProviderButton);
|
||||
|
||||
if (AIProviderListView.SelectedItem is not PasteAIProviderDefinition provider)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.Equals(ViewModel.ActiveAIProvider?.Id, provider.Id, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
flyout?.Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ViewModel.SetActiveProviderCommand.CanExecute(provider))
|
||||
{
|
||||
await ViewModel.SetActiveProviderCommand.ExecuteAsync(provider);
|
||||
SyncProviderSelection();
|
||||
}
|
||||
|
||||
flyout?.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,13 +280,15 @@
|
||||
x:Uid="TermsLink"
|
||||
Padding="0"
|
||||
FontSize="12"
|
||||
NavigateUri="https://openai.com/policies/terms-of-use" />
|
||||
NavigateUri="{x:Bind ViewModel.TermsLinkUri, Mode=OneWay}"
|
||||
Visibility="{x:Bind ViewModel.HasTermsLink, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<HyperlinkButton
|
||||
x:Name="PrivacyHyperLink"
|
||||
x:Uid="PrivacyLink"
|
||||
Padding="0"
|
||||
FontSize="12"
|
||||
NavigateUri="https://openai.com/policies/privacy-policy" />
|
||||
NavigateUri="{x:Bind ViewModel.PrivacyLinkUri, Mode=OneWay}"
|
||||
Visibility="{x:Bind ViewModel.HasPrivacyLink, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
|
||||
@@ -71,6 +71,11 @@ namespace AdvancedPaste.ViewModels
|
||||
[NotifyPropertyChangedFor(nameof(IsCustomAIAvailable))]
|
||||
[NotifyPropertyChangedFor(nameof(AllowedAIProviders))]
|
||||
[NotifyPropertyChangedFor(nameof(ActiveAIProvider))]
|
||||
[NotifyPropertyChangedFor(nameof(ActiveAIProviderTooltip))]
|
||||
[NotifyPropertyChangedFor(nameof(TermsLinkUri))]
|
||||
[NotifyPropertyChangedFor(nameof(PrivacyLinkUri))]
|
||||
[NotifyPropertyChangedFor(nameof(HasTermsLink))]
|
||||
[NotifyPropertyChangedFor(nameof(HasPrivacyLink))]
|
||||
private bool _isAllowedByGPO;
|
||||
|
||||
[ObservableProperty]
|
||||
@@ -187,6 +192,35 @@ namespace AdvancedPaste.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private AIServiceTypeMetadata GetActiveProviderMetadata()
|
||||
{
|
||||
var provider = ActiveAIProvider ?? AllowedAIProviders.FirstOrDefault();
|
||||
var serviceType = provider?.ServiceTypeKind ?? AIServiceType.OpenAI;
|
||||
return AIServiceTypeRegistry.GetMetadata(serviceType);
|
||||
}
|
||||
|
||||
public Uri TermsLinkUri
|
||||
{
|
||||
get
|
||||
{
|
||||
var metadata = GetActiveProviderMetadata();
|
||||
return metadata.HasTermsLink ? metadata.TermsUri : null;
|
||||
}
|
||||
}
|
||||
|
||||
public Uri PrivacyLinkUri
|
||||
{
|
||||
get
|
||||
{
|
||||
var metadata = GetActiveProviderMetadata();
|
||||
return metadata.HasPrivacyLink ? metadata.PrivacyUri : null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasTermsLink => GetActiveProviderMetadata().HasTermsLink;
|
||||
|
||||
public bool HasPrivacyLink => GetActiveProviderMetadata().HasPrivacyLink;
|
||||
|
||||
public bool ClipboardHasData => AvailableClipboardFormats != ClipboardFormat.None;
|
||||
|
||||
public bool ClipboardHasDataForCustomAI => PasteFormat.SupportsClipboardFormats(CustomAIFormat, AvailableClipboardFormats);
|
||||
@@ -276,8 +310,8 @@ namespace AdvancedPaste.ViewModels
|
||||
OnPropertyChanged(nameof(IsAdvancedAIEnabled));
|
||||
OnPropertyChanged(nameof(AIProviders));
|
||||
OnPropertyChanged(nameof(AllowedAIProviders));
|
||||
OnPropertyChanged(nameof(ActiveAIProvider));
|
||||
OnPropertyChanged(nameof(ActiveAIProviderTooltip));
|
||||
|
||||
NotifyActiveProviderChanged();
|
||||
|
||||
EnqueueRefreshPasteFormats();
|
||||
}
|
||||
@@ -316,8 +350,17 @@ namespace AdvancedPaste.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
NotifyActiveProviderChanged();
|
||||
}
|
||||
|
||||
private void NotifyActiveProviderChanged()
|
||||
{
|
||||
OnPropertyChanged(nameof(ActiveAIProvider));
|
||||
OnPropertyChanged(nameof(ActiveAIProviderTooltip));
|
||||
OnPropertyChanged(nameof(TermsLinkUri));
|
||||
OnPropertyChanged(nameof(PrivacyLinkUri));
|
||||
OnPropertyChanged(nameof(HasTermsLink));
|
||||
OnPropertyChanged(nameof(HasPrivacyLink));
|
||||
}
|
||||
|
||||
private void RefreshPasteFormats()
|
||||
@@ -837,6 +880,7 @@ namespace AdvancedPaste.ViewModels
|
||||
|
||||
UpdateAIProviderActiveFlags();
|
||||
OnPropertyChanged(nameof(AIProviders));
|
||||
NotifyActiveProviderChanged();
|
||||
EnqueueRefreshPasteFormats();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<PreprocessorDefinitions>_DEBUG;NEWPLUSSHELLEXTENSIONWIN10_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>..\..\..\common\Telemetry;..\..\;..\..\..\;%(AdditionalIncludeDirectories);..\NewShellExtensionContextMenu</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\common\Telemetry;..\..\;..\..\..\;%(AdditionalIncludeDirectories);..\NewShellExtensionContextMenu;$(MSBuildThisFileDirectory)Generated Files</AdditionalIncludeDirectories>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
@@ -67,7 +67,7 @@
|
||||
<PreprocessorDefinitions>NDEBUG;NEWPLUSSHELLEXTENSIONWIN10_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>..\..\..\common\Telemetry;..\..\;..\..\..\;%(AdditionalIncludeDirectories);..\NewShellExtensionContextMenu</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\common\Telemetry;..\..\;..\..\..\;%(AdditionalIncludeDirectories);..\NewShellExtensionContextMenu;$(MSBuildThisFileDirectory)Generated Files</AdditionalIncludeDirectories>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
|
||||
@@ -88,9 +88,6 @@ namespace Awake.Core.Native
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal static extern bool GetCursorPos(out Point lpPoint);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
internal static extern bool ScreenToClient(IntPtr hWnd, ref Point lpPoint);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
internal static extern bool GetMessage(out Msg lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax);
|
||||
|
||||
|
||||
@@ -61,9 +61,8 @@ namespace Awake.Core
|
||||
|
||||
Bridge.SetForegroundWindow(hWnd);
|
||||
|
||||
// Get cursor position and convert it to client coordinates
|
||||
// Get cursor position in screen coordinates
|
||||
Bridge.GetCursorPos(out Models.Point cursorPos);
|
||||
Bridge.ScreenToClient(hWnd, ref cursorPos);
|
||||
|
||||
// Set menu information
|
||||
MenuInfo menuInfo = new()
|
||||
|
||||
@@ -51,10 +51,10 @@ internal sealed partial class GlobalErrorHandler
|
||||
// without its exception being observed. It is NOT raised immediately
|
||||
// when the Task faults; timing depends on GC finalization.
|
||||
e.SetObserved();
|
||||
HandleException(e.Exception, Context.UnobservedTaskException, isRecoverable: true);
|
||||
HandleException(e.Exception, Context.UnobservedTaskException);
|
||||
}
|
||||
|
||||
private void HandleException(Exception ex, Context context, bool isRecoverable = false)
|
||||
private static void HandleException(Exception ex, Context context)
|
||||
{
|
||||
Logger.LogError($"Unhandled exception detected ({context})", ex);
|
||||
|
||||
@@ -70,10 +70,25 @@ internal sealed partial class GlobalErrorHandler
|
||||
|
||||
StoreReport(report, storeOnDesktop: false);
|
||||
|
||||
string message;
|
||||
string caption;
|
||||
try
|
||||
{
|
||||
message = ResourceLoaderInstance.GetString("GlobalErrorHandler_CrashMessageBox_Message");
|
||||
caption = ResourceLoaderInstance.GetString("GlobalErrorHandler_CrashMessageBox_Caption");
|
||||
}
|
||||
catch
|
||||
{
|
||||
// The resource loader may not be available if the exception occurred during startup.
|
||||
// Fall back to hardcoded strings in that case.
|
||||
message = "Command Palette has encountered a fatal error and must close.";
|
||||
caption = "Command Palette - Fatal error";
|
||||
}
|
||||
|
||||
PInvoke.MessageBox(
|
||||
HWND.Null,
|
||||
"Command Palette has encountered a fatal error and must close.\n\nAn error report has been saved to your desktop.",
|
||||
"Unhandled Error",
|
||||
message,
|
||||
caption,
|
||||
MESSAGEBOX_STYLE.MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,8 +431,8 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
||||
<data name="Run_Radio_Position_LastPosition.Content" xml:space="preserve">
|
||||
<value>Last Position</value>
|
||||
<comment>Reopen the window where it was last closed</comment>
|
||||
</data>
|
||||
<data name="TrayMenu_Settings" xml:space="preserve">
|
||||
</data>
|
||||
<data name="TrayMenu_Settings" xml:space="preserve">
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
<data name="TrayMenu_Close" xml:space="preserve">
|
||||
@@ -493,28 +493,34 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
||||
<data name="Settings_ExtensionsPage_Reloading_Text.Text" xml:space="preserve">
|
||||
<value>Reloading extensions..</value>
|
||||
</data>
|
||||
<data name="Settings_ExtensionsPage_Banner_Header.Text" xml:space="preserve">
|
||||
<data name="Settings_ExtensionsPage_Banner_Header.Text" xml:space="preserve">
|
||||
<value>Discover more extensions</value>
|
||||
</data>
|
||||
<data name="Settings_ExtensionsPage_Banner_Description.Text" xml:space="preserve">
|
||||
<data name="Settings_ExtensionsPage_Banner_Description.Text" xml:space="preserve">
|
||||
<value>Find more extensions on the Microsoft Store or WinGet.</value>
|
||||
</data>
|
||||
<data name="Settings_ExtensionsPage_Banner_Hyperlink.Content" xml:space="preserve">
|
||||
<data name="Settings_ExtensionsPage_Banner_Hyperlink.Content" xml:space="preserve">
|
||||
<value>Learn how to create your own extensions</value>
|
||||
</data>
|
||||
<data name="Settings_ExtensionsPage_FindExtensions_MicrosoftStore.[using:Microsoft.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<data name="Settings_ExtensionsPage_FindExtensions_MicrosoftStore.[using:Microsoft.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Find extensions on the Microsoft Store</value>
|
||||
</data>
|
||||
<data name="Settings_ExtensionsPage_FindExtensions_MicrosoftStore.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<data name="Settings_ExtensionsPage_FindExtensions_MicrosoftStore.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Microsoft Store</value>
|
||||
</data>
|
||||
<data name="Settings_ExtensionsPage_FindExtensions_WinGet.[using:Microsoft.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<data name="Settings_ExtensionsPage_FindExtensions_WinGet.[using:Microsoft.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Find extensions on WinGet</value>
|
||||
</data>
|
||||
<data name="Settings_ExtensionsPage_FindExtensions_WinGet.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<data name="Settings_ExtensionsPage_FindExtensions_WinGet.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Microsoft Store</value>
|
||||
</data>
|
||||
<data name="Settings_ExtensionsPage_SearchBox_Placeholder.PlaceholderText" xml:space="preserve">
|
||||
<data name="Settings_ExtensionsPage_SearchBox_Placeholder.PlaceholderText" xml:space="preserve">
|
||||
<value>Search extensions</value>
|
||||
</data>
|
||||
<data name="GlobalErrorHandler_CrashMessageBox_Message" xml:space="preserve">
|
||||
<value>Command Palette has encountered a fatal error and must close.</value>
|
||||
</data>
|
||||
<data name="GlobalErrorHandler_CrashMessageBox_Caption" xml:space="preserve">
|
||||
<value>Command Palette - Fatal error</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -63,7 +63,7 @@ internal sealed partial class SampleListPageWithDetails : ListPage
|
||||
Details = new Details()
|
||||
{
|
||||
Title = "Hero Image Example",
|
||||
HeroImage = new IconInfo("https://m.media-amazon.com/images/M/MV5BNDBkMzVmNGQtYTM2OC00OWRjLTk5OWMtNzNkMDI4NjFjNTZmXkEyXkFqcGdeQXZ3ZXNsZXk@._V1_QL75_UX500_CR0,0,500,281_.jpg"),
|
||||
HeroImage = new IconInfo("https://m.media-amazon.com/images/M/MV5BNDBkMzVmNGQtYTM2OC00OWRjLTk5OWMtNzNkMDI4NjFjNTZmXkEyXkFqcGdeQXZ3ZXNsZXk@._V1_QL75_UX500_CR0,0,500,281_.jpg"), /* #no-spell-check-line */
|
||||
Body = "It is literally an image of a hero",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
using ImageResizer.Properties;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using Moq.Protected;
|
||||
@@ -101,7 +101,9 @@ namespace ImageResizer.Models
|
||||
private static ResizeBatch CreateBatch(Action<string> executeAction)
|
||||
{
|
||||
var mock = new Mock<ResizeBatch> { CallBase = true };
|
||||
mock.Protected().Setup("Execute", ItExpr.IsAny<string>()).Callback(executeAction);
|
||||
mock.Protected()
|
||||
.Setup("Execute", ItExpr.IsAny<string>(), ItExpr.IsAny<Settings>())
|
||||
.Callback((string file, Settings settings) => executeAction(file));
|
||||
|
||||
return mock.Object;
|
||||
}
|
||||
|
||||
@@ -87,9 +87,14 @@ namespace ImageResizer.Models
|
||||
public IEnumerable<ResizeError> Process(Action<int, double> reportProgress, CancellationToken cancellationToken)
|
||||
{
|
||||
double total = Files.Count;
|
||||
var completed = 0;
|
||||
int completed = 0;
|
||||
var errors = new ConcurrentBag<ResizeError>();
|
||||
|
||||
// NOTE: Settings.Default is captured once before parallel processing.
|
||||
// Any changes to settings on disk during this batch will NOT be reflected until the next batch.
|
||||
// This improves performance and predictability by avoiding repeated mutex acquisition and behaviour change results in a batch.
|
||||
var settings = Settings.Default;
|
||||
|
||||
// TODO: If we ever switch to Windows.Graphics.Imaging, we can get a lot more throughput by using the async
|
||||
// APIs and a custom SynchronizationContext
|
||||
Parallel.ForEach(
|
||||
@@ -97,13 +102,12 @@ namespace ImageResizer.Models
|
||||
new ParallelOptions
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
MaxDegreeOfParallelism = Environment.ProcessorCount,
|
||||
},
|
||||
(file, state, i) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Execute(file);
|
||||
Execute(file, settings);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -111,14 +115,13 @@ namespace ImageResizer.Models
|
||||
}
|
||||
|
||||
Interlocked.Increment(ref completed);
|
||||
|
||||
reportProgress(completed, total);
|
||||
});
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
protected virtual void Execute(string file)
|
||||
=> new ResizeOperation(file, DestinationDirectory, Settings.Default).Execute();
|
||||
protected virtual void Execute(string file, Settings settings)
|
||||
=> new ResizeOperation(file, DestinationDirectory, settings).Execute();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,33 +461,42 @@ namespace ImageResizer.Properties
|
||||
{
|
||||
}
|
||||
|
||||
// Needs to be called on the App UI thread as the properties are bound to the UI.
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
if (App.Current?.Dispatcher != null)
|
||||
{
|
||||
ShrinkOnly = jsonSettings.ShrinkOnly;
|
||||
Replace = jsonSettings.Replace;
|
||||
IgnoreOrientation = jsonSettings.IgnoreOrientation;
|
||||
RemoveMetadata = jsonSettings.RemoveMetadata;
|
||||
JpegQualityLevel = jsonSettings.JpegQualityLevel;
|
||||
PngInterlaceOption = jsonSettings.PngInterlaceOption;
|
||||
TiffCompressOption = jsonSettings.TiffCompressOption;
|
||||
FileName = jsonSettings.FileName;
|
||||
KeepDateModified = jsonSettings.KeepDateModified;
|
||||
FallbackEncoder = jsonSettings.FallbackEncoder;
|
||||
CustomSize = jsonSettings.CustomSize;
|
||||
SelectedSizeIndex = jsonSettings.SelectedSizeIndex;
|
||||
|
||||
if (jsonSettings.Sizes.Count > 0)
|
||||
{
|
||||
Sizes.Clear();
|
||||
Sizes.AddRange(jsonSettings.Sizes);
|
||||
|
||||
// Ensure Ids are unique and handle missing Ids
|
||||
IdRecoveryHelper.RecoverInvalidIds(Sizes);
|
||||
}
|
||||
});
|
||||
// Needs to be called on the App UI thread as the properties are bound to the UI.
|
||||
App.Current.Dispatcher.Invoke(() => ReloadCore(jsonSettings));
|
||||
}
|
||||
else
|
||||
{
|
||||
ReloadCore(jsonSettings);
|
||||
}
|
||||
|
||||
_jsonMutex.ReleaseMutex();
|
||||
}
|
||||
|
||||
private void ReloadCore(Settings jsonSettings)
|
||||
{
|
||||
ShrinkOnly = jsonSettings.ShrinkOnly;
|
||||
Replace = jsonSettings.Replace;
|
||||
IgnoreOrientation = jsonSettings.IgnoreOrientation;
|
||||
RemoveMetadata = jsonSettings.RemoveMetadata;
|
||||
JpegQualityLevel = jsonSettings.JpegQualityLevel;
|
||||
PngInterlaceOption = jsonSettings.PngInterlaceOption;
|
||||
TiffCompressOption = jsonSettings.TiffCompressOption;
|
||||
FileName = jsonSettings.FileName;
|
||||
KeepDateModified = jsonSettings.KeepDateModified;
|
||||
FallbackEncoder = jsonSettings.FallbackEncoder;
|
||||
CustomSize = jsonSettings.CustomSize;
|
||||
SelectedSizeIndex = jsonSettings.SelectedSizeIndex;
|
||||
|
||||
if (jsonSettings.Sizes.Count > 0)
|
||||
{
|
||||
Sizes.Clear();
|
||||
Sizes.AddRange(jsonSettings.Sizes);
|
||||
|
||||
// Ensure Ids are unique and handle missing Ids
|
||||
IdRecoveryHelper.RecoverInvalidIds(Sizes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,13 +24,15 @@ using Windows.Storage;
|
||||
|
||||
namespace Peek.FilePreviewer.Previewers.MediaPreviewer
|
||||
{
|
||||
public partial class AudioPreviewer : ObservableObject, IAudioPreviewer
|
||||
public partial class AudioPreviewer : ObservableObject, IDisposable, IAudioPreviewer
|
||||
{
|
||||
private MediaSource? _mediaSource;
|
||||
|
||||
[ObservableProperty]
|
||||
private PreviewState _state;
|
||||
|
||||
[ObservableProperty]
|
||||
private AudioPreviewData _preview;
|
||||
private AudioPreviewData? _preview;
|
||||
|
||||
private IFileSystemItem Item { get; }
|
||||
|
||||
@@ -40,7 +42,6 @@ namespace Peek.FilePreviewer.Previewers.MediaPreviewer
|
||||
{
|
||||
Item = file;
|
||||
Dispatcher = DispatcherQueue.GetForCurrentThread();
|
||||
Preview = new AudioPreviewData();
|
||||
}
|
||||
|
||||
public async Task CopyAsync()
|
||||
@@ -63,19 +64,23 @@ namespace Peek.FilePreviewer.Previewers.MediaPreviewer
|
||||
{
|
||||
State = PreviewState.Loading;
|
||||
|
||||
Preview = new AudioPreviewData();
|
||||
|
||||
var thumbnailTask = LoadThumbnailAsync(cancellationToken);
|
||||
var sourceTask = LoadSourceAsync(cancellationToken);
|
||||
var metadataTask = LoadMetadataAsync(cancellationToken);
|
||||
|
||||
await Task.WhenAll(thumbnailTask, sourceTask, metadataTask);
|
||||
|
||||
if (!thumbnailTask.Result || !sourceTask.Result || !metadataTask.Result)
|
||||
if (sourceTask.Result && metadataTask.Result)
|
||||
{
|
||||
State = PreviewState.Error;
|
||||
State = PreviewState.Loaded;
|
||||
}
|
||||
else
|
||||
{
|
||||
State = PreviewState.Loaded;
|
||||
// Release all resources on error.
|
||||
Unload();
|
||||
State = PreviewState.Error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,12 +93,15 @@ namespace Peek.FilePreviewer.Previewers.MediaPreviewer
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var thumbnail = await ThumbnailHelper.GetThumbnailAsync(Item.Path, cancellationToken)
|
||||
?? await ThumbnailHelper.GetIconAsync(Item.Path, cancellationToken);
|
||||
if (Preview != null)
|
||||
{
|
||||
var thumbnail = await ThumbnailHelper.GetThumbnailAsync(Item.Path, cancellationToken)
|
||||
?? await ThumbnailHelper.GetIconAsync(Item.Path, cancellationToken);
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
Preview.Thumbnail = thumbnail ?? new SvgImageSource(new Uri("ms-appx:///Assets/Peek/DefaultFileIcon.svg"));
|
||||
Preview.Thumbnail = thumbnail ?? new SvgImageSource(new Uri("ms-appx:///Assets/Peek/DefaultFileIcon.svg"));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -110,7 +118,11 @@ namespace Peek.FilePreviewer.Previewers.MediaPreviewer
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
Preview.MediaSource = MediaSource.CreateFromStorageFile(storageFile);
|
||||
if (Preview != null)
|
||||
{
|
||||
_mediaSource = MediaSource.CreateFromStorageFile(storageFile);
|
||||
Preview.MediaSource = _mediaSource;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -123,6 +135,11 @@ namespace Peek.FilePreviewer.Previewers.MediaPreviewer
|
||||
|
||||
await Dispatcher.RunOnUiThread(() =>
|
||||
{
|
||||
if (Preview == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
Preview.Title = PropertyStoreHelper.TryGetStringProperty(Item.Path, PropertyKey.MusicTitle)
|
||||
?? Item.Name[..^Item.Extension.Length];
|
||||
@@ -160,6 +177,22 @@ namespace Peek.FilePreviewer.Previewers.MediaPreviewer
|
||||
return _supportedFileTypes.Contains(item.Extension);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Unload();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Explicitly unloads the preview and releases file resources.
|
||||
/// </summary>
|
||||
public void Unload()
|
||||
{
|
||||
_mediaSource?.Dispose();
|
||||
_mediaSource = null;
|
||||
Preview = null;
|
||||
}
|
||||
|
||||
private static readonly HashSet<string> _supportedFileTypes = new()
|
||||
{
|
||||
".aac",
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace Peek.FilePreviewer.Previewers
|
||||
{
|
||||
public partial class VideoPreviewer : ObservableObject, IVideoPreviewer, IDisposable
|
||||
{
|
||||
private MediaSource? _mediaSource;
|
||||
|
||||
[ObservableProperty]
|
||||
private MediaSource? preview;
|
||||
|
||||
@@ -56,6 +58,7 @@ namespace Peek.FilePreviewer.Previewers
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Unload();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
@@ -145,7 +148,8 @@ namespace Peek.FilePreviewer.Previewers
|
||||
MissingCodecName = missingCodecName;
|
||||
}
|
||||
|
||||
Preview = MediaSource.CreateFromStorageFile(storageFile);
|
||||
_mediaSource = MediaSource.CreateFromStorageFile(storageFile);
|
||||
Preview = _mediaSource;
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -155,6 +159,16 @@ namespace Peek.FilePreviewer.Previewers
|
||||
return !(VideoTask?.Result ?? true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Explicitly unloads the preview and releases file resources.
|
||||
/// </summary>
|
||||
public void Unload()
|
||||
{
|
||||
_mediaSource?.Dispose();
|
||||
_mediaSource = null;
|
||||
Preview = null;
|
||||
}
|
||||
|
||||
private static readonly HashSet<string> _supportedFileTypes = new()
|
||||
{
|
||||
".mp4", ".3g2", ".3gp", ".3gp2", ".3gpp", ".asf", ".avi", ".m2t", ".m2ts",
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.PowerToys.UITest;
|
||||
@@ -35,6 +36,105 @@ public class PeekFilePreviewTests : UITestBase
|
||||
{
|
||||
}
|
||||
|
||||
static PeekFilePreviewTests()
|
||||
{
|
||||
FixSettingsFileBeforeTests();
|
||||
}
|
||||
|
||||
private static readonly JsonSerializerOptions IndentedJsonOptions = new() { WriteIndented = true };
|
||||
|
||||
private static void FixSettingsFileBeforeTests()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Default Peek settings
|
||||
string peekSettingsContent = @"{
|
||||
""name"": ""Peek"",
|
||||
""version"": ""1.0"",
|
||||
""properties"": {
|
||||
""ActivationShortcut"": {
|
||||
""win"": false,
|
||||
""ctrl"": true,
|
||||
""alt"": false,
|
||||
""shift"": false,
|
||||
""code"": 32,
|
||||
""key"": ""Space""
|
||||
},
|
||||
""AlwaysRunNotElevated"": {
|
||||
""value"": true
|
||||
},
|
||||
""CloseAfterLosingFocus"": {
|
||||
""value"": false
|
||||
},
|
||||
""ConfirmFileDelete"": {
|
||||
""value"": true
|
||||
},
|
||||
""EnableSpaceToActivate"": {
|
||||
""value"": false
|
||||
}
|
||||
}
|
||||
}";
|
||||
|
||||
// Update Peek module settings
|
||||
SettingsConfigHelper.UpdateModuleSettings(
|
||||
"Peek",
|
||||
peekSettingsContent,
|
||||
(settings) =>
|
||||
{
|
||||
// Get or ensure properties section exists
|
||||
Dictionary<string, object> properties;
|
||||
|
||||
if (settings.TryGetValue("properties", out var propertiesObj))
|
||||
{
|
||||
if (propertiesObj is Dictionary<string, object> dict)
|
||||
{
|
||||
properties = dict;
|
||||
}
|
||||
else if (propertiesObj is JsonElement jsonElem)
|
||||
{
|
||||
properties = JsonSerializer.Deserialize<Dictionary<string, object>>(jsonElem.GetRawText())
|
||||
?? throw new InvalidOperationException("Failed to deserialize properties");
|
||||
}
|
||||
else
|
||||
{
|
||||
properties = new Dictionary<string, object>();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
properties = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
// Update the required properties
|
||||
properties["ActivationShortcut"] = new Dictionary<string, object>
|
||||
{
|
||||
{ "win", false },
|
||||
{ "ctrl", true },
|
||||
{ "alt", false },
|
||||
{ "shift", false },
|
||||
{ "code", 32 },
|
||||
{ "key", "Space" },
|
||||
};
|
||||
|
||||
properties["EnableSpaceToActivate"] = new Dictionary<string, object>
|
||||
{
|
||||
{ "value", false },
|
||||
};
|
||||
|
||||
settings["properties"] = properties;
|
||||
});
|
||||
|
||||
// Disable all modules except Peek in global settings
|
||||
SettingsConfigHelper.ConfigureGlobalModuleSettings("Peek");
|
||||
|
||||
Debug.WriteLine("Successfully updated all settings - Peek shortcut configured and all modules except Peek disabled");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Assert.Fail($"ERROR in FixSettingsFileBeforeTests: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[TestInitialize]
|
||||
public void TestInitialize()
|
||||
{
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace PowerAccent.Core
|
||||
LetterKey.VK_L => new[] { "ļ", "₺" }, // ₺ is in VK_T for other languages, but not VK_L, so we add it here.
|
||||
LetterKey.VK_M => new[] { "ṁ" },
|
||||
LetterKey.VK_N => new[] { "ņ", "ṅ", "ⁿ", "ℕ", "№" },
|
||||
LetterKey.VK_O => new[] { "ȯ", "∅" },
|
||||
LetterKey.VK_O => new[] { "ȯ", "∅", "⌀" },
|
||||
LetterKey.VK_P => new[] { "ṗ", "℗", "∏", "¶" },
|
||||
LetterKey.VK_Q => new[] { "ℚ" },
|
||||
LetterKey.VK_R => new[] { "ṙ", "®", "ℝ" },
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WindowsPackageType>None</WindowsPackageType>
|
||||
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
|
||||
<WindowsAppSdkUndockedRegFreeWinRTInitialize>true</WindowsAppSdkUndockedRegFreeWinRTInitialize>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
||||
@@ -36,9 +36,9 @@ public static class AIServiceTypeRegistry
|
||||
IsOnlineService = true,
|
||||
LegalDescription = "AdvancedPaste_Anthropic_LegalDescription",
|
||||
TermsLabel = "AdvancedPaste_Anthropic_TermsLabel",
|
||||
TermsUri = new Uri("https://www.anthropic.com/legal/terms-of-service"),
|
||||
TermsUri = new Uri("https://privacy.claude.com/en/collections/10672567-policies-terms-of-service"),
|
||||
PrivacyLabel = "AdvancedPaste_Anthropic_PrivacyLabel",
|
||||
PrivacyUri = new Uri("https://www.anthropic.com/legal/privacy"),
|
||||
PrivacyUri = new Uri("https://privacy.claude.com/en/"),
|
||||
},
|
||||
[AIServiceType.AzureAIInference] = new AIServiceTypeMetadata
|
||||
{
|
||||
@@ -81,9 +81,9 @@ public static class AIServiceTypeRegistry
|
||||
IsOnlineService = true,
|
||||
LegalDescription = "AdvancedPaste_Google_LegalDescription",
|
||||
TermsLabel = "AdvancedPaste_Google_TermsLabel",
|
||||
TermsUri = new Uri("https://policies.google.com/terms"),
|
||||
TermsUri = new Uri("https://ai.google.dev/gemini-api/terms"),
|
||||
PrivacyLabel = "AdvancedPaste_Google_PrivacyLabel",
|
||||
PrivacyUri = new Uri("https://policies.google.com/privacy"),
|
||||
PrivacyUri = new Uri("https://support.google.com/gemini/answer/13594961"),
|
||||
},
|
||||
[AIServiceType.HuggingFace] = new AIServiceTypeMetadata
|
||||
{
|
||||
@@ -126,9 +126,9 @@ public static class AIServiceTypeRegistry
|
||||
IsLocalModel = true,
|
||||
LegalDescription = "AdvancedPaste_LocalModel_LegalDescription",
|
||||
TermsLabel = "AdvancedPaste_Ollama_TermsLabel",
|
||||
TermsUri = new Uri("https://ollama.com/terms"),
|
||||
TermsUri = new Uri("https://ollama.org/terms"),
|
||||
PrivacyLabel = "AdvancedPaste_Ollama_PrivacyLabel",
|
||||
PrivacyUri = new Uri("https://ollama.com/privacy"),
|
||||
PrivacyUri = new Uri("https://ollama.org/privacy"),
|
||||
},
|
||||
[AIServiceType.Onnx] = new AIServiceTypeMetadata
|
||||
{
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<Button Click="ShortcutConflictBtn_Click" Style="{StaticResource SubtleButtonStyle}">
|
||||
<Button
|
||||
x:Uid="ShortcutConflictControl_Automation"
|
||||
Click="ShortcutConflictBtn_Click"
|
||||
Style="{StaticResource SubtleButtonStyle}">
|
||||
<Grid ColumnSpacing="16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
|
||||
@@ -111,7 +111,8 @@
|
||||
x:Uid="UpdateAvailableInfoBar"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind ViewModel.IsUpdateAvailable, Mode=OneWay}"
|
||||
Severity="Success" />
|
||||
Severity="Success"
|
||||
Tapped="UpdateInfoBar_Tapped" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
@@ -144,7 +145,6 @@
|
||||
<Button
|
||||
x:Name="SettingsBtn"
|
||||
x:Uid="SettingsBtn"
|
||||
Padding="8"
|
||||
Click="SettingsBtn_Click"
|
||||
Style="{StaticResource FlyoutButtonStyle}">
|
||||
<ToolTipService.ToolTip>
|
||||
|
||||
@@ -10,6 +10,7 @@ using Microsoft.PowerToys.Settings.UI.Controls;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
@@ -183,5 +184,14 @@ namespace Microsoft.PowerToys.Settings.UI.Flyout
|
||||
// Closing manually the flyout since no window will steal the focus
|
||||
App.GetFlyoutWindow()?.Hide();
|
||||
}
|
||||
|
||||
private void UpdateInfoBar_Tapped(object sender, Microsoft.UI.Xaml.Input.TappedRoutedEventArgs e)
|
||||
{
|
||||
// Hide the flyout before opening settings window
|
||||
App.GetFlyoutWindow()?.Hide();
|
||||
|
||||
// Open Settings window directly to General page where update controls are located
|
||||
App.OpenSettingsWindow(typeof(GeneralPage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,6 +240,7 @@
|
||||
<ComboBox
|
||||
x:Name="Languages_ComboBox"
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
AutomationProperties.Name="{Binding ElementName=LanguageHeader, Path=Header}"
|
||||
DisplayMemberPath="Language"
|
||||
ItemsSource="{Binding Languages, Mode=TwoWay}"
|
||||
SelectedIndex="{Binding LanguagesIndex, Mode=TwoWay}" />
|
||||
@@ -262,7 +263,10 @@
|
||||
<tkcontrols:SettingsCard.Description>
|
||||
<HyperlinkButton x:Uid="Windows_Color_Settings" Click="OpenColorsSettings_Click" />
|
||||
</tkcontrols:SettingsCard.Description>
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind ViewModel.ThemeIndex, Mode=TwoWay}">
|
||||
<ComboBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
AutomationProperties.Name="{Binding ElementName=ColorModeHeader, Path=Header}"
|
||||
SelectedIndex="{x:Bind ViewModel.ThemeIndex, Mode=TwoWay}">
|
||||
<ComboBoxItem x:Uid="Radio_Theme_Dark" />
|
||||
<ComboBoxItem x:Uid="Radio_Theme_Light" />
|
||||
<ComboBoxItem x:Uid="Radio_Theme_Default" />
|
||||
@@ -273,12 +277,16 @@
|
||||
Name="GeneralPageRunAtStartUp"
|
||||
x:Uid="GeneralPage_RunAtStartUp"
|
||||
IsEnabled="{x:Bind ViewModel.IsRunAtStartupGPOManaged, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.Startup, Mode=TwoWay}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
AutomationProperties.Name="{Binding ElementName=GeneralPageRunAtStartUp, Path=Header}"
|
||||
IsOn="{x:Bind ViewModel.Startup, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<controls:GPOInfoControl ShowWarning="{x:Bind ViewModel.IsRunAtStartupGPOManaged, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="ShowSystemTrayIcon">
|
||||
<tkcontrols:SettingsCard x:Name="ShowSystemTrayIconCard" x:Uid="ShowSystemTrayIcon">
|
||||
<ToggleSwitch
|
||||
x:Uid="ShowSystemTrayIcon_ToggleSwitch"
|
||||
AutomationProperties.Name="{Binding ElementName=ShowSystemTrayIconCard, Path=Header}"
|
||||
IsOn="{x:Bind ViewModel.ShowSysTrayIcon, Mode=TwoWay}"
|
||||
Toggled="ShowSystemTrayIcon_Toggled" />
|
||||
</tkcontrols:SettingsCard>
|
||||
@@ -398,12 +406,16 @@
|
||||
<tkcontrols:SettingsCard.HeaderIcon>
|
||||
<PathIcon Data="M1859 1758q14 23 21 47t7 51q0 40-15 75t-41 61-61 41-75 15H354q-40 0-75-15t-61-41-41-61-15-75q0-27 6-51t21-47l569-992q10-14 10-34V128H640V0h768v128h-128v604q0 19 10 35l569 991zM896 732q0 53-27 99l-331 577h972l-331-577q-27-46-27-99V128H896v604zm799 1188q26 0 44-19t19-45q0-10-2-17t-8-16l-164-287H464l-165 287q-9 15-9 33 0 26 18 45t46 19h1341z" />
|
||||
</tkcontrols:SettingsCard.HeaderIcon>
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.EnableExperimentation, Mode=TwoWay}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
AutomationProperties.Name="{Binding ElementName=GeneralPageEnableExperimentation, Path=Header}"
|
||||
IsOn="{x:Bind ViewModel.EnableExperimentation, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:GPOInfoControl>
|
||||
</controls:SettingsGroup>
|
||||
<controls:SettingsGroup x:Uid="General_DiagnosticsAndFeedback">
|
||||
<tkcontrols:SettingsExpander
|
||||
x:Name="GeneralPageEnableDataDiagnostics"
|
||||
x:Uid="GeneralPage_EnableDataDiagnostics"
|
||||
HeaderIcon="{ui:FontIcon Glyph=}"
|
||||
IsEnabled="{x:Bind ViewModel.IsDataDiagnosticsGPOManaged, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}"
|
||||
@@ -421,10 +433,19 @@
|
||||
NavigateUri="https://aka.ms/powertoys-data-and-privacy-documentation" />
|
||||
</StackPanel>
|
||||
</tkcontrols:SettingsExpander.Description>
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.EnableDataDiagnostics, Mode=TwoWay}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
AutomationProperties.Name="{Binding ElementName=GeneralPageEnableDataDiagnostics, Path=Header}"
|
||||
IsOn="{x:Bind ViewModel.EnableDataDiagnostics, Mode=TwoWay}" />
|
||||
<tkcontrols:SettingsExpander.Items>
|
||||
<tkcontrols:SettingsCard x:Uid="GeneralPage_EnableViewDiagnosticData" IsEnabled="{x:Bind ViewModel.EnableDataDiagnostics, Mode=TwoWay}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.EnableViewDataDiagnostics, Mode=TwoWay}" />
|
||||
<tkcontrols:SettingsCard
|
||||
x:Name="GeneralPageEnableViewDiagnosticData"
|
||||
x:Uid="GeneralPage_EnableViewDiagnosticData"
|
||||
IsEnabled="{x:Bind ViewModel.EnableDataDiagnostics, Mode=TwoWay}">
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
AutomationProperties.Name="{Binding ElementName=GeneralPageEnableViewDiagnosticData, Path=Header}"
|
||||
IsOn="{x:Bind ViewModel.EnableViewDataDiagnostics, Mode=TwoWay}" />
|
||||
<tkcontrols:SettingsCard.Description>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock
|
||||
|
||||
@@ -23,7 +23,10 @@
|
||||
Name="NewPlusEnableToggle"
|
||||
x:Uid="NewPlus_Enable_Toggle"
|
||||
HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/Icons/NewPlus.png}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
AutomationProperties.Name="{Binding ElementName=NewPlusEnableToggle, Path=Header}"
|
||||
IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:GPOInfoControl>
|
||||
<controls:SettingsGroup x:Uid="NewPlus_Templates" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
@@ -60,12 +63,18 @@
|
||||
Name="NewPlusHideFileExtensionToggle"
|
||||
x:Uid="NewPlus_Hide_File_Extension_Toggle"
|
||||
IsEnabled="{x:Bind ViewModel.IsHideFileExtSettingsCardEnabled, Mode=OneWay}">
|
||||
<ToggleSwitch x:Uid="HideFileExtensionToggle" IsOn="{x:Bind ViewModel.HideFileExtension, Mode=TwoWay}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="HideFileExtensionToggle"
|
||||
AutomationProperties.Name="{Binding ElementName=NewPlusHideFileExtensionToggle, Path=Header}"
|
||||
IsOn="{x:Bind ViewModel.HideFileExtension, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:GPOInfoControl>
|
||||
<tkcontrols:SettingsCard Name="NewPlusHideStartingDigitsToggle" x:Uid="NewPlus_Hide_Starting_Digits_Toggle">
|
||||
|
||||
<ToggleSwitch x:Uid="HideStartingDigitsToggle" IsOn="{x:Bind ViewModel.HideStartingDigits, Mode=TwoWay}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="HideStartingDigitsToggle"
|
||||
AutomationProperties.Name="{Binding ElementName=NewPlusHideStartingDigitsToggle, Path=Header}"
|
||||
IsOn="{x:Bind ViewModel.HideStartingDigits, Mode=TwoWay}" />
|
||||
<tkcontrols:SettingsCard.Description>
|
||||
<TextBlock x:Uid="NewPlus_Hide_Starting_Digits_Description" />
|
||||
</tkcontrols:SettingsCard.Description>
|
||||
@@ -79,7 +88,10 @@
|
||||
x:Uid="NewPlus_Behaviour_Replace_Variables_Toggle"
|
||||
IsEnabled="{x:Bind ViewModel.IsReplaceVariablesSettingsCardEnabled, Mode=OneWay}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="4">
|
||||
<ToggleSwitch x:Uid="ReplaceVariablesToggle" IsOn="{x:Bind ViewModel.ReplaceVariables, Mode=TwoWay}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="ReplaceVariablesToggle"
|
||||
AutomationProperties.Name="{Binding ElementName=NewPlusBehaviourReplaceVariablesToggle, Path=Header}"
|
||||
IsOn="{x:Bind ViewModel.ReplaceVariables, Mode=TwoWay}" />
|
||||
<Button
|
||||
x:Uid="FileCreationButton"
|
||||
Width="28"
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
Header="{x:Bind Path=DisplayLabel}">
|
||||
<ComboBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
AutomationProperties.Name="{x:Bind Path=DisplayLabel}"
|
||||
DisplayMemberPath="Key"
|
||||
ItemsSource="{x:Bind Path=ComboBoxItems}"
|
||||
SelectedValue="{x:Bind ComboBoxValue, Mode=TwoWay}"
|
||||
@@ -110,6 +111,7 @@
|
||||
Header="{x:Bind Path=DisplayLabel}">
|
||||
<NumberBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
AutomationProperties.Name="{x:Bind Path=DisplayLabel}"
|
||||
LargeChange="{x:Bind NumberBoxLargeChange, Mode=OneWay}"
|
||||
Maximum="{x:Bind NumberBoxMax, Mode=OneWay}"
|
||||
Minimum="{x:Bind NumberBoxMin, Mode=OneWay}"
|
||||
@@ -175,6 +177,7 @@
|
||||
IsEnabled="{x:Bind SecondSettingIsEnabled, Mode=OneWay}">
|
||||
<ComboBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
AutomationProperties.Name="{x:Bind Path=SecondDisplayLabel}"
|
||||
DisplayMemberPath="Key"
|
||||
ItemsSource="{x:Bind Path=ComboBoxItems}"
|
||||
SelectedValue="{x:Bind ComboBoxValue, Mode=TwoWay}"
|
||||
@@ -290,6 +293,7 @@
|
||||
IsEnabled="{x:Bind SecondSettingIsEnabled, Mode=OneWay}">
|
||||
<NumberBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
AutomationProperties.Name="{x:Bind Path=SecondDisplayLabel}"
|
||||
LargeChange="{x:Bind NumberBoxLargeChange, Mode=OneWay}"
|
||||
Maximum="{x:Bind NumberBoxMax, Mode=OneWay}"
|
||||
Minimum="{x:Bind NumberBoxMin, Mode=OneWay}"
|
||||
|
||||
@@ -22,7 +22,10 @@
|
||||
Name="PowerRenameToggleEnable"
|
||||
x:Uid="PowerRename_Toggle_Enable"
|
||||
HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/Icons/PowerRename.png}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
AutomationProperties.Name="{Binding ElementName=PowerRenameToggleEnable, Path=Header}"
|
||||
IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:GPOInfoControl>
|
||||
<controls:SettingsGroup x:Uid="PowerRename_ShellIntegration" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
@@ -30,7 +33,10 @@
|
||||
Name="PowerRenameToggleContextMenu"
|
||||
x:Uid="PowerRename_Toggle_ContextMenu"
|
||||
IsExpanded="False">
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind ViewModel.EnabledOnContextExtendedMenu, Mode=TwoWay, Converter={StaticResource BoolToComboBoxIndexConverter}}">
|
||||
<ComboBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
AutomationProperties.Name="{Binding ElementName=PowerRenameToggleContextMenu, Path=Header}"
|
||||
SelectedIndex="{x:Bind ViewModel.EnabledOnContextExtendedMenu, Mode=TwoWay, Converter={StaticResource BoolToComboBoxIndexConverter}}">
|
||||
<ComboBoxItem x:Uid="PowerRename_Toggle_StandardContextMenu" />
|
||||
<ComboBoxItem x:Uid="PowerRename_Toggle_ExtendedContextMenu" />
|
||||
</ComboBox>
|
||||
@@ -53,7 +59,10 @@
|
||||
Name="PowerRenameToggleAutoComplete"
|
||||
x:Uid="PowerRename_Toggle_AutoComplete"
|
||||
IsExpanded="True">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.MRUEnabled, Mode=TwoWay}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
AutomationProperties.Name="{Binding ElementName=PowerRenameToggleAutoComplete, Path=Header}"
|
||||
IsOn="{x:Bind ViewModel.MRUEnabled, Mode=TwoWay}" />
|
||||
<tkcontrols:SettingsExpander.Items>
|
||||
<tkcontrols:SettingsCard
|
||||
Name="PowerRenameToggleMaxDispListNum"
|
||||
@@ -61,6 +70,7 @@
|
||||
IsEnabled="{x:Bind ViewModel.GlobalAndMruEnabled, Mode=OneWay}">
|
||||
<NumberBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
AutomationProperties.Name="{Binding ElementName=PowerRenameToggleMaxDispListNum, Path=Header}"
|
||||
Maximum="20"
|
||||
Minimum="0"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
@@ -73,12 +83,18 @@
|
||||
Name="PowerRenameToggleRestoreFlagsOnLaunch"
|
||||
x:Uid="PowerRename_Toggle_RestoreFlagsOnLaunch"
|
||||
HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.RestoreFlagsOnLaunch, Mode=TwoWay}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
AutomationProperties.Name="{Binding ElementName=PowerRenameToggleRestoreFlagsOnLaunch, Path=Header}"
|
||||
IsOn="{x:Bind ViewModel.RestoreFlagsOnLaunch, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
<controls:SettingsGroup x:Uid="PowerRename_BehaviorHeader" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard Name="PowerRenameToggleUseBoostLib" x:Uid="PowerRename_Toggle_UseBoostLib">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.UseBoostLib, Mode=TwoWay}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
AutomationProperties.Name="{Binding ElementName=PowerRenameToggleUseBoostLib, Path=Header}"
|
||||
IsOn="{x:Bind ViewModel.UseBoostLib, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
</StackPanel>
|
||||
|
||||
@@ -5580,6 +5580,9 @@ To record a specific window, enter the hotkey with the Alt key in the opposite m
|
||||
<data name="ShortcutConflictControl_Title.Text" xml:space="preserve">
|
||||
<value>Shortcut conflicts</value>
|
||||
</data>
|
||||
<data name="ShortcutConflictControl_Automation.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Shortcut conflicts</value>
|
||||
</data>
|
||||
<data name="ShortcutConflictControl_NoConflictsFound" xml:space="preserve">
|
||||
<value>No conflicts found</value>
|
||||
</data>
|
||||
|
||||
Reference in New Issue
Block a user