Re: [SailfishDevel] ConfigurationValue default path

2018-05-21 Thread Slava Monich
A nice thing about dconf is that your app is notified when settings are 
changed by another process, e.g. the settings app.


Settings applets are not allowed in harbour though :)

Cheers,
-Slava


Ok, got it working, thank you.

But since I want this to be as portable as possible (I manage to make 
one repo for sailfish and android), I would rather use Settings 
from Qt.labs.settings 1.0, wich doenst seem to be available in sailfish.


I'm thinking on creating a class based on QSettings and export it to 
qml. Or do you guys have any other aproach/sugestion ?


Thanks
João
Em segunda-feira, 21 de maio de 2018 08:07:46 GMT+1, Pekka Vuorela 
 escreveu:



On Mon, 2018-05-21 at 04:45 +, joao morgado via Devel wrote:
> Hi Martin
>
> Thanks for your replay.
> I did a very small example, trying to save a rectangle color, but if
> fails. When starting, it's always red. Am I missing something ?
>
>
>    ConfigurationValue {
>        id: mysettings
>        property alias saveColor: mycolor.color
>        property alias mystring: page.hello
>        //property color saveColor: "red"
>    }
>

You should have a key there to indicate what configuration value should
be accessed. And value is referenced with 'value' property.


ConfigurationValue {
    id: mysettings

    key: "/path/in/the/dconf/hierarchy/some_option"
}

Component.onCompleted: console.log("Value: ", mysettings.value)




___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] ConfigurationValue default path

2018-05-21 Thread joao morgado via Devel
 Ok, got it working, thank you.
But since I want this to be as portable as possible (I manage to make one repo 
for sailfish and android), I would rather use Settings from Qt.labs.settings 
1.0, wich doenst seem to be available in sailfish. 
I'm thinking on creating a class based on QSettings and export it to qml. Or do 
you guys have any other aproach/sugestion ?
ThanksJoãoEm segunda-feira, 21 de maio de 2018 08:07:46 GMT+1, Pekka 
Vuorela  escreveu:  
 
 On Mon, 2018-05-21 at 04:45 +, joao morgado via Devel wrote:
> Hi Martin
> 
> Thanks for your replay. 
> I did a very small example, trying to save a rectangle color, but if
> fails. When starting, it's always red. Am I missing something ?
> 
>    
>    ConfigurationValue {
>        id: mysettings
>        property alias saveColor: mycolor.color
>        property alias mystring: page.hello
>        //property color saveColor: "red"
>    }
> 

You should have a key there to indicate what configuration value should
be accessed. And value is referenced with 'value' property.

ConfigurationValue {
    id: mysettings
    key: "/path/in/the/dconf/hierarchy/some_option" 
}

Component.onCompleted: console.log("Value: ", mysettings.value)

  ___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] ConfigurationValue default path

2018-05-21 Thread Pekka Vuorela
On Mon, 2018-05-21 at 04:45 +, joao morgado via Devel wrote:
> Hi Martin
> 
> Thanks for your replay. 
> I did a very small example, trying to save a rectangle color, but if
> fails. When starting, it's always red. Am I missing something ?
> 
> 
> ConfigurationValue {
> id: mysettings
> property alias saveColor: mycolor.color
> property alias mystring: page.hello
> //property color saveColor: "red"
> }
> 

You should have a key there to indicate what configuration value should
be accessed. And value is referenced with 'value' property.

ConfigurationValue {
id: mysettings
key: "/path/in/the/dconf/hierarchy/some_option" 
}

Component.onCompleted: console.log("Value: ", mysettings.value)

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] ConfigurationValue default path

2018-05-20 Thread Martin Kampas
Hi João,

I think you need ConfigurationGroup instead of ConfigurationValue if you want 
to use it this way, and I am unsure that it is supposed to work with alias 
properties.

BR,
Martin


From: Devel [devel-boun...@lists.sailfishos.org] on behalf of joao morgado via 
Devel [devel@lists.sailfishos.org]
Sent: Monday, May 21, 2018 6:45 AM
To: Sailfish OS Developers
Subject: Re: [SailfishDevel] ConfigurationValue default path

Hi Martin

Thanks for your replay.
I did a very small example, trying to save a rectangle color, but if fails. 
When starting, it's always red. Am I missing something ?



Rectangle {

id: mycolor

color: "red"

//color: mysettings.saveColor

anchors.fill: parent


MouseArea {

anchors.fill: parent

onClicked: {

mycolor.color = Qt.colorEqual(mycolor.color, "red") ? "blue" : 
"red"

hello === "I'm red" ? hello = "I'm blue" : hello = "I'm red"

}


}

Text {

text: hello

}

}


property string hello: "I'm red"



ConfigurationValue {

id: mysettings

property alias saveColor: mycolor.color

property alias mystring: page.hello

//property color saveColor: "red"

}


/*Component.onCompleted: console.log("initial color: "+mysettings.saveColor)

Component.onDestruction: {

mysettings.saveColor = mycolor.color

console.log("destruction color: "+mysettings.saveColor)

}*/


Cheers
João


Em sexta-feira, 18 de maio de 2018 06:04:27 GMT+1, Martin Kampas 
 escreveu:


Hi João,

The storage backend is dconf https://wiki.gnome.org/Projects/dconf

BR,
Martin


From: Devel [devel-boun...@lists.sailfishos.org] on behalf of joao morgado via 
Devel [devel@lists.sailfishos.org]
Sent: Friday, May 18, 2018 6:54 AM
To: devel@lists.sailfishos.org
Subject: [SailfishDevel] ConfigurationValue default path

Hi

Where does ConfigurationValue saves the data ? I didnt find nothing in 
"/home/nemo/.config" related to my app.
In desktop and android  I sucessfully used the equivalent qml Settings to save 
my stuff, but in sailfish nothing is being saved using ConfigurationValue.

Cheers
João



___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] ConfigurationValue default path

2018-05-20 Thread joao morgado via Devel
 Hi Martin
Thanks for your replay. I did a very small example, trying to save a rectangle 
color, but if fails. When starting, it's always red. Am I missing something ?

Rectangle {id: mycolorcolor: "red"//color: 
mysettings.saveColoranchors.fill: parent
MouseArea {anchors.fill: parentonClicked: { 
   mycolor.color = Qt.colorEqual(mycolor.color, "red") ? "blue" : "red" 
   hello === "I'm red" ? hello = "I'm blue" : hello = "I'm red" 
   }
}Text {text: hello}}
property string hello: "I'm red"ConfigurationValue {id: 
mysettingsproperty alias saveColor: mycolor.colorproperty alias 
mystring: page.hello//property color saveColor: "red"}
/*Component.onCompleted: console.log("initial color: 
"+mysettings.saveColor)Component.onDestruction: {
mysettings.saveColor = mycolor.colorconsole.log("destruction color: 
"+mysettings.saveColor)}*/

CheersJoão

Em sexta-feira, 18 de maio de 2018 06:04:27 GMT+1, Martin Kampas 
 escreveu:  
 
 #yiv4199055280 P {margin-top:0;margin-bottom:0;}Hi João,

The storage backend is dconf https://wiki.gnome.org/Projects/dconf

BR,
Martin

From: Devel [devel-boun...@lists.sailfishos.org] on behalf of joao morgado via 
Devel [devel@lists.sailfishos.org]
Sent: Friday, May 18, 2018 6:54 AM
To: devel@lists.sailfishos.org
Subject: [SailfishDevel] ConfigurationValue default path

Hi 
Where does ConfigurationValue saves the data ? I didnt find nothing in 
"/home/nemo/.config" related to my app.In desktop and android  I sucessfully 
used the equivalent qml Settings to save my stuff, but in sailfish nothing is 
being saved using ConfigurationValue.

CheersJoão


  ___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] ConfigurationValue default path

2018-05-17 Thread Martin Kampas
Hi João,

The storage backend is dconf https://wiki.gnome.org/Projects/dconf

BR,
Martin


From: Devel [devel-boun...@lists.sailfishos.org] on behalf of joao morgado via 
Devel [devel@lists.sailfishos.org]
Sent: Friday, May 18, 2018 6:54 AM
To: devel@lists.sailfishos.org
Subject: [SailfishDevel] ConfigurationValue default path

Hi

Where does ConfigurationValue saves the data ? I didnt find nothing in 
"/home/nemo/.config" related to my app.
In desktop and android  I sucessfully used the equivalent qml Settings to save 
my stuff, but in sailfish nothing is being saved using ConfigurationValue.

Cheers
João



___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

[SailfishDevel] ConfigurationValue default path

2018-05-17 Thread joao morgado via Devel
Hi 
 Where does ConfigurationValue saves the data ? I didnt find nothing in 
"/home/nemo/.config" related to my app.In desktop and android  I sucessfully 
used the equivalent qml Settings to save my stuff, but in sailfish nothing is 
being saved using ConfigurationValue.

CheersJoão


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org