doublecmd/plugins

wlx plugin implementing OS X QuickLook

zxcat opened this issue · 4 comments

zxcat commented

I've checked sourcecode of wlx plugins here, and see they are quite easy to write even without installing Lazarus. So I decided to finally implement QuickLook.

It can be created using QLPreviewView as follows (obj-c):

NSView* myView = something(ParentWin);  // don't know how
CGRect frame = myView.bounds; // get frame (position and size), maybe add inset
QLPreviewView* qlview = [[QLPreviewView alloc] initWithFrame:frame style:QLPreviewViewStyleNormal];
[qlview setPreviewItem:item];    // item is descriptor
[myView addSubview: qlview];  // myView is parent window

item is objective-c object conforming to QLPreviewItem protocol. (It can be any object implementing required @property(readonly) NSURL *previewItemURL property and possibly optional @property(readonly) NSString *previewItemTitle property)

That's all.

But the problem here is how to convert HWND to proper myView handle.

Any ideas?

zxcat commented

Discovered some further. Plugin have HWND DCPCALL ListLoad (HWND ParentWin, char* FileToLoad, int ShowFlags) base function.

The question is: What is HWND here? Object of which class it points?

Both wlx plugins here use gtk. And HWND is GtkWidget* for them.

OS X version of DC built with QT, so HWND should be some QT class. If it's QWidget*, then I can get NSView* from it via QWidget::winId() method.

OS X version of DC built with QT, so HWND should be some QT class. If it's QWidget_, then I can get NSView_ from it via QWidget::winId() method.

Yes.

zxcat commented

The base code is ready. See my pull request #3. (It's quite dirty now and can leak)
But I still can't wrap it properly.

I tried to link plugin with QT framework which are in osx DC app (DoubleCommander.app/Contents/Frameworks/QtGui.framework/), but it won't link.
So I installed qt with brew and used it's headers and .framework to link. But it crashes (crashlog is in #3).

The problem is either in different (from used in DC) QtGui version or in bugs in my code.

  1. If internal QWidget structure differs between QT versions, it surely crash on method call.
  2. If the pointer I getting is not QWidget, it crashes too.

Any ideas how to check this or build with QtGui from DC app?

DC now has native Cocoa version, so new plugin was created.