Added KDecorationFactory::checkRequirements(), which allows the decoration

plugin to check what the core supports, i.e. the opposite of supports().
Not used yet, but apparently will be needed e.g. for the new tranparency.

svn path=/trunk/kdebase/kwin/; revision=269291
This commit is contained in:
Luboš Luňák 2003-11-24 14:22:04 +00:00
parent 94a6fd94b5
commit 87f8a85083
9 changed files with 48 additions and 4 deletions

View file

@ -397,5 +397,10 @@ unsigned long KDecorationPreviewOptions::updateSettings()
changed |= d->updateKWinSettings( &cfg );
return changed;
}
bool KDecorationPreviewPlugins::provides( Requirement )
{
return false;
}
#include "preview.moc"

View file

@ -24,11 +24,11 @@
#include <qwidget.h>
#include <kdecoration_p.h>
#include <kdecoration_plugins_p.h>
class QLabel;
class KDecorationPreviewBridge;
class KDecorationPlugins;
class KDecorationOptions;
class KDecorationPreview
@ -117,5 +117,18 @@ class KDecorationPreviewOptions
virtual ~KDecorationPreviewOptions();
virtual unsigned long updateSettings();
};
class KDecorationPreviewPlugins
: public KDecorationPlugins
{
public:
KDecorationPreviewPlugins( KConfig* cfg );
virtual bool provides( Requirement );
};
inline KDecorationPreviewPlugins::KDecorationPreviewPlugins( KConfig* cfg )
: KDecorationPlugins( cfg )
{
}
#endif

View file

@ -125,8 +125,19 @@ public:
BorderOversized, ///< Oversized borders
BordersCount ///< @internal
};
enum Ability { ABILITY_DUMMY = 10000000 };
enum Requirement { REQUIREMENT_DUMMY = 1000000 };
};
class KDecorationProvides
: public KDecorationDefines
{
public:
virtual bool provides( Requirement req ) = 0;
};
/**
* This class holds various configuration settings for the decoration.
* It is accessible from the decorations either as KDecoration::options()

View file

@ -161,6 +161,7 @@ bool KDecorationPlugins::loadPlugin( QString nameStr )
return false;
}
fact = create_ptr();
fact->checkRequirements( this ); // let it check what is supported
pluginStr = nameStr;

View file

@ -34,13 +34,16 @@ DEALINGS IN THE SOFTWARE.
#include <qstring.h>
#include <qwidget.h>
#include "kdecoration.h"
class KLibrary;
class KConfig;
class KDecoration;
class KDecorationBridge;
class KDecorationFactory;
class KConfig;
class KDecorationPlugins
: public KDecorationProvides
{
public:
KDecorationPlugins( KConfig* cfg );

View file

@ -47,6 +47,10 @@ bool KDecorationFactory::supports( Ability )
return false;
}
void KDecorationFactory::checkRequirements( KDecorationProvides* )
{
}
QValueList< KDecorationDefines::BorderSize > KDecorationFactory::borderSizes() const
{
return QValueList< BorderSize >() << BorderNormal;

View file

@ -35,7 +35,6 @@ class KDecorationFactory
: public KDecorationDefines
{
public:
enum Ability { NOTHING_YET }; // FRAME pridat, + pamatovat na 32bitu?
/**
* Constructor. Called after loading the decoration plugin. All global
* initialization of the plugin should be done in the factory constructor.
@ -72,6 +71,8 @@ class KDecorationFactory
virtual QValueList< BorderSize > borderSizes() const;
virtual bool supports( Ability ability );
virtual void checkRequirements( KDecorationProvides* provides );
/**
* Returns the KDecorationOptions object, which is used to access
* configuration settings for the decoration.

View file

@ -34,4 +34,9 @@ void PluginMgr::error( const QString &error_msg )
exit(1);
}
bool PluginMgr::provides( Requirement )
{
return false;
}
} // namespace

View file

@ -22,6 +22,7 @@ class PluginMgr
{
public:
PluginMgr();
virtual bool provides( Requirement );
protected:
virtual void error( const QString& error_msg );
};