Script - writeConfig with QVariant

El boulangero elboulangero at gmail.com
Thu Mar 14 07:25:39 UTC 2013


Hello everyone,

I writing a scritp for Amarok at the moment, and I have a question
regarding the Amarok.Script API.

I understand perfectly the config function with string argument, ie:
+ String readConfig( String name, String defaultValue )
+ void writeConfig( String name, String content )

But I'm curious about the two other ones, with QVariant argument:
+ QVariant readConfig( String name, QVariant defaultValue )
+ void writeConfig( String name, QVariant content )

At first, I thought that with these functions, I could put my script
config in a JSON object, and save it in one call.

For example:
>
> var defconfig = {
>     "time": {
>         "monday": {
>             "enabled": "true",
>             "value": "08:00:00"
>         }
>     }
> };
>
> Amarok.Script.writeConfig("", defconfig);


But if I try that, I get the following error:
>
> Script error reported by: Good Morning TypeError: ambiguous call of overloaded function writeConfig(); candidates were writeConfig(QString,QVariant) writeConfig(QString,QString)

Is there something else I should do in order to use these functions ?
Or maybe I'm completely wrong, these functions are not suppose to be
used with JSON objects ?

Thanks for your lights on this subject !


Best Regards,

Arnaud


More information about the Amarok-devel mailing list