mirror of
https://github.com/QL-Win/QuickLook.git
synced 2026-01-29 02:06:48 +08:00
Supplement AutoReload features
This commit is contained in:
@@ -58,6 +58,7 @@ internal class NativeProvider : AnimationProvider
|
||||
img.BeginInit();
|
||||
img.UriSource = Path;
|
||||
img.CacheOption = BitmapCacheOption.OnLoad;
|
||||
img.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
|
||||
// specific renderSize to avoid .net's double to int conversion
|
||||
img.DecodePixelWidth = rotate ? decodeHeight : decodeWidth;
|
||||
img.DecodePixelHeight = rotate ? decodeWidth : decodeHeight;
|
||||
@@ -97,6 +98,7 @@ internal class NativeProvider : AnimationProvider
|
||||
img.BeginInit();
|
||||
img.UriSource = Path;
|
||||
img.CacheOption = BitmapCacheOption.OnLoad;
|
||||
img.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
|
||||
img.DecodePixelWidth = (int)(rotate ? fullSize.Height : fullSize.Width);
|
||||
img.DecodePixelHeight = (int)(rotate ? fullSize.Width : fullSize.Height);
|
||||
img.EndInit();
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
<MW_OpenWithMenu>Öffnen mit ...</MW_OpenWithMenu>
|
||||
<MW_Run>{0} ausführen</MW_Run>
|
||||
<MW_Share>Freigeben</MW_Share>
|
||||
<MW_Reload>Reload</MW_Reload>
|
||||
<MW_Reload>Neu laden</MW_Reload>
|
||||
<Icon_RunAtStartup>Beim Systemstart &ausführen</Icon_RunAtStartup>
|
||||
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
|
||||
<Icon_CheckUpdate>Nach &Updates suchen</Icon_CheckUpdate>
|
||||
@@ -243,7 +243,7 @@
|
||||
<MW_OpenWithMenu>Abrir Con Menu</MW_OpenWithMenu>
|
||||
<MW_Run>Iniciar {0}</MW_Run>
|
||||
<MW_Share>Compartir</MW_Share>
|
||||
<MW_Reload>Reload</MW_Reload>
|
||||
<MW_Reload>Recargar</MW_Reload>
|
||||
<Icon_RunAtStartup>Iniciar con el &sistema</Icon_RunAtStartup>
|
||||
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
|
||||
<Icon_CheckUpdate>Buscar &Actualizaciones...</Icon_CheckUpdate>
|
||||
@@ -272,6 +272,7 @@
|
||||
<MW_Open>Ouvrir {0}</MW_Open>
|
||||
<MW_OpenWith>Ouvrir avec {0}</MW_OpenWith>
|
||||
<MW_Run>Exécuter {0}</MW_Run>
|
||||
<MW_Reload>Recharger</MW_Reload>
|
||||
<Icon_RunAtStartup>Exécuter au &démarrage</Icon_RunAtStartup>
|
||||
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
|
||||
<Icon_CheckUpdate>Vérifier s'il existe des &mises à jour...</Icon_CheckUpdate>
|
||||
@@ -300,6 +301,7 @@
|
||||
<MW_Open>Apri {0}</MW_Open>
|
||||
<MW_OpenWith>Apri con {0}</MW_OpenWith>
|
||||
<MW_Run>Esegui {0}</MW_Run>
|
||||
<MW_Reload>Ricarica</MW_Reload>
|
||||
<Icon_RunAtStartup>Esegui all'&Avvio</Icon_RunAtStartup>
|
||||
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
|
||||
<Icon_CheckUpdate>Verifica &Aggiornamenti...</Icon_CheckUpdate>
|
||||
@@ -331,7 +333,7 @@
|
||||
<MW_OpenWithMenu>メニューから選択して開く</MW_OpenWithMenu>
|
||||
<MW_Run>{0} を起動</MW_Run>
|
||||
<MW_Share>シェア</MW_Share>
|
||||
<MW_Reload>Reload</MW_Reload>
|
||||
<MW_Reload>再読み込み</MW_Reload>
|
||||
<Icon_RunAtStartup>スタートアップ時に起動</Icon_RunAtStartup>
|
||||
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
|
||||
<Icon_CheckUpdate>更新を確認する... (&U)</Icon_CheckUpdate>
|
||||
@@ -415,7 +417,7 @@
|
||||
<MW_OpenWith>Otwórz w {0}</MW_OpenWith>
|
||||
<MW_Run>Uruchom {0}</MW_Run>
|
||||
<MW_Share>Udostępnij</MW_Share>
|
||||
<MW_Reload>Reload</MW_Reload>
|
||||
<MW_Reload>Przeładuj</MW_Reload>
|
||||
<Icon_RunAtStartup>Uruchamiaj automatycznie z systemem</Icon_RunAtStartup>
|
||||
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
|
||||
<Icon_CheckUpdate>Sprawdź &aktualizacje...</Icon_CheckUpdate>
|
||||
@@ -448,7 +450,7 @@
|
||||
<MW_OpenWithMenu>Menu abrir com</MW_OpenWithMenu>
|
||||
<MW_Run>Executar {0}</MW_Run>
|
||||
<MW_Share>Compartilhar</MW_Share>
|
||||
<MW_Reload>Reload</MW_Reload>
|
||||
<MW_Reload>Recarregar</MW_Reload>
|
||||
<Icon_RunAtStartup>Executar na &Inicialização</Icon_RunAtStartup>
|
||||
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
|
||||
<Icon_CheckUpdate>Procurar por &Atualizações...</Icon_CheckUpdate>
|
||||
@@ -505,7 +507,7 @@
|
||||
<MW_StayTop>Поверх всех окон</MW_StayTop>
|
||||
<MW_PreventClosing>Закрепить</MW_PreventClosing>
|
||||
<MW_Share>Поделиться</MW_Share>
|
||||
<MW_Reload>Reload</MW_Reload>
|
||||
<MW_Reload>Перезагрузить</MW_Reload>
|
||||
<Icon_RunAtStartup>Автозапуск</Icon_RunAtStartup>
|
||||
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
|
||||
<Icon_CheckUpdate>Проверить &обновления…</Icon_CheckUpdate>
|
||||
@@ -565,7 +567,7 @@
|
||||
<MW_OpenWithMenu>Відкрити за допомогою меню</MW_OpenWithMenu>
|
||||
<MW_Run>Запустити {0}</MW_Run>
|
||||
<MW_Share>Поширити</MW_Share>
|
||||
<MW_Reload>Reload</MW_Reload>
|
||||
<MW_Reload>Перезавантажити</MW_Reload>
|
||||
<Icon_RunAtStartup>Запускати під час &старту</Icon_RunAtStartup>
|
||||
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
|
||||
<Icon_CheckUpdate>Перевірити наявність &оновлення…</Icon_CheckUpdate>
|
||||
@@ -624,7 +626,7 @@
|
||||
<MW_OpenWithMenu>从菜单选择打开</MW_OpenWithMenu>
|
||||
<MW_Run>运行 {0}</MW_Run>
|
||||
<MW_Share>分享</MW_Share>
|
||||
<MW_Reload>Reload</MW_Reload>
|
||||
<MW_Reload>重新加载</MW_Reload>
|
||||
<Icon_RunAtStartup>启动时自动运行 (&S)</Icon_RunAtStartup>
|
||||
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
|
||||
<Icon_CheckUpdate>检查更新... (&U)</Icon_CheckUpdate>
|
||||
@@ -658,7 +660,7 @@
|
||||
<MW_OpenWithMenu>從選單選擇開啟</MW_OpenWithMenu>
|
||||
<MW_Run>執行 {0}</MW_Run>
|
||||
<MW_Share>分享</MW_Share>
|
||||
<MW_Reload>Reload</MW_Reload>
|
||||
<MW_Reload>重新載入</MW_Reload>
|
||||
<Icon_RunAtStartup>系統啟動時自動執行 (&S)</Icon_RunAtStartup>
|
||||
<Icon_ToolTip>QuickLook v{0}</Icon_ToolTip>
|
||||
<Icon_CheckUpdate>檢查更新... (&U)</Icon_CheckUpdate>
|
||||
|
||||
@@ -162,6 +162,7 @@ public partial class ViewerWindow
|
||||
|
||||
if (_autoReloadWatcher != null)
|
||||
{
|
||||
_autoReloadWatcher.EnableRaisingEvents = false;
|
||||
_autoReloadWatcher.Dispose();
|
||||
_autoReloadWatcher = null;
|
||||
}
|
||||
@@ -220,17 +221,16 @@ public partial class ViewerWindow
|
||||
if (_autoReload && File.Exists(path))
|
||||
{
|
||||
_autoReloadWatcher?.Dispose();
|
||||
_autoReloadWatcher = new FileSystemWatcher(Path.GetDirectoryName(path)!, Path.GetFileName(path)!)
|
||||
_autoReloadWatcher = new FileSystemWatcher(Path.GetDirectoryName(path), Path.GetFileName(path))
|
||||
{
|
||||
NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size
|
||||
NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size,
|
||||
};
|
||||
_autoReloadWatcher.Changed += (_, _) => Dispatcher.Invoke(() => ViewWindowManager.GetInstance().ReloadPreview());
|
||||
_autoReloadWatcher.Changed += (_, _) =>
|
||||
// Executed asynchronously to avoid deadlock
|
||||
Dispatcher.BeginInvoke(() => ViewWindowManager.GetInstance().ReloadPreview());
|
||||
_autoReloadWatcher.EnableRaisingEvents = true;
|
||||
}
|
||||
|
||||
//ShowWindowCaptionContainer(null, null);
|
||||
//WindowHelper.SetActivate(new WindowInteropHelper(this), ContextObject.CanFocus);
|
||||
|
||||
// load plugin, do not block UI
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ public partial class ViewerWindow : Window
|
||||
private Size _customWindowSize = Size.Empty;
|
||||
private bool _ignoreNextWindowSizeChange;
|
||||
private string _path = string.Empty;
|
||||
private FileSystemWatcher? _autoReloadWatcher;
|
||||
private FileSystemWatcher _autoReloadWatcher;
|
||||
private readonly bool _autoReload;
|
||||
|
||||
internal ViewerWindow()
|
||||
@@ -109,6 +109,8 @@ public partial class ViewerWindow : Window
|
||||
buttonShare.Click += (_, _) => ShareHelper.Share(_path, this);
|
||||
buttonOpenWith.Click += (_, _) => ShareHelper.Share(_path, this, true);
|
||||
|
||||
buttonReload.Visibility = SettingHelper.Get("ShowReload", false) ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
// Set UI translations
|
||||
buttonTop.ToolTip = TranslationHelper.Get("MW_StayTop");
|
||||
buttonPin.ToolTip = TranslationHelper.Get("MW_PreventClosing");
|
||||
|
||||
Reference in New Issue
Block a user