mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
Standardizing built-in extension icon handling (#40606)
Just standardizing built-in extensions to use a `internal sealed class Icons` for all their non-dynamic icons. Looks like a LOT of changes, but it's icons all the way down.
This commit is contained in:
@@ -19,7 +19,7 @@ internal sealed partial class OpenFileCommand : InvokableCommand
|
||||
{
|
||||
this._item = item;
|
||||
this.Name = Resources.Indexer_Command_OpenFile;
|
||||
this.Icon = Icons.OpenFile;
|
||||
this.Icon = Icons.OpenFileIcon;
|
||||
}
|
||||
|
||||
public override CommandResult Invoke()
|
||||
|
||||
@@ -28,7 +28,7 @@ internal sealed partial class FallbackOpenFileItem : FallbackCommandItem, System
|
||||
{
|
||||
Title = string.Empty;
|
||||
Subtitle = string.Empty;
|
||||
Icon = Icons.FileExplorer;
|
||||
Icon = Icons.FileExplorerIcon;
|
||||
}
|
||||
|
||||
public override void UpdateQuery(string query)
|
||||
@@ -106,7 +106,7 @@ internal sealed partial class FallbackOpenFileItem : FallbackCommandItem, System
|
||||
// us to the file search page, prepopulated with this search.
|
||||
var indexerPage = new IndexerPage(query, _searchEngine, _queryCookie, results);
|
||||
Title = string.Format(CultureInfo.CurrentCulture, fallbackItemSearchPageTitleCompositeFormat, query);
|
||||
Icon = Icons.FileExplorer;
|
||||
Icon = Icons.FileExplorerIcon;
|
||||
Subtitle = Resources.Indexer_Subtitle;
|
||||
Command = indexerPage;
|
||||
|
||||
|
||||
22
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Icons.cs
Normal file
22
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Indexer/Icons.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
// 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.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.Indexer;
|
||||
|
||||
internal sealed class Icons
|
||||
{
|
||||
internal static IconInfo FileExplorerSegoeIcon { get; } = new("\uEC50");
|
||||
|
||||
internal static IconInfo FileExplorerIcon { get; } = IconHelpers.FromRelativePath("Assets\\FileExplorer.png");
|
||||
|
||||
internal static IconInfo ActionsIcon { get; } = IconHelpers.FromRelativePath("Assets\\Actions.png");
|
||||
|
||||
internal static IconInfo OpenFileIcon { get; } = new("\uE8E5"); // OpenFile
|
||||
|
||||
internal static IconInfo DocumentIcon { get; } = new("\uE8A5"); // Document
|
||||
|
||||
internal static IconInfo FolderOpenIcon { get; } = new("\uE838"); // FolderOpen
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public partial class IndexerCommandsProvider : CommandProvider
|
||||
{
|
||||
Id = "Files";
|
||||
DisplayName = Resources.IndexerCommandsProvider_DisplayName;
|
||||
Icon = Icons.FileExplorer;
|
||||
Icon = Icons.FileExplorerIcon;
|
||||
|
||||
if (IndexerListItem.IsActionsFeatureEnabled && ApiInformation.IsApiContractPresent("Windows.AI.Actions.ActionsContract", 4))
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ internal sealed partial class ActionsListContextItem : CommandContextItem, IDisp
|
||||
: base(new NoOpCommand())
|
||||
{
|
||||
Title = Resources.Indexer_Command_Actions;
|
||||
Icon = Icons.Actions;
|
||||
Icon = Icons.ActionsIcon;
|
||||
RequestedShortcut = KeyChordHelpers.FromModifiers(alt: true, vkey: VirtualKey.A);
|
||||
this.fullPath = fullPath;
|
||||
UpdateMoreCommands();
|
||||
|
||||
@@ -28,7 +28,7 @@ public sealed partial class DirectoryExplorePage : DynamicListPage
|
||||
public DirectoryExplorePage(string path)
|
||||
{
|
||||
_path = path;
|
||||
Icon = Icons.FileExplorer;
|
||||
Icon = Icons.FileExplorerIcon;
|
||||
Name = Resources.Indexer_Command_Browse;
|
||||
Title = path;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public sealed partial class DirectoryPage : ListPage
|
||||
public DirectoryPage(string path)
|
||||
{
|
||||
_path = path;
|
||||
Icon = Icons.FileExplorer;
|
||||
Icon = Icons.FileExplorerIcon;
|
||||
Name = Resources.Indexer_Command_Browse;
|
||||
Title = path;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public sealed partial class DirectoryPage : ListPage
|
||||
EmptyContent = new CommandItem(
|
||||
title: Resources.Indexer_File_Is_File_Not_Folder, subtitle: $"{_path}")
|
||||
{
|
||||
Icon = Icons.Document,
|
||||
Icon = Icons.DocumentIcon,
|
||||
};
|
||||
return [];
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public sealed partial class DirectoryPage : ListPage
|
||||
EmptyContent = new CommandItem(
|
||||
title: Resources.Indexer_Folder_Is_Empty, subtitle: $"{_path}")
|
||||
{
|
||||
Icon = Icons.FolderOpen,
|
||||
Icon = Icons.FolderOpenIcon,
|
||||
Command = listItemForUs.Command,
|
||||
MoreCommands = listItemForUs.MoreCommands,
|
||||
};
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
// 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.CommandPalette.Extensions.Toolkit;
|
||||
|
||||
namespace Microsoft.CmdPal.Ext.Indexer;
|
||||
|
||||
internal sealed class Icons
|
||||
{
|
||||
internal static IconInfo FileExplorerSegoe { get; } = new("\uEC50");
|
||||
|
||||
internal static IconInfo FileExplorer { get; } = IconHelpers.FromRelativePath("Assets\\FileExplorer.png");
|
||||
|
||||
internal static IconInfo Actions { get; } = IconHelpers.FromRelativePath("Assets\\Actions.png");
|
||||
|
||||
internal static IconInfo OpenFile { get; } = new("\uE8E5"); // OpenFile
|
||||
|
||||
internal static IconInfo Document { get; } = new("\uE8A5"); // Document
|
||||
|
||||
internal static IconInfo FolderOpen { get; } = new("\uE838"); // FolderOpen
|
||||
}
|
||||
@@ -24,7 +24,7 @@ internal sealed partial class IndexerPage : DynamicListPage, IDisposable
|
||||
public IndexerPage()
|
||||
{
|
||||
Id = "com.microsoft.indexer.fileSearch";
|
||||
Icon = Icons.FileExplorer;
|
||||
Icon = Icons.FileExplorerIcon;
|
||||
Name = Resources.Indexer_Title;
|
||||
PlaceholderText = Resources.Indexer_PlaceholderText;
|
||||
_searchEngine = new();
|
||||
@@ -33,7 +33,7 @@ internal sealed partial class IndexerPage : DynamicListPage, IDisposable
|
||||
|
||||
public IndexerPage(string query, SearchEngine searchEngine, uint queryCookie, IList<IListItem> firstPageData)
|
||||
{
|
||||
Icon = Icons.FileExplorer;
|
||||
Icon = Icons.FileExplorerIcon;
|
||||
Name = Resources.Indexer_Title;
|
||||
_searchEngine = searchEngine;
|
||||
_queryCookie = queryCookie;
|
||||
|
||||
Reference in New Issue
Block a user