[prev in list] [next in list] [prev in thread] [next in thread] 

List:       amarok
Subject:    Script - writeConfig with QVariant
From:       El boulangero <elboulangero () gmail ! com>
Date:       2013-03-13 20:55:06
Message-ID: CALGUdm8MwLNPG=ajeJ1YUQo=9EpnHNpWiD_JRKRjUN8DB0Oz7w () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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 )

[Attachment #5 (text/html)]

Hello everyone,<br><br>I writing a scritp for Amarok at the moment, and I \
have a question regarding the Amarok.Script API.<br><br>I understand \
perfectly the config function with string argument, ie:<br><ul><li> String \
readConfig( String name, String defaultValue )  </li><li> void writeConfig( \
String name, String content )</li></ul><p>But I&#39;m curious about the two \
other ones, with QVariant argument:</p><ul><li> QVariant readConfig( String \
name, QVariant defaultValue )  </li><li> void writeConfig( String name, \
QVariant content ) </li></ul><p>At first, I thought that with these \
functions, I could put my script config in a JSON object, and save it in \
one call.</p><p>For example:</p><blockquote style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" \
class="gmail_quote"> <p>var defconfig = {<br>    &quot;time&quot;: {<br>    \
&quot;monday&quot;: {<br>            &quot;enabled&quot;: \
&quot;true&quot;,<br>            &quot;value&quot;: \
&quot;08:00:00&quot;<br>        }<br>    }<br>};</p> \
<p>Amarok.Script.writeConfig(&quot;&quot;, \
defconfig);<br></p></blockquote><div><br>But if I try that, I get the \
following error: <style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex" class="gmail_quote"><p \
style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Script \
error reported by: Good Morning TypeError: ambiguous call of overloaded \
function writeConfig(); candidates were writeConfig(QString,QVariant) \
writeConfig(QString,QString)</p> </blockquote></div><p>Is there something \
else I should do in order to use these functions ? Or maybe I&#39;m \
completely wrong, these functions are not suppose to be used with JSON \
objects ?</p><p>Thanks for your lights on this subject !</p> \
<p><br></p><p>Best Regards,</p><p>Arnaud<br></p><p><br></p><p><br></p><p>QVariant \
readConfig( String name, QVariant defaultValue )  </p><br>



_______________________________________________
Amarok mailing list
Amarok@kde.org
https://mail.kde.org/mailman/listinfo/amarok


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic