← Back to team overview

ubuntu-phone team mailing list archive

Re: Preferred Settings API for Ubuntu apps

 

Hi Karni,

Yes the decision has been made. Check out
https://lists.launchpad.net/ubuntu-phone/msg09350.html for more details.

Cheers,
Nekhelesh


On Thu, Aug 7, 2014 at 1:40 PM, Michal Karnicki <
michal.karnicki@xxxxxxxxxxxxx> wrote:

> Hi guys,
>
> Have there been any decisions/activity in the subject? We currently use
> Qt.labs.settings in one of the apps and sadly need to install the qml
> package each time we flash the device.
>
> Thanks,
> karni
>
>
> On Fri, Aug 1, 2014 at 10:55 AM, Christian Dywan <
> christian.dywan@xxxxxxxxxxxxx> wrote:
>
>> On 31.07.2014 19:45, Sam Bull wrote:
>> > On ĵaŭ, 2014-07-31 at 17:44 +0200, Christian Dywan wrote:
>> >> From my point of view once you start dealing with objects you'll want
>> >> U1db* and for instance save your object as a document.
>> >>
>> >> Do you have a specific example?
>> > My app is a dictionary, and it contains translations for many languages.
>> > I want to only display relevant languages to the user. For this, I use
>> > an Object as a simple key/value store, with the key being the language
>> > and the value a boolean as to whether it should be shown or not.
>> >
>> > I'd prefer the keys to not be hardcoded, as I load all the data
>> > (including the list of languages) from downloaded data, so if a new
>> > language were to be added to the list, then the app would check at the
>> > beginning and see it missing from the saved Object and add a value for
>> > it.
>> >
>> > Essentially, all I want is a simple Python dictionary.
>> >
>> > Although, having just explained all this, I've just realised a possibly
>> > better solution would be to simply store an array of enabled languages,
>> > and check if a language is in the array. Though, this would still be
>> > better if the values were hashed, are there sets in Javascript, and
>> > could they be saved?
>> You can do [ "en", "fr" ] or { "en": "English", "fr": "French" } however
>> they are object types in Javascript thus not allowed as settings values.
>>
>>
>> QSettings has support for arrays in the C++ API
>> http://qt-project.org/doc/qt-4.8/qsettings.html#beginWriteArray
>>
>> It should be possible to extend the backend so that it detects arrays
>> and stores them as such.
>>
>>
>>
>> As a short-term solution you could use a string instead like "en,fr".
>>
>> ciao,
>>     Christian
>>
>>
>> --
>> Mailing list: https://launchpad.net/~ubuntu-phone
>> Post to     : ubuntu-phone@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~ubuntu-phone
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
>
> --
> Software Engineer
> Professional and Engineering Services
> Canonical Ltd.
>
> Ubuntu - Linux for human beings | www.ubuntu.com
>
> --
> Mailing list: https://launchpad.net/~ubuntu-phone
> Post to     : ubuntu-phone@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ubuntu-phone
> More help   : https://help.launchpad.net/ListHelp
>
>

References