[Development] Start of a refactor of the QSettings class based on QJson

Tomaz Canabrava tcanabrava at kde.org
Thu Sep 25 21:33:12 CEST 2014


Long that that I have send this e-mail already, but better late than never.
In the Qt Develompent Summit I raised my hand to get one dirty thing done:

The Settings.

After a good while with negative time ( Real Work, KDE, Subsurface, and
other personal stuff ) I have finally had the time to start.

For now, I'v implemented two things:

Parsing from .ini to QJson
Saving from QJson to .ini

Why .ini instead of json, since I'm doing a conversion and I coul'd simply
store the json file?

.ini is better to humanreadability.
thiago asked me to do from ini to qjson

Issues:

After a Json tree is constructed, it's hard to modify it's contents:

QJsonObject rootConfig;
rootConfig.insert("group1", QJsonObject());
rootConfig.insert("group2", QJsonObject());

QJsonObject group1 = rootConfig.vaule("group1").toObject();
group1.insert("key1", 1);
rootConfig.insert("group1", group1);

since I need to take the value, modify it, insert it back nested groups are
a pain to use,
because I would have to chain the removal / addtion of the parent group
untill I hit the rootGroup.

what I plan to do, besides that:
- changed the config file from outside of the app, the app should reload
it's settings.
- compile-time check of typos in keys based on a schema ( and not runtime. )

Help is appreciated, and comments welcome.

the *temporary* repo with the *temporary and somewhat broken* code:
github.com:tcanabrava/QConfigNG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140925/6324b426/attachment.html>


More information about the Development mailing list