mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-12 18:39:45 +00:00
start working on NConvert
This commit is contained in:
@@ -19,10 +19,8 @@ using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using ImageMagick;
|
||||
using QuickLook.Common.Helpers;
|
||||
using QuickLook.Common.Plugin;
|
||||
using QuickLook.Plugin.ImageViewer.Exiv2;
|
||||
|
||||
namespace QuickLook.Plugin.ImageViewer
|
||||
{
|
||||
@@ -40,15 +38,13 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
// animated
|
||||
".png", ".apng", ".gif"
|
||||
};
|
||||
private Size _imageSize;
|
||||
private ImagePanel _ip;
|
||||
private Meta _meta;
|
||||
private NConvert _meta;
|
||||
|
||||
public int Priority => int.MaxValue;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
new MagickImage().Dispose();
|
||||
}
|
||||
|
||||
public bool CanHandle(string path)
|
||||
@@ -58,10 +54,12 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
|
||||
public void Prepare(string path, ContextObject context)
|
||||
{
|
||||
_imageSize = ImageFileHelper.GetImageSize(path, _meta = new Meta(path));
|
||||
_meta = new NConvert(path);
|
||||
|
||||
if (!_imageSize.IsEmpty)
|
||||
context.SetPreferredSizeFit(_imageSize, 0.8);
|
||||
var size = _meta.GetSize();
|
||||
|
||||
if (!size.IsEmpty)
|
||||
context.SetPreferredSizeFit(size, 0.8);
|
||||
else
|
||||
context.PreferredSize = new Size(800, 600);
|
||||
|
||||
@@ -71,11 +69,12 @@ namespace QuickLook.Plugin.ImageViewer
|
||||
public void View(string path, ContextObject context)
|
||||
{
|
||||
_ip = new ImagePanel(context, _meta);
|
||||
var size = _meta.GetSize();
|
||||
|
||||
context.ViewerContent = _ip;
|
||||
context.Title = _imageSize.IsEmpty
|
||||
context.Title = size.IsEmpty
|
||||
? $"{Path.GetFileName(path)}"
|
||||
: $"{Path.GetFileName(path)} ({_imageSize.Width}×{_imageSize.Height})";
|
||||
: $"{Path.GetFileName(path)} ({size.Width}×{size.Height})";
|
||||
|
||||
LoadImage(_ip, path);
|
||||
|
||||
|
Reference in New Issue
Block a user