On Thu, Sep 25, 2014 at 6:51 PM, Jeremy <[email protected]> wrote:
> > On 5September2014, at 12:33, Tomaz Canabrava <[email protected]> wrote: > > > 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. > > > > The general idea appeals to me. > > > > 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 > > > Binary compatibility requires that QSettings for 5.x continue to handle > .ini files for all existing functions. Adding json for 5.5 should be fine. > I think we are talking different things here. the settings would continue to be in .ini format, the json would be used as binary -cache ( disk and memory ). > > > > > > 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. > > > > QJsonDocument doc = QJsonDocument::fromJson("{ \"name\": \"object\"}"); > QJsonObject obj = doc.object(); > QJsonValueRef ref = obj["name”]; > ref = "object2”; > doc.setObject(obj); > QJsonObject obj = doc.object(); QJsonValueRef ref = obj["group1"]; QJsonObject groupObject = ref.toObject(); // <- lost reference. QJsonValueRef ref2 = groupObject["group2]; QJsonObject groupObject2 = ref2.toObject(); << - again, lost reference. groupObject2.add("key", object2); and that's the issue. > > > > what I plan to do, besides that: > > - changed the config file from outside of the app, the app should reload > it's settings. > > > What’s the intended change detection mechanism? If it’s a file change, > there’s the issue of incomplete updates to handle. I suppose it could > ignore anything other than an valid JSON, empty files, and deleted files > under the theory that edits of a single entry are less likely to produce > valid interim results. > It will be a .ini file, so invalid json is a non issue, the others are, but first I need to find a way to work around the other issue that I described. > Will changes be announced at the document level, or more fine grained? I > think anything beyond the document level is asking for trouble. > Document level. > > > - 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 > > > > >
_______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
