both: change the config file format to json

This allows to easily keep the config state in memory, thanks to the
QJson* classes, instead of completely rewriting the config file at every
save, so that we don't lose part of the configuration which are not
being used at the moment, such as the configuration for screens not
connected.