Oxygen: avoid calls to reparseConfiguration() on startup.

strace -e open kate |& grep -v NOENT | grep oxygenrc | wc -l
  went from 8 to 4
  (and when looking for kdeglobals, from 13 to 11)

There's still a lot of work to be done in that area...
(within KConfigSkeleton, and probably kdeplatformtheme)

REVIEW: 115964
This commit is contained in:
David Faure 2014-02-23 11:21:19 +01:00
parent c130db39f2
commit 022304c0db
5 changed files with 14 additions and 12 deletions

View file

@ -39,7 +39,7 @@ namespace Oxygen
//_________________________________________________________
ShadowDemoDialog::ShadowDemoDialog( QWidget* parent ):
QDialog( parent ),
_helper(),
_helper( KSharedConfig::openConfig("oxygenrc") ),
_cache( _helper )
{

View file

@ -30,8 +30,8 @@ namespace Oxygen
{
//______________________________________________________________________________
DecoHelper::DecoHelper():
Helper()
DecoHelper::DecoHelper(KSharedConfigPtr config):
Helper(config)
{}
//______________________________________________________________________________

View file

@ -23,6 +23,7 @@
*/
#include "oxygenhelper.h"
#include <ksharedconfig.h>
//! helper class
/*! contains utility functions used at multiple places in oxygen style */
@ -35,7 +36,7 @@ namespace Oxygen
public:
//! constructor
explicit DecoHelper();
explicit DecoHelper(KSharedConfigPtr config);
//! destructor
virtual ~DecoHelper()

View file

@ -43,7 +43,8 @@ namespace Oxygen
Factory::Factory(QObject *parent):
KDecorationFactory(parent),
_initialized( false ),
_helper(),
_config( KSharedConfig::openConfig( QStringLiteral("oxygenrc") ) ),
_helper( _config ),
_shadowCache( _helper )
{
readConfig();
@ -71,26 +72,23 @@ namespace Oxygen
//___________________________________________________
void Factory::readConfig()
{
/*
always reload helper
this is needed to properly handle
color contrast settings changed
*/
_config->reparseConfiguration(); // could be skipped on startup
helper().invalidateCaches();
helper().reloadConfig();
helper().loadConfig();
// initialize default configuration and read
if( !_defaultConfiguration ) _defaultConfiguration = ConfigurationPtr(new Configuration());
_defaultConfiguration->setCurrentGroup( QStringLiteral("Windeco") );
_defaultConfiguration->readConfig();
// create a config object
KSharedConfig::Ptr config( KSharedConfig::openConfig( QStringLiteral("oxygenrc") ) );
// clear exceptions and read
ExceptionList exceptions;
exceptions.readConfig( config );
exceptions.readConfig( _config );
_exceptions = exceptions.get();
// read shadowCache configuration
@ -99,7 +97,7 @@ namespace Oxygen
// background pixmap
{
KConfigGroup group( config->group("Common") );
KConfigGroup group( _config->group("Common") );
helper().setBackgroundPixmap( group.readEntry( "BackgroundPixmap", "" ) );
}

View file

@ -129,6 +129,9 @@ namespace Oxygen
//! list of exceptiosn
QList<ConfigurationPtr> _exceptions;
//! config object
KSharedConfigPtr _config;
};
}