RFC: An initial, lazy port of KLook towards Qt5
ClosedPublic

Authored by fabiank on Mar 31 2018, 7:33 PM.

Details

Summary

This patch changes KLook from dead to zombie mode. The bare minimum was done to
make it compile, and then some functionality was changed to make it actually
work in the brave new Qt5 world (for displaying text and video). See D11875 for the dolphin specific changes.

What does work:

  • It can open images, play music, display text
  • In theory it plays videos, though resizing doesn't work so part of the video is not displayed
  • KLook can be started from dolphin by pressing space
  • Switching between files via <Left> and <Right> keys works when started from Dolphin

What doesn't work:

  • The media control is broken
  • Cannot scroll text
  • Okular/PDF support
  • Videos are not displayed correctly, as stated above
  • When started from Dolphin, KLook always opens the first item in the directory, instead of the currently selected one (as the handling of the -i parameter is broken)
  • As stated above, -i is not correctly handled, as KUniqueApplication::newInstance is apparently not called on the initial start of the application (only on recurring starts). Should be ported away from KUniqueApplication anway
  • If KLook is started while an instance is already running, many things break: For instance, the current item is treated as an image

What needs to be done:

  • The code needs some general cleanup
  • It needs to be ported away from KDELibs4Support
  • Video and Text have lost functionality, and don't really work. This should be fixable with a bit effort.
  • Embedding QWidgets into QML was clunky in the 1.0 days, and is just not possible with the SceneGraph so far. That means anything using QGraphicsProxyWidget needs to be replaced. Luckily, by using already existing components, Video and Text don't need to depend on QWidgets (though for now they lost some functionality/are buggy). In the current framework, it will however be impossible to embed a KPart, so the Okular integration is a no-go. It might be possible to use Poppler directly and render into a QQuickPaintedItem. Alternatively, if KLook had a QWidget at the top level, and would embed the QQuickView, we might be able to use KPart.
  • There are some custom QML elements, which can most likely be replaced with equivalents from Controls 2 or Kirigami
  • Lastly, some visual overhaul might be a good idea (and for that, some input from VDG might be useful)

Nothing was tested regarding embedding (not sure what the use case for this was anyway)

Test Plan

Do the cmake && make && make install trifecta, then run it on some files.

Diff Detail

Repository
R604 KLook (File Previewer)
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
fabiank requested review of this revision.Mar 31 2018, 7:33 PM
fabiank created this revision.
fabiank edited the summary of this revision. (Show Details)Mar 31 2018, 7:36 PM
fabiank added a reviewer: ngraham.

@ngraham : I've added you as a reviewer, as I've initially stumbled (again) over KLook due to Bug 272539, and you were the last one active there. If you know anyone else who this might concern, please add them. This is really mostly meant as a RFC, and to probe if there is even interest in reviving KLook.

You bet there's interest!!! Thanks so much for doing this. The real killer feature is Dolphin integration via the space bar and arrow keys (to switch the focus to other fies). It would be great to get that working again.

Is there a reason to require CMake 3.10? That's pretty new. I was able to build the patched versio just fine with 3.5.1.

Wanna add an .arcconfig file as part of this patch too?

If and when this is returned from death to zombie form, I will take the lead on a visual overhaul/modernization.

Thanks again for this fantastic work!

Is there a reason to require CMake 3.10? That's pretty new. I was able to build the patched versio just fine with 3.5.1.

I hadn't any older version to test it with, so this was just a conservative setting, but I guess it might even work with a version older than 3.5

Wanna add an .arcconfig file as part of this patch too?

If you could tell me what belongs into it, I can do it. I'm not really used to arc yet.

Is there a reason to require CMake 3.10? That's pretty new. I was able to build the patched versio just fine with 3.5.1.

I hadn't any older version to test it with, so this was just a conservative setting, but I guess it might even work with a version older than 3.5

Wanna add an .arcconfig file as part of this patch too?

If you could tell me what belongs into it, I can do it. I'm not really used to arc yet.

Just copy the the file from any other repo:

$ cat kio/.arcconfig 
{
  "phabricator.uri" : "https://phabricator.kde.org/"
}
fabiank updated this revision to Diff 31063.Mar 31 2018, 8:03 PM
  • add .arcconfig file
fabiank updated this revision to Diff 31065.Mar 31 2018, 8:05 PM
  • reduce CMake version requirement
fabiank updated this revision to Diff 31073.Mar 31 2018, 10:13 PM
  • split monolithic dolphin patch, currently doe only partially apply
fabiank updated this revision to Diff 31120.Apr 1 2018, 7:46 PM
fabiank updated this revision to Diff 31125.Apr 1 2018, 8:58 PM
  • updated dolphin patch again
fabiank edited the summary of this revision. (Show Details)Apr 1 2018, 9:07 PM

@ngraham : So the dolphin integration works partially (as described above in the summary). I guess some input from the dolphin team would be helpful now. D11875 contains the dolphin patch so that it can be easier reviewed. I'm not so sure whether and how the discussion should be split between the two review requests.

fabiank edited the summary of this revision. (Show Details)
fabiank edited the summary of this revision. (Show Details)Apr 1 2018, 9:22 PM
fabiank updated this revision to Diff 31147.Apr 2 2018, 12:32 PM
  • start porting away for KDE4LibsSupport to ease fixing some bugs
fabiank updated this revision to Diff 31151.Apr 2 2018, 2:26 PM
  • fix initial image selection

@bcooksley Would it be possible to set up a project page for KLook? Having all the todos as actionable tasks in a Workboard and being able to prioritize them would be more helpful than having half of them as a list in a text document, and the other half merely existing in my head. Also, when @ngraham decides to list all the usability and design improvements that are needed (which isn't really my area of expertise), he could put them there, too.

fabiank updated this revision to Diff 31155.Apr 2 2018, 4:17 PM
  • Text preview allows scrolling again
fabiank updated this revision to Diff 31169.Apr 2 2018, 6:17 PM
  • video preview resizes correctly now (for some reason videos take very long to play though)
fabiank updated this revision to Diff 31178.Apr 2 2018, 9:41 PM
  • do not depend on phonon to detect if we support a video format
  • directly conect to mimetype signal, which appears to be emitted significantly earlier than result
  • TODO: new mimetype detection breaks the directory case, as it is considered an error (though we still get inode/directory as the result). Add special detection for dirs.
fabiank updated this revision to Diff 31216.Apr 3 2018, 2:33 PM
  • remove old connect
  • support directories again
This revision was not accepted when it landed; it landed in state Needs Review.Apr 3 2018, 2:34 PM
This revision was automatically updated to reflect the committed changes.

Magnificent.