This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Porting a script to Amarok KF5

Tags: None
(comma "," separated)
snack
Registered Member
Posts
7
Karma
0

Porting a script to Amarok KF5

Tue Aug 13, 2019 9:47 am
I'm trying to port a script to the development version of Amarok which uses KF5 (I'm using commit 854844c1dc). The script uses Qt bindings to use QDir, QDirIterator etc., and loads the bindings with:
Code: Select all
Importer.loadQtBinding("qt.core");
Importer.loadQtBinding("qt.gui");

However it seems that loading Qt bidings this way is no longer supported since starting with --debug I get:
amarok: [ERROR__] bool AmarokScript::ScriptImporter::loadQtBinding(const QString&) Loading Qt bindings in scripts not available in Qt5!

Indeed, inspecting ScriptImporter::loadQtBinding it is obvious that this functionality has been removed.

So I thought that maybe Qt bindings are automatically available and thus commented the calls to Importer.loadQtBinding in the script. Amarok starts without errors but when I trigger the script a window pops up with this error message:
Script error reported by: BurnPlayList ReferenceError: Can't find variable: QDir

I guess then that Qt classes are not available in the script. Is there a way to fix this problem? Thanks.
snack
Registered Member
Posts
7
Karma
0
Rather than porting the script I found it easier to restore the scripting functionality in Amarok. The main problem with my script was that it used the bindings to Qt classes previously provided by qtscriptgenerator; the loading of Qt bindings was removed in the port to KF5 (see ScriptImporter::loadQtBinding). So I reverted the modification, and retrieved the bindings for Qt5 from the qcad codebase.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]