mirror of
https://github.com/QL-Win/QuickLook.git
synced 2026-05-07 02:00:21 +08:00
Add cross-plugin 'Open in' more-menu items
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
// Copyright © 2017-2026 QL-Win Contributors
|
||||
//
|
||||
// This file is part of QuickLook program.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
using QuickLook.Common.Commands;
|
||||
using QuickLook.Common.Controls;
|
||||
using QuickLook.Common.Helpers;
|
||||
using QuickLook.Common.Plugin.MoreMenu;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace QuickLook.Plugin.AppViewer;
|
||||
|
||||
public sealed partial class Plugin
|
||||
{
|
||||
public IEnumerable<IMenuItem> GetMenuItems()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_path))
|
||||
yield break;
|
||||
|
||||
string translationFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Translations.config");
|
||||
|
||||
if (_path.EndsWith(".apk", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".apk.1", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".aab", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".ipa", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".hap", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".hap.1", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".appx", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".appxbundle", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".msix", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".msixbundle", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".nupkg", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".snupkg", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".wgt", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".wgtu", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".aar", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".har", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// If the file is ZIP-based (PK..), allow reopening with ArchiveViewer
|
||||
yield return new MoreMenuItem()
|
||||
{
|
||||
Icon = FontSymbols.Tablet,
|
||||
Header = TranslationHelper.Get("MW_OpenInArchiveViewer", translationFile),
|
||||
MenuItems = null,
|
||||
Command = new RelayCommand(() => PluginHelper.InvokePluginPreview("QuickLook.Plugin.ArchiveViewer", _path)),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
using QuickLook.Common.Plugin;
|
||||
using QuickLook.Common.Plugin.MoreMenu;
|
||||
using System.Collections.Generic;
|
||||
using QuickLook.Plugin.AppViewer.InfoPanels;
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -24,7 +26,7 @@ using System.Windows;
|
||||
|
||||
namespace QuickLook.Plugin.AppViewer;
|
||||
|
||||
public sealed class Plugin : IViewer
|
||||
public sealed partial class Plugin : IViewer, IMoreMenu
|
||||
{
|
||||
private static readonly string[] _extensions =
|
||||
[
|
||||
@@ -68,6 +70,8 @@ public sealed class Plugin : IViewer
|
||||
|
||||
public int Priority => 0;
|
||||
|
||||
public IEnumerable<IMenuItem> MenuItems => GetMenuItems();
|
||||
|
||||
public void Init()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -200,6 +200,7 @@
|
||||
<NUGET_LICENSE>License</NUGET_LICENSE>
|
||||
<NUGET_FRAMEWORKS>Target Frameworks</NUGET_FRAMEWORKS>
|
||||
<NUGET_DEPENDENCIES>Dependencies</NUGET_DEPENDENCIES>
|
||||
<MW_OpenInArchiveViewer>Open with Archive Viewer</MW_OpenInArchiveViewer>
|
||||
</en>
|
||||
<ko>
|
||||
<PRODUCT_VERSION>제품 버전</PRODUCT_VERSION>
|
||||
@@ -320,6 +321,7 @@
|
||||
<NUGET_LICENSE>许可证</NUGET_LICENSE>
|
||||
<NUGET_FRAMEWORKS>目标框架</NUGET_FRAMEWORKS>
|
||||
<NUGET_DEPENDENCIES>依赖项</NUGET_DEPENDENCIES>
|
||||
<MW_OpenInArchiveViewer>在归档查看器中打开</MW_OpenInArchiveViewer>
|
||||
</zh-CN>
|
||||
<zh-TW>
|
||||
<PRODUCT_VERSION>產品版本</PRODUCT_VERSION>
|
||||
|
||||
@@ -53,14 +53,17 @@ public sealed partial class Plugin
|
||||
/// </summary>
|
||||
public IEnumerable<IMenuItem> GetMenuItems()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_path))
|
||||
yield break;
|
||||
|
||||
// Use external Translations.config shipped next to the executing assembly
|
||||
string translationFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Translations.config");
|
||||
|
||||
// Currently only supports for CFB and EIF files
|
||||
if (_path.EndsWith(".cfb", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".eif", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".pak", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Use external Translations.config shipped next to the executing assembly
|
||||
string translationFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Translations.config");
|
||||
|
||||
yield return new MoreMenuItem()
|
||||
{
|
||||
Icon = FontSymbols.MoveToFolder,
|
||||
@@ -69,6 +72,31 @@ public sealed partial class Plugin
|
||||
Command = ExtractToDirectoryCommand,
|
||||
};
|
||||
}
|
||||
else if (_path.EndsWith(".apk", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".apk.1", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".aab", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".ipa", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".hap", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".hap.1", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".appx", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".appxbundle", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".msix", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".msixbundle", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".nupkg", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".snupkg", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".wgt", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".wgtu", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".aar", StringComparison.OrdinalIgnoreCase)
|
||||
|| _path.EndsWith(".har", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
yield return new MoreMenuItem()
|
||||
{
|
||||
Icon = FontSymbols.Package,
|
||||
Header = TranslationHelper.Get("MW_OpenInAppViewer", translationFile),
|
||||
MenuItems = null,
|
||||
Command = new RelayCommand(() => PluginHelper.InvokePluginPreview("QuickLook.Plugin.AppViewer", _path)),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<en>
|
||||
<MW_ExtractToDirectory>Extract to directory</MW_ExtractToDirectory>
|
||||
<MW_ExtractToDirectory_EIFOrderFaceDat>Do you want to keep the order of stored sticker files?</MW_ExtractToDirectory_EIFOrderFaceDat>
|
||||
<MW_OpenInAppViewer>Open with App Viewer</MW_OpenInAppViewer>
|
||||
</en>
|
||||
<ko>
|
||||
<MW_ExtractToDirectory>폴더로 추출</MW_ExtractToDirectory>
|
||||
@@ -96,6 +97,7 @@
|
||||
<zh-CN>
|
||||
<MW_ExtractToDirectory>提取到目录</MW_ExtractToDirectory>
|
||||
<MW_ExtractToDirectory_EIFOrderFaceDat>是否需要保持已保存表情包文件的顺序?</MW_ExtractToDirectory_EIFOrderFaceDat>
|
||||
<MW_OpenInAppViewer>在应用查看器中打开</MW_OpenInAppViewer>
|
||||
</zh-CN>
|
||||
<zh-TW>
|
||||
<MW_ExtractToDirectory>提取到資料夾</MW_ExtractToDirectory>
|
||||
|
||||
Reference in New Issue
Block a user