Port ki18n from QtScript to QtQml
ClosedPublic

Authored by carewolf on Aug 1 2017, 12:56 PM.

Details

Summary

Moves away from the deprecated QtScript module

Diff Detail

Repository
R252 Framework Integration
Lint
Lint Skipped
Unit
Unit Tests Skipped
carewolf created this revision.Aug 1 2017, 12:56 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptAug 1 2017, 12:56 PM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
kfunk added a subscriber: kfunk.Aug 28 2017, 8:37 AM

Just wanted to add this: Really great work! -- I wanted to raise this issue earlier on the KF5 mailing list: ki18n was the last major framework that depended on the deprecated QtScript. Nice to see it being ported! <3

Can't really review this code either, though. I don't now enough about the QtScript/QtQML differences.

ltoscano changed the repository for this revision from R252 Framework Integration to R249 KI18n.Aug 28 2017, 7:46 PM
ltoscano added a subscriber: ltoscano.

@ilic, the repository was set incorrectly but it's really for KI18n.

The changes to from QScriptValue to QJSValue look quite good (similar to the ones done in KTextEditor). I cannot really comment on the FIXMEs you have added, though.

kfunk added a comment.Sep 6 2017, 7:49 AM

Could someone fluent in QtScript/QtQML review this so we can merge it?

src/ktranscript.cpp
96

Consistency: Use const QString &

ilic edited edge metadata.Sep 6 2017, 7:59 AM

I can't say about QtScript to QtQML conversion, but wrt. those FIXMEs, removing variable argument lists obviously breaks compatibility, and especially the acall function makes no sense without it.

@carewolf, have you had a chance to work on this? It would be a shame for such a lovely patch to fall by the wayside. :)

No, but I will see if I can find some. Otherwise feel free to take over an fix the remaining issues.

huftis added a subscriber: huftis.Jun 15 2018, 5:41 PM
Restricted Application edited subscribers, added: kde-frameworks-devel; removed: Frameworks. · View Herald TranscriptJun 15 2018, 5:41 PM
carewolf updated this revision to Diff 39460.Aug 11 2018, 3:21 PM

Updated and ensured autotests passes.

Note the latest patch still has a maximum number of arguments for acall. I checked all the usages, and the only place that uses acall with a variable set of arguments is the sr (Serbian) translation. Since supporting a variable number of arguments would require changes to QtDeclarative and thus mean we would need to support both models until KDE depends on Qt 5.13, perhaps it would be easier to just rewrite the serbian translations apply_to_word function?

I solved the Ts.acall. Unfortunately I forgot how arc works, so it became a new entry https://phabricator.kde.org/D14769

carewolf updated this revision to Diff 39526.Aug 12 2018, 2:53 PM

Fixed acall using a pure javascript bridge

dfaure added a subscriber: dfaure.Aug 13 2018, 1:13 PM

+1, looks good to me (but I'm no QJSEngine expert)

dhaumann accepted this revision.Aug 13 2018, 4:56 PM

I guess it's better to accept this now than later to have a longer testing period at Akademy and until the frameworks release.

This revision is now accepted and ready to land.Aug 13 2018, 4:56 PM
This revision was automatically updated to reflect the committed changes.