[Development] QSettings refactor updates

Milian Wolff milian.wolff at kdab.com
Sat Oct 11 16:44:51 CEST 2014


On Friday 10 October 2014 21:26:11 Tomaz Canabrava wrote:
> On Fri, Oct 10, 2014 at 6:35 AM, Milian Wolff <milian.wolff at kdab.com> wrote:
> > On Friday 10 October 2014 06:22:12 Tomaz Canabrava wrote:
> > > Em 10/10/2014 06:18, "Oswald Buddenhagen" <
> > > 
> > > oswald.buddenhagen at theqtcompany.com> escreveu:
> > > > On Fri, Oct 10, 2014 at 11:07:52AM +0200, Milian Wolff wrote:
> > > > > may I ask why you don't simply copy KConfig? It's API design has
> > > > > proven to be extremely versatile and efficient over the years.
> > > > 
> > > > actually, it has proven horrible and is slated for a rewrite for a
> > > > decade. the only thing it does right is what tomaz copied to his api.
> > > 
> > > (still sleeping, só I will write better latter)  I used kconfig and I
> > > tougth it was terrible to use, that why I came to thiago and hélio
> > > Castro
> > > asking if I could try a new one.
> > > 
> > > I'll read the emails on this thread and change the code accordingly.
> > 
> > Please double-check the KConfig API and copy more of its behavior. Some of
> > that stuff was also mentioned by Thiago, Bo and Kai:
> > 
> > QConfig("identifier_or_filename"); // this should also be the root group
> > 
> > config.setValue("bla", 123); // would set a global config value, with
> > multiple
> > overloads or template functions
> > 
> > QConfigGroup group = config.group("something"); // smart handle with
> > reference
> > semantics
> > group.readValue("blub", /* default value */); // read value in group, also
> > overloads and/or template function
> > 
> > foreach (QConfigGroup subGroup, group.groups()) // or similar
> > 
> >    qDebug() << subGroup.name();
> > 
> > I still think that KConfig, API-wise, is extremely convenient and haven't
> > seen
> > anything better so far. The internals and performance is a bit lacking,
> > but
> > usually not a problem and definitely not related to the API.
> 
> It's too error prone regarding typos.
> 
> // main.cpp
> 
> KConfig c;
> KConfigGroup g = c.group("blah");
> g.setValue("width", 10);
> 
> //  otherfile
> Kconfig c;
> KConfigGroup g = c.group("blah");
> g.value("widht"); // <- no error is issued, this is something that I wanna
> have it fixed.

How do you intend to fix it? Esp. when looking at what Rafael proposes? If you 
declare any other class to be used instead of a string, the user can still mix 
two variables up.

I don't see what that has to do with KConfig/QConfig, really.

Bye
-- 
Milian Wolff | milian.wolff at kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions



More information about the Development mailing list