code cleanup: moved singletons from oxigenclient.cpp to oxygen.cpp; added relevant prototypes to oxygen.h and removed from .cpp files

svn path=/trunk/KDE/kdebase/workspace/; revision=1028170
icc-effect-5.14.5
Hugo Pereira Da Costa 2009-09-26 04:23:27 +00:00
parent 01e5f22553
commit 4e0f2a4d08
4 changed files with 34 additions and 30 deletions

View File

@ -28,10 +28,12 @@
#include "oxygen.moc"
#include "oxygenclient.h"
#include "oxygenshadowcache.h"
#include "lib/helper.h"
#include <cassert>
#include <KDebug>
#include <KConfigGroup>
#include <KDebug>
#include <KGlobal>
#include <KWindowInfo>
#include <kdeversion.h>
@ -44,9 +46,22 @@ extern "C"
namespace Oxygen
{
// referenced from definition in Oxygendclient.cpp
OxygenHelper *oxygenHelper();
OxygenShadowCache *oxygenShadowCache();
K_GLOBAL_STATIC_WITH_ARGS(OxygenHelper, globalHelper, ("oxygenDeco"))
K_GLOBAL_STATIC_WITH_ARGS(OxygenShadowCache, globalShadowCache, (maxAnimationIndex))
//___________________________________________
OxygenHelper *oxygenHelper()
{
OxygenHelper *helper = globalHelper;
return helper;
}
//___________________________________________
OxygenShadowCache *oxygenShadowCache()
{
OxygenShadowCache* cache = globalShadowCache;
return cache;
}
// initialize static members
bool OxygenFactory::initialized_ = false;

View File

@ -34,13 +34,19 @@
#include "oxygenconfiguration.h"
#include "oxygenexceptionlist.h"
// TODO:
// should review implementation not to use static objects
class OxygenHelper;
namespace Oxygen
{
class OxygenClient;
class OxygenShadowCache;
//! helper singleton
OxygenHelper* oxygenHelper();
//! shadow cache singleton
OxygenShadowCache* oxygenShadowCache();
//! buttons
enum ButtonType
@ -57,6 +63,9 @@ namespace Oxygen
ButtonTypeCount
};
//! maximum index/frame used for animations
static const int maxAnimationIndex = 256;
/*
If non zero, this possibly allow one to have an additional space
around window that is clickable although it is part of the shadow

View File

@ -49,30 +49,12 @@
namespace Oxygen
{
const int maxAnimationIndex( 256 );
K_GLOBAL_STATIC_WITH_ARGS(OxygenHelper, globalHelper, ("oxygenDeco"))
K_GLOBAL_STATIC_WITH_ARGS(OxygenShadowCache, globalShadowCache, (maxAnimationIndex))
//___________________________________________
OxygenHelper *oxygenHelper()
{
OxygenHelper *helper = globalHelper;
return helper;
}
//___________________________________________
OxygenShadowCache *oxygenShadowCache()
{
OxygenShadowCache* cache = globalShadowCache;
return cache;
}
//___________________________________________
static void oxkwincleanupBefore()
{
globalHelper->invalidateCaches();
globalShadowCache->invalidateCaches();
oxygenHelper()->invalidateCaches();
oxygenShadowCache()->invalidateCaches();
}
@ -88,7 +70,7 @@ namespace Oxygen
colorCacheInvalid_(true),
sizeGrip_( 0 ),
timeLine_( 200, this ),
helper_(*globalHelper),
helper_(*oxygenHelper()),
initialized_( false )
{ qAddPostRoutine(oxkwincleanupBefore); }

View File

@ -26,6 +26,7 @@
#include "oxygenshadowcache.h"
#include "oxygenclient.h"
#include "oxygen.h"
#include <cassert>
#include <KColorUtils>
@ -35,9 +36,6 @@
namespace Oxygen
{
// referenced from definition in Oxygendclient.cpp
OxygenHelper *oxygenHelper();
//_______________________________________________________
OxygenShadowCache::OxygenShadowCache( int maxIndex ):
maxIndex_( maxIndex ),