D24817: Restore scripting functionalities and Qt bindings.
nicolamori created this revision. Herald added subscribers: amarok-devel, Amarok. nicolamori requested review of this revision. REVISION SUMMARY 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. Issues: - lots of warning during compilation, mainly override suggestions Still missing: - installation - license check REPOSITORY R181 Amarok BRANCH scripting REVISION DETAIL https://phabricator.kde.org/D24817 AFFECTED FILES src/CMakeLists.txt src/context/ContextView.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/com_trolltech_qt_core_init.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_Global.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAbstractAnimation.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAbstractItemModel.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAbstractListModel.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAbstractState.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAbstractTableModel.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAbstractTransition.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAnimationGroup.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QBasicMutex.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QBasicTimer.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QBitArray.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QBuffer.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QByteArray.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QByteArrayMatcher.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QChildEvent.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QCoreApplication.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QCryptographicHash.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QDate.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QDateTime.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QDir.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QDirIterator.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QDynamicPropertyChangeEvent.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QEasingCurve.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QEvent.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QEventLoop.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QEventTransition.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFile.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFileDevice.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFileInfo.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFileSystemWatcher.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFinalState.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFuture.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFutureIterator.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFutureSynchronizer.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFutureSynchronizerVoid.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFutureVoid.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFutureWatcher.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFutureWatcherVoid.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QHistoryState.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QIODevice.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QLibraryInfo.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QLocale.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QMargins.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QMimeData.cpp src/scripti
D24817: Restore scripting functionalities and Qt bindings.
heikobecker added a comment. 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 https://phabricator.kde.org/R241:4ad1902278f0fe20db3e10db40e922f015943964). REPOSITORY R181 Amarok REVISION DETAIL https://phabricator.kde.org/D24817 To: nicolamori Cc: heikobecker, #amarok, amarok-devel
D24817: Restore scripting functionalities and Qt bindings.
nicolamori added a comment. 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. REPOSITORY R181 Amarok REVISION DETAIL https://phabricator.kde.org/D24817 To: nicolamori Cc: heikobecker, #amarok, amarok-devel
D24817: Restore scripting functionalities and Qt bindings.
nicolamori updated this revision to Diff 74024. nicolamori added a comment. - scripting: add installation rule for qt script bindings plugin libraries. - scripting: add readme file with credits to QCAD project. REPOSITORY R181 Amarok CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D24817?vs=68400&id=74024 BRANCH scripting REVISION DETAIL https://phabricator.kde.org/D24817 AFFECTED FILES src/CMakeLists.txt src/context/ContextView.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/com_trolltech_qt_core_init.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_Global.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAbstractAnimation.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAbstractItemModel.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAbstractListModel.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAbstractState.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAbstractTableModel.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAbstractTransition.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QAnimationGroup.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QBasicMutex.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QBasicTimer.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QBitArray.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QBuffer.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QByteArray.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QByteArrayMatcher.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QChildEvent.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QCoreApplication.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QCryptographicHash.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QDate.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QDateTime.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QDir.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QDirIterator.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QDynamicPropertyChangeEvent.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QEasingCurve.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QEvent.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QEventLoop.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QEventTransition.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFile.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFileDevice.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFileInfo.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFileSystemWatcher.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFinalState.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFuture.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFutureIterator.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFutureSynchronizer.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFutureSynchronizerVoid.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFutureVoid.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFutureWatcher.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QFutureWatcherVoid.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QHistoryState.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QIODevice.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QLibraryInfo.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QLocale.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QMargins.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QMimeData.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QModelIndex.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QMutex.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QObject.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QParallelAnimationGroup.cpp src/scripting/qtbindings/generated_cpp/com_trolltech_qt_core/qtscript_QPauseAnimation.cp
D24817: Restore scripting functionalities and Qt bindings.
nicolamori added a comment. 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. REPOSITORY R181 Amarok REVISION DETAIL https://phabricator.kde.org/D24817 To: nicolamori Cc: malteveerman, heikobecker, #amarok, amarok-devel
D24817: Restore scripting functionalities and Qt bindings.
nicolamori added a reviewer: amarok-devel. REPOSITORY R181 Amarok REVISION DETAIL https://phabricator.kde.org/D24817 To: nicolamori, amarok-devel Cc: malteveerman, heikobecker, #amarok, amarok-devel
D24817: Restore scripting functionalities and Qt bindings.
heikobecker requested changes to this revision. heikobecker added a comment. This revision now requires changes to proceed. 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. INLINE COMMENTS > CMakeLists.txt:1404 > +qtscript_xml > +DESTINATION lib/plugins/script) > + This breaks for people with lib{32,64,whatever} dirs, there's https://api.kde.org/ecm/kde-module/KDEInstallDirs.html to handle this properly. REPOSITORY R181 Amarok REVISION DETAIL https://phabricator.kde.org/D24817 To: nicolamori, amarok-devel, heikobecker Cc: malteveerman, heikobecker, #amarok, amarok-devel
D24817: Restore scripting functionalities and Qt bindings.
nicolamori added a comment. @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. REPOSITORY R181 Amarok REVISION DETAIL https://phabricator.kde.org/D24817 To: nicolamori, amarok-devel, heikobecker Cc: malteveerman, heikobecker, #amarok, amarok-devel
D24817: Restore scripting functionalities and Qt bindings.
Herald added a project: Amarok. Herald removed a subscriber: Amarok. REPOSITORY R181 Amarok REVISION DETAIL https://phabricator.kde.org/D24817 To: nicolamori, amarok-devel, heikobecker Cc: asturmlechner, malteveerman, heikobecker, amarok-devel, jfowkes, pgomes, nicolamori, jyasi, mfraser, ryanmccoskrie, semareit, eridani, eoinoneill, jackyalcine, nhuisman, paul, domson, yaohanchen, markey, James, tbettler, Smar, ricktimmis, schweingruber, #amarok