[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: kdelibs/kstyles/kthemestyle
From:       Maks Orlovich <mo002j () mail ! rochester ! edu>
Date:       2002-02-21 15:16:28
[Download RAW message or body]

On Thursday 21 February 2002 07:03 am, Stephan Kulow wrote:
> On Mittwoch, 20. Februar 2002 23:59, Maks Orlovich wrote:
> > On Wednesday 20 February 2002 04:24 pm, Stephan Kulow wrote:
> > > kdelibs/kstyles/kthemestyle kstyledirs.cpp,1.5,1.6 kstyledirs.h,1.5,1.6
> > > kthemebase.cpp,1.9,1.10 kthemestyle.cpp,1.15,1.16 Author: coolo
> > > Wed Feb 20 22:24:07 CET 2002
> > > In directory office:/tmp/cvs-serv26005/kthemestyle
> > >
> > >
> > > Modified Files:
> > >          kstyledirs.cpp kstyledirs.h kthemebase.cpp kthemestyle.cpp
> > > Log Message:
> > > having two KStandardDirs objects in the same process that only differ
> > > in two additional resource types is wasted memory - for every KDE app
> > > So better use the same KGlobal::dirs() for styles
> >
> > That change is incorrect, as the style might be loaded by a Qt-only
> > application; in that case one would get a lovely:
> >
> > Fatal error: you need to have a KInstance object before
> > you do anything that requires it! Examples of this are config
> > objects, standard directories or translations.
>
> Then create one in Qt-only applications. KInstances are very small objects
> - compared to KStandardDirs objects that you create for _all_ style using
> applications.
>
> I don't understand why you add such an overhead to the usual case to avoid
> to create a KInstance in the rather unusual case.
>
> Greetings, Stephan

I am not sure that creating an extra KInstance is the way to go; it will 
certainly make more of KDE's API acessible, and using KSimpleConfig over 
QSettings would be a nice bonus for me [Qsettings is quite a pain], but I am 
afraid of what happens in case of some misdetection -- having two KInstance's 
sounds nasty..

Anyway, how would I detect the qt-only case? Is testing kapp == 0 safe? 
Please note that right now the plugin may be created as early as the 
QApplication ctor (this will be likely be changed in Qt soon to fix the 
stylepath bug, though), so I might not be able to detect kapp being set to 
non-null properly anyway. Although I suppose if I create an extra 
KStandardDirs instance only sometime with KApplication present and not all 
the time, it will still be an improvement. 

Also, how much memory does KStandardDirs use anyway?

P.S. Sorry if the cc is extraneous, but this is an important issue for me, 
and I would rather not have this get lost in the large stream of kde-cvs 
messages. Your advice here is very much appreciated. 

Thanks,
Maks Olrovich
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic