Author Topic: Quicklook - nearly works  (Read 25416 times)

jfmoyen

  • Newbie
  • *
  • Posts: 6
    • View Profile
Quicklook - nearly works
« on: February 12, 2024, 16:49:52 »
Good evening,

A couple of years ago an user reported a rather nice previewer app, called quicklook (https://github.com/QL-Win/QuickLook)
(this thread: https://forum.multicommander.com/forum/index.php?topic=4148.0 )

In the present situation, I'm frustratingly close from getting QL to work with multicommander.

In "filetype setup", I created a new viewer app with extension *.jpg (for time being), replacing therefore the regular MC Picture Viewer. Program path is "C:/path/to/QuickLook.exe", and Program parameters are "${filepath}"

When I select a jpg and press F1, QuickLook dutifully fires and displays the image, as it should. So far, so good.

Now the frustrating part. The nicest feature of QL is that, if you move through your files in windows explorer (with up/down arrow, or by selecting another file with the mouse), QL automatically updates to show the currently selected file.

In multicommander, if I move up/down (or select another file), QL keeps the originally selected file, unless I press F1 again. Now, this is a minor irritant admittedly, but it seems so close from perfection... Is there perhaps a way to tweak my settings so that changing the selected file will trigger the command again, thus forcing QL to "update" ?

Thanks!

« Last Edit: February 12, 2024, 16:51:26 by jfmoyen »

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4489
    • View Profile
    • Multi Commander
Re: Quicklook - nearly works
« Reply #1 on: February 12, 2024, 18:57:53 »
QuickLook does not know when the focus of a file in MC changes.

MC got its own preview panel, and there you can preview images/pdf and more insida a tab.. That will update when focus changes. It might not be as extension av quicklook



jfmoyen

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Quicklook - nearly works
« Reply #2 on: February 12, 2024, 21:52:43 »
QuickLook does not know when the focus of a file in MC changes.

Indeed, so my question is probably, "is there a way to politely request MC to pass that info to QL" - after all, many file managers manage to do it (Windows, but also many of the *Commander and a slate of others - see https://github.com/QL-Win/QuickLook/wiki/File-Managers ). There may be profound technical reasons, of course, but at face value it does not sound implausible or unfeasible, I was wondering whether I had maybe overlooked an obvious setting.

Quote
MC got its own preview panel, and there you can preview images/pdf and more insida a tab.. That will update when focus changes. It might not be as extension av quicklook

I'm aware of that, but with due respect, QL is more versatile, deals with more file types (pdf, video...), etc. And as far as I'm concerned, it seems a bit pointless to reinvent the wheel...

(and yes, I know that"why don't you just..." is the most infuriating thing to say to a developer, don't get me wrong...  :-) )

Thanks, anyway ! And may I take the opportunity to congratulate you on a great piece of software - it was love at first sight.... :-) Effectively, it does intuitively (almost) everything a file manager should do, in my books at least...
« Last Edit: February 12, 2024, 22:22:09 by jfmoyen »

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4489
    • View Profile
    • Multi Commander
Re: Quicklook - nearly works
« Reply #3 on: February 12, 2024, 23:08:20 »
QuickLook does not know when the focus of a file in MC changes.

Indeed, so my question is probably, "is there a way to politely request MC to pass that info to QL" - after all, many file managers manage to do it (Windows, but also many of the *Commander and a slate of others - see https://github.com/QL-Win/QuickLook/wiki/File-Managers ). There may be profound technical reasons, of course, but at face value it does not sound implausible or unfeasible, I was wondering whether I had maybe overlooked an obvious setting.


Only FM that manage to do it is Windows. None of the other 3rd party filemanager can do that from what I see. Don't see any API for 3rd party tools
That it might work in Windows explorer is becuse I think they probably hook them self into the preview handler or into the shell.

Matthias515566

  • Power Member
  • ****
  • Posts: 325
    • View Profile
Re: Quicklook - nearly works
« Reply #4 on: February 12, 2024, 23:14:36 »
MC got its own preview panel, and there you can preview images/pdf and more insida a tab..
This does not work properly. All my PDFs are displayed as empty, and while testing, MultiCommander crashed and was killed. DXF files are also very important for the preview. It would be better to completely remove the feature, as it is not usable in its current state.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4489
    • View Profile
    • Multi Commander
Re: Quicklook - nearly works
« Reply #5 on: February 12, 2024, 23:19:52 »
MC got its own preview panel, and there you can preview images/pdf and more insida a tab..
This does not work properly. All my PDFs are displayed as empty, and while testing, MultiCommander crashed and was killed. DXF files are also very important for the preview. It would be better to completely remove the feature, as it is not usable in its current state.

Strange . Works perfectly for me. previewing PDFs daily. but it depend on the PDF viewer.. might be some none default pdf preview handler that is installed that works differently.
PDF / Word / Excel and some other format are depend on that there is a Windows Preview Handler installed for that format. MC do not render them by it self
There is not any noticeably amount of crashes for the preview. So if a crash report is sent. let me know the crash id. and I can take a manual look.
Also if you have a WindowsPreviewHandler installed for DXF you need to add it to allowed file types for MC to pick it up.
« Last Edit: February 12, 2024, 23:23:58 by Mathias (Author) »

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 555
  • Old Skull
    • View Profile
Re: Quicklook - nearly works
« Reply #6 on: February 13, 2024, 07:15:57 »
I think that the easiest way would be to allow external app in the preview setup.

Another way - events. Multiple times I wanted to suggest this feature but I'm not sure it's worth the efforts. The point is to allow executing scripts/UDC on certain events like MC start/exit, change file focus, opening/closing tabs, begin/end file operations etc. But I don't think it would be useful.

jfmoyen

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Quicklook - nearly works
« Reply #7 on: February 13, 2024, 08:04:03 »
QuickLook does not know when the focus of a file in MC changes.

Indeed, so my question is probably, "is there a way to politely request MC to pass that info to QL" - after all, many file managers manage to do it (Windows, but also many of the *Commander and a slate of others - see https://github.com/QL-Win/QuickLook/wiki/File-Managers ). There may be profound technical reasons, of course, but at face value it does not sound implausible or unfeasible, I was wondering whether I had maybe overlooked an obvious setting.


Only FM that manage to do it is Windows. None of the other 3rd party filemanager can do that from what I see. Don't see any API for 3rd party tools
That it might work in Windows explorer is becuse I think they probably hook them self into the preview handler or into the shell.

I respectfully disagree. I just tested, and it does work in OneCommander (https://onecommander.com/). Now of course I have no idea how they do it.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4489
    • View Profile
    • Multi Commander
Re: Quicklook - nearly works
« Reply #8 on: February 13, 2024, 08:39:59 »
QuickLook does not know when the focus of a file in MC changes.

Indeed, so my question is probably, "is there a way to politely request MC to pass that info to QL" - after all, many file managers manage to do it (Windows, but also many of the *Commander and a slate of others - see https://github.com/QL-Win/QuickLook/wiki/File-Managers ). There may be profound technical reasons, of course, but at face value it does not sound implausible or unfeasible, I was wondering whether I had maybe overlooked an obvious setting.


Only FM that manage to do it is Windows. None of the other 3rd party filemanager can do that from what I see. Don't see any API for 3rd party tools
That it might work in Windows explorer is becuse I think they probably hook them self into the preview handler or into the shell.

I respectfully disagree. I just tested, and it does work in OneCommander (https://onecommander.com/). Now of course I have no idea how they do it.
OneCommander I never heard of. Might be built on top of Windows Shell.  But TC,FC , XY only support to view on command. eg https://github.com/QL-Win/QuickLook/wiki/Total-Commander

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 555
  • Old Skull
    • View Profile
Re: Quicklook - nearly works
« Reply #9 on: February 13, 2024, 08:42:09 »
Now of course I have no idea how they do it.
I've taken a look at the sources, and from what I've seen and understood, QuickLook constantly monitors active window and tries to get selection from it if the window type matches supported managers (explorer, dopus etc.)

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4489
    • View Profile
    • Multi Commander
Re: Quicklook - nearly works
« Reply #10 on: February 13, 2024, 08:57:49 »
I think that the easiest way would be to allow external app in the preview setup.

Another way - events. Multiple times I wanted to suggest this feature but I'm not sure it's worth the efforts. The point is to allow executing scripts/UDC on certain events like MC start/exit, change file focus, opening/closing tabs, begin/end file operations etc. But I don't think it would be useful.
Also been think about some event system to hook into. However there are so many situation that cause issue. specially it depends on what the "script" would do.. And it is also hard to limit what script function can be used to avoid issue and so..
So so far nothing yet since it is very complicated to implement. and I'm not sure many will use it either.. so might be waste of time..

jfmoyen

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Quicklook - nearly works
« Reply #11 on: February 13, 2024, 14:12:07 »
Now of course I have no idea how they do it.
I've taken a look at the sources, and from what I've seen and understood, QuickLook constantly monitors active window and tries to get selection from it if the window type matches supported managers (explorer, dopus etc.)

I see, so the "issue" (if it is an issue) should be fixed from QL side then, by having it watching more managers...

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 555
  • Old Skull
    • View Profile
Re: Quicklook - nearly works
« Reply #12 on: February 13, 2024, 18:21:32 »
I see, so the "issue" (if it is an issue) should be fixed from QL side then, by having it watching more managers...
It's not an issue. Unfortunately, adding custom file manager support can't be done by creating independent dll. This would require to change QuickLook.Native project. But the first impression makes me think that adding MC support to QL shouldn't be hard for someone who has Visual Studio installed.

Matthias515566

  • Power Member
  • ****
  • Posts: 325
    • View Profile
Re: Quicklook - nearly works
« Reply #13 on: February 15, 2024, 05:56:00 »
crash report
There is no crash report because the MultiCommander instance is terminated without any message. The window closes, and the executable is terminated without any message. I have no preview software installed in Windows, and some services may be disabled. I use Adobe Reader and ABBYY FineReader for PDFs. It would be better for MultiCommander to operate independently and not rely on Windows features that may be disabled by users.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4489
    • View Profile
    • Multi Commander
Re: Quicklook - nearly works
« Reply #14 on: February 15, 2024, 06:07:58 »
crash report
There is no crash report because the MultiCommander instance is terminated without any message. The window closes, and the executable is terminated without any message. I have no preview software installed in Windows, and some services may be disabled. I use Adobe Reader and ABBYY FineReader for PDFs. It would be better for MultiCommander to operate independently and not rely on Windows features that may be disabled by users.
Maybe you turned it of. Becuse normally a crash report is sent and a dialog shown with a crash ID if MC is just terminated..

All windows have Preview software installed... A lot of them are built from microsoft. If you can show preview in Windows Explorer you have them installed, MC uses the same preview handlers..
Both AdobeReader and FineReader is normally installing its own Preview Handler for PDF.. So then MC is using that via the WindowsPreviewHandler API..

If MC would not use built in features would be a waste. Why invent the wheel again?.  It would also take enormous amount of extra work. Parsing and rendering for example PDF are a a very huge and complex task. It is a project that is as big as the rest of MC.
It is just really not possible.

« Last Edit: February 15, 2024, 06:11:16 by Mathias (Author) »

Matthias515566

  • Power Member
  • ****
  • Posts: 325
    • View Profile
Re: Quicklook - nearly works
« Reply #15 on: February 16, 2024, 13:01:16 »
I never used the PDF preview in Windows Explorer before, but I've tested this feature now and I have to say, it works, but it doesn't work in MC. Moreover, the crash without any crash report is repeatable; it takes 3-5 minutes, and then it crashes. The preview for images works.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4489
    • View Profile
    • Multi Commander
Re: Quicklook - nearly works
« Reply #16 on: February 16, 2024, 18:19:32 »
I never used the PDF preview in Windows Explorer before, but I've tested this feature now and I have to say, it works, but it doesn't work in MC. Moreover, the crash without any crash report is repeatable; it takes 3-5 minutes, and then it crashes. The preview for images works.

I guess that it uses the FineReader WindowsPreviewHandler.  I have not have any issues with the default preview viewer that is provided by windows
However if you want to disable the pdf preview you can do it in preview customized and in the configuration for Pdf and office files.. remove the "*.pdf" file matching..

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 555
  • Old Skull
    • View Profile
Re: Quicklook - nearly works
« Reply #17 on: February 21, 2024, 09:28:03 »
@jfmoyen,
Well, I've made QL to monitor MC. Here's the files. Archive contains only updated binaries along with source files, so you can build QL yourself. Password is QuickLook
« Last Edit: February 21, 2024, 09:31:06 by Jungle »

jfmoyen

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Quicklook - nearly works
« Reply #18 on: February 21, 2024, 18:23:58 »
@jfmoyen,
Well, I've made QL to monitor MC. Here's the files. Archive contains only updated binaries along with source files, so you can build QL yourself. Password is QuickLook

Well, you're a star, what can I say ?
Except - when I press space (my binding for preview, replaces the regular F1) QL appears, and then disappears immediately - UNLESS I very quickly move (up/down arrow) to another file. In which case QL stays open and has the expected behaviour.

It's tantalizingly close from perfect :-)

Please tell me if there is anything useful I can do to help diagnose.


Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 555
  • Old Skull
    • View Profile
Re: Quicklook - nearly works
« Reply #19 on: February 21, 2024, 19:41:25 »
@jfmoyen,

AFAIK Space is the default (and the only) hotkey registered by QL itself to open and close preview. I tested 3 cases:

1) launch QL, then press Space in MC and navigate: everything looks fine;
2) create User Defined Command MC.Run CMD="x:\ql_path\quicklook.exe" ARG="${focusfilepath}", assign some hotkey: fine
3) create new profile in File Type Setup / Viewers (F3 default): fine

Fine means that preview appears and stays until manually closed. I tested it on Win10 and Win11 (real and VM). I can only suppose that Space is somehow pressed twice making QL close preview (as long as Space is used for both open and close preview)
« Last Edit: February 21, 2024, 19:42:59 by Jungle »

jfmoyen

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Quicklook - nearly works
« Reply #20 on: February 22, 2024, 07:37:41 »
@jfmoyen,

AFAIK Space is the default (and the only) hotkey registered by QL itself to open and close preview. I tested 3 cases:

You are absolutely right, and I'm an idiot.... SPACE is a QL default. However, I ALSO assigned it to a MC command, along the lines of 'Quicklook.exe "${filepath}" '. So the two bindings were competing, as it were.

It works perfectly now - what a legend ! :-)

Will you commit your changes to the QL GitHub ? https://github.com/QL-Win/QuickLook
They would then be included in future updates etc.

Thanks a lot !

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 555
  • Old Skull
    • View Profile
Re: Quicklook - nearly works
« Reply #21 on: February 22, 2024, 12:07:15 »
Will you commit your changes to the QL GitHub ?
I'll try. Or will ask the author to merge the changes.