Script - writeConfig with QVariant

El boulangero elboulangero at gmail.com
Wed Mar 13 20:55:06 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



QVariant readConfig( String name, QVariant defaultValue )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/amarok/attachments/20130313/d0a6e862/attachment.html>


More information about the Amarok mailing list