exporl / apex

APEX 4: software platform for auditory behavioural and psychophysical experiments. This repository follows the major releases of APEX.
http://kuleuven.be/exporl/apex/
Other
10 stars 1 forks source link

Add option to store settings in APEX folder #264

Open tomfrancart opened 5 years ago

tomfrancart commented 5 years ago

Currently, APEX settings such as calibration, or SPIN configurations are stored using QSettings. On Linux they go to a user-specific config-file and on windows they go to the registry. We'd like an option to store the settings in a file in the APEX installation folder instead (so they become system-wide instead of user-specific, and also specific to that particular APEX version on the system). Please add an option to apexconfig.xml to en/disable this behaviour.

The current use-case is to share profiles of the SPIN runner across users, the relevant code for that is in src/lib/apexspin/spinusersettingsdatabase.cpp Apart from that "git grep QSettings" might be helpful

See also http://doc.qt.io/qt-5/qsettings.html#Format-enum

linusdm commented 5 years ago

QSettings is flexible in the way it looks for a value and has built-in support for differentiating between user and system-wide settings (http://doc.qt.io/qt-5/qsettings.html#Scope-enum). Would it suffice to make the scope for the settings configurable (system-wide vs per-user)? This is an easy change. If the requirement is to have per-user versus per-application-installation settings, this requires more work, and will require that we save the settings in a file on windows installations, instead of in the registry.

tomfrancart commented 5 years ago

Not really: the problem is that for system wide settings, apex would need to run as administrator, and it quickly becomes a mess when you both have user specific and system wide settings. We already have this feature for calibration (cf the calibrationadmin tool, which allows to make a calibration setup system-wide). I therefore suggest to add a option to make settings apex-installation-specific (the user will then need write permission to the apex installation folder, perhaps keep in mind that we might add an option later on to set the settings path in apexconfig.xml). This will involve setting QSettings such that settings are saved to file, probably comes down to one call to a method of QSettings and some magic to get the paths right ;)