From 87f8a850831ff4916967261928a824c9ab190031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Mon, 24 Nov 2003 14:22:04 +0000 Subject: [PATCH] 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 --- kcmkwin/kwindecoration/preview.cpp | 5 +++++ kcmkwin/kwindecoration/preview.h | 17 +++++++++++++++-- lib/kdecoration.h | 11 +++++++++++ lib/kdecoration_plugins_p.cpp | 1 + lib/kdecoration_plugins_p.h | 5 ++++- lib/kdecorationfactory.cpp | 4 ++++ lib/kdecorationfactory.h | 3 ++- plugins.cpp | 5 +++++ plugins.h | 1 + 9 files changed, 48 insertions(+), 4 deletions(-) diff --git a/kcmkwin/kwindecoration/preview.cpp b/kcmkwin/kwindecoration/preview.cpp index 8e80ea2992..6e26aedb92 100644 --- a/kcmkwin/kwindecoration/preview.cpp +++ b/kcmkwin/kwindecoration/preview.cpp @@ -397,5 +397,10 @@ unsigned long KDecorationPreviewOptions::updateSettings() changed |= d->updateKWinSettings( &cfg ); return changed; } + +bool KDecorationPreviewPlugins::provides( Requirement ) + { + return false; + } #include "preview.moc" diff --git a/kcmkwin/kwindecoration/preview.h b/kcmkwin/kwindecoration/preview.h index c63770eb3f..13e1483cbf 100644 --- a/kcmkwin/kwindecoration/preview.h +++ b/kcmkwin/kwindecoration/preview.h @@ -24,11 +24,11 @@ #include #include +#include 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 diff --git a/lib/kdecoration.h b/lib/kdecoration.h index 4a2f79931e..b75d72465d 100644 --- a/lib/kdecoration.h +++ b/lib/kdecoration.h @@ -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() diff --git a/lib/kdecoration_plugins_p.cpp b/lib/kdecoration_plugins_p.cpp index 3f9341269e..975aa388ab 100644 --- a/lib/kdecoration_plugins_p.cpp +++ b/lib/kdecoration_plugins_p.cpp @@ -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; diff --git a/lib/kdecoration_plugins_p.h b/lib/kdecoration_plugins_p.h index e283071aa0..36206fdfe6 100644 --- a/lib/kdecoration_plugins_p.h +++ b/lib/kdecoration_plugins_p.h @@ -34,13 +34,16 @@ DEALINGS IN THE SOFTWARE. #include #include +#include "kdecoration.h" + class KLibrary; +class KConfig; class KDecoration; class KDecorationBridge; class KDecorationFactory; -class KConfig; class KDecorationPlugins + : public KDecorationProvides { public: KDecorationPlugins( KConfig* cfg ); diff --git a/lib/kdecorationfactory.cpp b/lib/kdecorationfactory.cpp index 38cf41ba01..74508501b1 100644 --- a/lib/kdecorationfactory.cpp +++ b/lib/kdecorationfactory.cpp @@ -47,6 +47,10 @@ bool KDecorationFactory::supports( Ability ) return false; } +void KDecorationFactory::checkRequirements( KDecorationProvides* ) + { + } + QValueList< KDecorationDefines::BorderSize > KDecorationFactory::borderSizes() const { return QValueList< BorderSize >() << BorderNormal; diff --git a/lib/kdecorationfactory.h b/lib/kdecorationfactory.h index f55f3058f2..093f8fe34b 100644 --- a/lib/kdecorationfactory.h +++ b/lib/kdecorationfactory.h @@ -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. diff --git a/plugins.cpp b/plugins.cpp index fe88774107..5ab58e75da 100644 --- a/plugins.cpp +++ b/plugins.cpp @@ -34,4 +34,9 @@ void PluginMgr::error( const QString &error_msg ) exit(1); } +bool PluginMgr::provides( Requirement ) + { + return false; + } + } // namespace diff --git a/plugins.h b/plugins.h index fc6c200459..7e779098c6 100644 --- a/plugins.h +++ b/plugins.h @@ -22,6 +22,7 @@ class PluginMgr { public: PluginMgr(); + virtual bool provides( Requirement ); protected: virtual void error( const QString& error_msg ); };