Restore scripting functionalities and Qt bindings.
Needs RevisionPublic

Authored by nicolamori on Oct 21 2019, 6:27 AM.



Restore the loading of Qt bindings and import bindings into the Amarok code base.
The bindings files are added unmodified as extracted from the Qcad 3.23.0 codebase.
All the generated cpp files available from Qcad are added but only those
marked for complation in the original .pri file are actually built.
Place the plugin library in the build tree under bin/qtbindings/.

This is an initial RFC, development is still incomplete.


  • lots of warning during compilation, mainly override suggestions

Still missing:

  • installation
  • license check

Diff Detail

R181 Amarok
No Linters Available
No Unit Test Coverage
Build Status
Buildable 21442
Build 21460: arc lint + arc unit
nicolamori created this revision.Oct 21 2019, 6:27 AM
Restricted Application added subscribers: amarok-devel, Amarok. · View Herald TranscriptOct 21 2019, 6:27 AM
nicolamori requested review of this revision.Oct 21 2019, 6:27 AM

Nice! I don't want to discourage you, but while QtScript is still there it has been deprecated. Perhaps this still makes sense as a intermediate step, but at some point this should be ported to the QJS* classes from Qt5Qml (e.g. like done for kio

Hi Heiko, I know that QtScript is EOL but I don't have the knowledge nor spare time to do more than this ATM. I never contributed to Amarok nor any other KDE project, and also my experience with Qt is limited to some simple GUI. Nevertheless, I hope that this work migth be useful for more experienced programmers who wishes to introduce QJSEngine in Amarok, or for me to really start contributing. For the time being, I'd like to receive comments about how to proceed and what's to be changed/fixed.

nicolamori updated this revision to Diff 74024.Jan 21 2020, 4:02 PM
  • scripting: add installation rule for qt script bindings plugin libraries.
  • scripting: add readme file with credits to QCAD project.

I just uploaded a new revision with installation rules for the bindings shared libraries. I also checked the QCAD license: they release the code under GPLv3 with no exceptions (as far as I understood) for the bindings code, so I guess there's no licensing issue in using the bindings in Amarok.
I tested the code with a simple script (BurnPlaylist) which works with minor tweaks to the script itself. However, some scripts are missing some Amarok components that have been removed, e.g. UltimateLyrics gives a warning([WARNING] [ScriptItem] Script has no script engine attached: "UltimateLyrics") and does not work, I think because LyricsManager has been removed.
I'd say then that the work on restoring the Qt bindings is done, and now it has to be decided whether to go on (which means restoring the removed scripting functionalities, something I cannot do) or stop here and drop these modifications.

heikobecker requested changes to this revision.Feb 21 2020, 4:32 PM

How are those bindings generated? I assume they change depending on the used Qt version? Could it be feasible to convince cmake to generate them during build time?

Not only the generated files, but also some others you added are missing a lincese header.

However, I'm still not sure if it's worth to pursue this, QtScript is going away, no way around it. And if it turns out we break scripts, it would be nice to only do it once instead of twice. Ideally, I'd like to hear feedback from people more involved than me.


This breaks for people with lib{32,64,whatever} dirs, there's to handle this properly.

This revision now requires changes to proceed.Feb 21 2020, 4:32 PM

@heikobecker The bindings are extracted from the source of QCad; they are statically placed in their code base, with one folder for each Qt version; if there are more Qt versions sharing the same bindings then the bindings are present only for one version and for the other versions there are symlinks (actually the most recent ones when I extracted them were for Qt 5.5 and were used up to Qt 5.13). I don't know how they produced the bindings, probably hacking one of the half-baked ports to Qt5 of qtscriptgenerator that are found on github.

The most important thing in my opinion is to understand if these bindings could be used also with QJSEngine (which AFAIK should replace QtScript).; I'm not able to answer this question since I don't know how they work. But if the answer yes, and if this positive answer triggers an interest in restoring the scripting functionality by porting the QtScript code to QJSEngine, then it would be useful to pursue this development by ironing out the issues you pointed out and also interacting with QCad people.

Restricted Application added a project: Amarok. · View Herald TranscriptMar 25 2020, 6:05 PM
Restricted Application removed a subscriber: Amarok. · View Herald Transcript