From 4ff6a3352645396f7d26665de25e4b08af51fe4d Mon Sep 17 00:00:00 2001 From: Bernhard Loos Date: Thu, 20 Sep 2007 17:48:27 +0000 Subject: [PATCH] fix the effect kcm for kwin (port it to KPluginFactory) svn path=/trunk/KDE/kdebase/workspace/; revision=714825 --- effects.cpp | 2 +- effects/CMakeLists.txt | 2 +- effects/configs_builtins.cpp | 21 +++++++++++++++++++++ effects/presentwindows_config.cpp | 6 ++---- effects/presentwindows_config.desktop | 2 +- effects/presentwindows_config.h | 3 +-- effects/shadow_config.cpp | 6 ++---- effects/shadow_config.desktop | 2 +- effects/shadow_config.h | 3 +-- lib/kwineffects.h | 12 +++++++++--- 10 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 effects/configs_builtins.cpp diff --git a/effects.cpp b/effects.cpp index 7ec7c56c33..2539556964 100644 --- a/effects.cpp +++ b/effects.cpp @@ -84,7 +84,7 @@ void EffectsHandlerImpl::reconfigure() } // the idea is that effects call this function again which calls the next one -void EffectsHandlerImpl::prePaintScreen( ScreenPrePaintData& data, int time ) +void EffectsHandlerImpl::cprePaintScreen( ScreenPrePaintData& data, int time ) { if( current_paint_screen < loaded_effects.size()) { diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index 0c087cbe17..a3f1685f63 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -99,7 +99,7 @@ if(OPENGL_FOUND) DESTINATION ${DATA_INSTALL_DIR}/kwin ) # config modules - KWIN4_ADD_EFFECT_CONFIG( builtins presentwindows_config.cpp shadow_config.cpp ) + KWIN4_ADD_EFFECT_CONFIG( builtins presentwindows_config.cpp shadow_config.cpp configs_builtins.cpp) install( FILES presentwindows_config.desktop shadow_config.desktop diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp new file mode 100644 index 0000000000..710493f9b4 --- /dev/null +++ b/effects/configs_builtins.cpp @@ -0,0 +1,21 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Bernhard Loos + +You can Freely distribute this program under the GNU General Public +License. See the file "COPYING" for the exact licensing terms. +******************************************************************/ + +#include "shadow_config.h" +#include "presentwindows_config.h" + +#include + +#include + +K_PLUGIN_FACTORY_DEFINITION(EffectFactory, registerPlugin("shadow"); + registerPlugin("presentwindows");) +K_EXPORT_PLUGIN(EffectFactory("kcm_kwineffect")) + diff --git a/effects/presentwindows_config.cpp b/effects/presentwindows_config.cpp index 50413a2787..add939bfa3 100644 --- a/effects/presentwindows_config.cpp +++ b/effects/presentwindows_config.cpp @@ -12,7 +12,6 @@ License. See the file "COPYING" for the exact licensing terms. #include -#include #include #include @@ -21,13 +20,12 @@ License. See the file "COPYING" for the exact licensing terms. #include #include -KWIN_EFFECT_CONFIG( presentwindows, KWin::PresentWindowsEffectConfig ) namespace KWin { -PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QStringList& args) : - KCModule(KGenericFactory::componentData(), parent, args) +PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QVariantList& args) : + KCModule(EffectFactory::componentData(), parent, args) { kDebug() ; diff --git a/effects/presentwindows_config.desktop b/effects/presentwindows_config.desktop index 02b7977bf4..e059d96a3d 100644 --- a/effects/presentwindows_config.desktop +++ b/effects/presentwindows_config.desktop @@ -4,8 +4,8 @@ Type=Service ServiceTypes=KCModule X-KDE-Library=kcm_kwin4_effect_builtins -X-KDE-FactoryName=kcm_kwineffect_presentwindows X-KDE-ParentComponents=kwin4_effect_presentwindows +X-KDE-PluginKeyword=presentwindows Name=Present Windows Name[ar]=نوافذ حديثة diff --git a/effects/presentwindows_config.h b/effects/presentwindows_config.h index cb51d01b71..aa52291413 100644 --- a/effects/presentwindows_config.h +++ b/effects/presentwindows_config.h @@ -17,7 +17,6 @@ License. See the file "COPYING" for the exact licensing terms. class QComboBox; - namespace KWin { @@ -25,7 +24,7 @@ class PresentWindowsEffectConfig : public KCModule { Q_OBJECT public: - explicit PresentWindowsEffectConfig(QWidget* parent = 0, const QStringList& args = QStringList()); + explicit PresentWindowsEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); ~PresentWindowsEffectConfig(); virtual void save(); diff --git a/effects/shadow_config.cpp b/effects/shadow_config.cpp index b010953517..8dc7beba78 100644 --- a/effects/shadow_config.cpp +++ b/effects/shadow_config.cpp @@ -12,7 +12,6 @@ License. See the file "COPYING" for the exact licensing terms. #include -#include #include #include @@ -21,13 +20,12 @@ License. See the file "COPYING" for the exact licensing terms. #include #include -KWIN_EFFECT_CONFIG( shadow, KWin::ShadowEffectConfig ) namespace KWin { -ShadowEffectConfig::ShadowEffectConfig(QWidget* parent, const QStringList& args) : - KCModule(KGenericFactory::componentData(), parent, args) +ShadowEffectConfig::ShadowEffectConfig(QWidget* parent, const QVariantList& args) : + KCModule(EffectFactory::componentData(), parent, args) { kDebug() ; diff --git a/effects/shadow_config.desktop b/effects/shadow_config.desktop index b1077f8809..1045e3afa8 100644 --- a/effects/shadow_config.desktop +++ b/effects/shadow_config.desktop @@ -4,8 +4,8 @@ Type=Service ServiceTypes=KCModule X-KDE-Library=kcm_kwin4_effect_builtins -X-KDE-FactoryName=kcm_kwineffect_shadow X-KDE-ParentComponents=kwin4_effect_shadow +X-KDE-PluginKeyword=shadow Name=Shadow Name[be]=Цень diff --git a/effects/shadow_config.h b/effects/shadow_config.h index f8025c2093..3b44734436 100644 --- a/effects/shadow_config.h +++ b/effects/shadow_config.h @@ -17,7 +17,6 @@ License. See the file "COPYING" for the exact licensing terms. class QSpinBox; - namespace KWin { @@ -25,7 +24,7 @@ class ShadowEffectConfig : public KCModule { Q_OBJECT public: - explicit ShadowEffectConfig(QWidget* parent = 0, const QStringList& args = QStringList()); + explicit ShadowEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); ~ShadowEffectConfig(); virtual void save(); diff --git a/lib/kwineffects.h b/lib/kwineffects.h index 6553bc58a0..2b3ebebc0c 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -24,6 +24,8 @@ License. See the file "COPYING" for the exact licensing terms. #include #include +#include + #include class KLibrary; @@ -159,9 +161,13 @@ class KWIN_EXPORT Effect * E.g. KWIN_EFFECT_CONFIG( flames, MyFlameEffectConfig ) **/ #define KWIN_EFFECT_CONFIG( name, classname ) \ - K_EXPORT_COMPONENT_FACTORY( \ - kcm_kwineffect_##name, \ - KGenericFactory( "kcm_kwineffect_" #name ) ) + K_PLUGIN_FACTORY(name##_factory, registerPlugin();) \ + K_EXPORT_PLUGIN(name##_factory("kcm_kwineffect_" #name)) + +/** + * The declaration of the factory to export the effect + **/ +K_PLUGIN_FACTORY_DECLARATION(EffectFactory) class KWIN_EXPORT EffectsHandler