Pandora QT4: QSettings access in a PND?


hmc

Active Member
Joined
Dec 19, 2011
Messages
787
Location
Bavaria, Germany
Hi guys,


I have a problem with porting a QT4-based application to the Pandora.


The application uses QSettings for persisting its settings (see http://qt-project.org/doc/qt-4.8/qsettings.html ).


When started from the PND, the application does not persist its settings, or it does not restore its settings on subsequent launch.


I could not find a settings file in any of the places listed here under "Locations Where Application Settings Are Stored" (I looked in the real user's home, and in the appdata directory).


Are there any specific things I have to care about, so that QSettings works from inside a PND?


In case it's important: I use the cdevtools PND for onboard development.


The application I try to port is PortaBase.


Thanks,


Daniel
 
Try using .setPath() to force a location and see how that goes


Also, the link for setPath also shows default paths, might be worth checking
 
Thats a good question. i had the same problem for a little browser I ported some time ago. I worked around it by hardcoding the paths into the source instead of letting QtSettings handle it but it is annoying.
 
Try using .setPath() to force a location and see how that goes


Also, the link for setPath also shows default paths, might be worth checking

Thanks for the pointer to setPath().


I fear, usage of setPath() is beyond my abilities here, but I found another interesting thing:


"The default UserScope paths on Unix and Mac OS X ($HOME/.config or $HOME/Settings) can be overridden by the user by setting the XDG_CONFIG_HOME environment variable."


I will try this route now! Exporting XDG_CONFIG_HOME inside the run script of the PND shouldn't be too hard.


Daniel
 
okay, tried this.


If I use



Code:
# Make QSettings happy for storing preferences in appdata:

XDG_CONFIG_HOME=$HOME

export XDG_CONFIG_HOME

zenity --info --text="XDG_CONFIG_HOME exported as $XDG_CONFIG_HOME"


it behaves as before. No settings file is created, neither in appdata nor elsewhere.


However, when replacing $HOME with "$REAL_HOME", the application is able to persist its settings. However, the settings are then stored in


~/portabase/portabase.conf


which is not the desired way for the Pandora.


I don't know, why this doesn't work with $HOME, which is /mne/utmp/PortaBase, and when the app writes to there, the written file should be placed in the appdata directory.


Any idea?


Unless someone has another idea how to make that work, I'll go for the method saving settings in the real home.


Thanks!


Daniel
 
That is done by default in Sebt3's newer PXML templates btw. if you are using Yactfeau.
 
What exaclty?


Assigning $HOME or $REAL_HOME to XDG_CONFIG_HOME?


I don't use any cross compiler, I always develop and compile natively on the Pandora.


Where can I find that new template?


Daniel
 
Ah, I see:



Code:
export HOME="/mnt/utmp/$PND_NAME" XDG_CONFIG_HOME="/mnt/utmp/$PND_NAME"



Is this supposed to work?

Basically this should be the same as my trying



Code:
XDG_CONFIG_HOME=$HOME

export XDG_CONFIG_HOME


in the run script of my PND, or am I wrong?


And that did NOT work. At least not for portabase.


Daniel
 
As said, i think the QT Variables like QtCacheDir etc. won't honour those settings, so you would have to hardcode them, but I'd try with sebt3's implementation first.
 
sebt3,


reading your genpxml.sh script, it seems to me, that it requires the source, binary and other files laid out in a certain manner, before calling the script.


If I am right, can you please explain these preconditions shortly, or is this documented anywhere?


Thanks,


Daniel
 
okay, tried sebt3's implementation, meaning that I let his genpxml script generate the PXML.xml file for my PND and the start script.


Basically, it boils down to the start script containing



Code:
export XDG_CONFIG_HOME="/mnt/utmp/PortaBase"


and that does NOT work here. Portabase is not able to write its configuration settings to that directory. For whatever reason.


Any idea about a possible reason?


(EDIT: mcobit said: "As said, i think the QT Variables like QtCacheDir etc. won't honour those settings, so you would have to hardcode them," If I understand this correctly, this could be the possible reason?)


For now, I'll go the REAL_HOME route.


Thanks for your assitance.


Daniel
 
Last edited by a moderator:
genpxml does not realy requiere anything (beside the posix file tools), yet it will do a better guessing job if :


- PRJ is set to your PND name (can also be set using -n or --name)


- you're starting it from the root source package (can also be set using -s or --src)


- /mnt/utmp/$PRJ is the destination where the binaries live (might also be set using -d or --dest)
 
Back
Top