diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt
index b8a7f7329a..33febc6359 100644
--- a/effects/CMakeLists.txt
+++ b/effects/CMakeLists.txt
@@ -89,6 +89,8 @@ SET(kwin4_effect_builtins_config_sources
desktopgrid_config.ui
diminactive_config.cpp
diminactive_config.ui
+ magiclamp_config.cpp
+ magiclamp_config.ui
maketransparent_config.cpp
maketransparent_config.ui
presentwindows_config.cpp
@@ -105,6 +107,7 @@ install( FILES
boxswitch_config.desktop
desktopgrid_config.desktop
diminactive_config.desktop
+ magiclamp_config.desktop
maketransparent_config.desktop
presentwindows_config.desktop
shadow_config.desktop
diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp
index 391806feb6..3a1a9a7846 100644
--- a/effects/configs_builtins.cpp
+++ b/effects/configs_builtins.cpp
@@ -24,6 +24,7 @@ along with this program. If not, see .
#include "boxswitch_config.h"
#include "desktopgrid_config.h"
#include "diminactive_config.h"
+#include "magiclamp_config.h"
#include "maketransparent_config.h"
#include "presentwindows_config.h"
#include "shadow_config.h"
@@ -65,6 +66,7 @@ KWIN_EFFECT_CONFIG_FACTORY
registerPlugin("boxswitch"); \
registerPlugin("desktopgrid"); \
registerPlugin("diminactive"); \
+ registerPlugin("magiclamp"); \
registerPlugin("maketransparent"); \
registerPlugin("presentwindows"); \
registerPlugin("shadow"); \
diff --git a/effects/magiclamp.cpp b/effects/magiclamp.cpp
index 4eee95aced..04e3ac0b2e 100644
--- a/effects/magiclamp.cpp
+++ b/effects/magiclamp.cpp
@@ -21,6 +21,8 @@ along with this program. If not, see .
// based on minimize animation by Rivo Laks
#include "magiclamp.h"
+#include
+#include
namespace KWin
{
@@ -30,8 +32,14 @@ KWIN_EFFECT( magiclamp, MagicLampEffect )
MagicLampEffect::MagicLampEffect()
{
mActiveAnimations = 0;
+ reconfigure( ReconfigureAll );
}
+void MagicLampEffect::reconfigure( ReconfigureFlags )
+ {
+ KConfigGroup conf = effects->effectConfig( "MagicLamp" );
+ mAnimationDuration = animationTime( conf, "AnimationDuration", 250 );
+ }
void MagicLampEffect::prePaintScreen( ScreenPrePaintData& data, int time )
{
@@ -247,14 +255,14 @@ void MagicLampEffect::postPaintScreen()
void MagicLampEffect::windowMinimized( EffectWindow* w )
{
mTimeLineWindows[w].setCurveShape(TimeLine::LinearCurve);
- mTimeLineWindows[w].setDuration( animationTime( 250 ));
+ mTimeLineWindows[w].setDuration( mAnimationDuration );
mTimeLineWindows[w].setProgress(0.0f);
}
void MagicLampEffect::windowUnminimized( EffectWindow* w )
{
mTimeLineWindows[w].setCurveShape(TimeLine::LinearCurve);
- mTimeLineWindows[w].setDuration( animationTime( 250 ));
+ mTimeLineWindows[w].setDuration( mAnimationDuration );
mTimeLineWindows[w].setProgress(1.0f);
}
diff --git a/effects/magiclamp.h b/effects/magiclamp.h
index 087a74070f..800ed04cd1 100644
--- a/effects/magiclamp.h
+++ b/effects/magiclamp.h
@@ -32,6 +32,7 @@ class MagicLampEffect
public:
MagicLampEffect();
+ virtual void reconfigure( ReconfigureFlags );
virtual void prePaintScreen( ScreenPrePaintData& data, int time );
virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
@@ -43,6 +44,7 @@ class MagicLampEffect
private:
QHash< EffectWindow*, TimeLine > mTimeLineWindows;
int mActiveAnimations;
+ int mAnimationDuration;
enum IconPosition
{
diff --git a/effects/magiclamp_config.cpp b/effects/magiclamp_config.cpp
new file mode 100644
index 0000000000..b8d51912e8
--- /dev/null
+++ b/effects/magiclamp_config.cpp
@@ -0,0 +1,81 @@
+/********************************************************************
+ KWin - the KDE window manager
+ This file is part of the KDE project.
+
+ Copyright (C) 2009 Martin Gräßlin
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*********************************************************************/
+#include "magiclamp_config.h"
+#include
+
+#include
+
+#include
+#ifndef KDE_USE_FINAL
+KWIN_EFFECT_CONFIG_FACTORY
+#endif
+
+namespace KWin
+{
+
+MagicLampEffectConfigForm::MagicLampEffectConfigForm(QWidget* parent) : QWidget(parent)
+{
+ setupUi(this);
+}
+
+MagicLampEffectConfig::MagicLampEffectConfig(QWidget* parent, const QVariantList& args) :
+ KCModule(EffectFactory::componentData(), parent, args)
+ {
+ m_ui = new MagicLampEffectConfigForm(this);
+
+ QVBoxLayout* layout = new QVBoxLayout(this);
+
+ layout->addWidget(m_ui);
+
+ connect(m_ui->animationDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));
+ load();
+ }
+
+void MagicLampEffectConfig::load()
+ {
+ KCModule::load();
+
+ KConfigGroup conf = EffectsHandler::effectConfig( "MagicLamp" );
+
+ int duration = conf.readEntry( "AnimationDuration", 0 );
+ m_ui->animationDurationSpin->setValue( duration );
+ emit changed(false);
+ }
+
+void MagicLampEffectConfig::save()
+ {
+ KConfigGroup conf = EffectsHandler::effectConfig( "MagicLamp" );
+
+ conf.writeEntry( "AnimationDuration", m_ui->animationDurationSpin->value() );
+
+ conf.sync();
+
+ emit changed(false);
+ EffectsHandler::sendReloadMessage( "magiclamp" );
+ }
+
+void MagicLampEffectConfig::defaults()
+ {
+ m_ui->animationDurationSpin->setValue( 0 );
+ emit changed(true);
+ }
+} // namespace
+
+#include "magiclamp_config.moc"
diff --git a/effects/magiclamp_config.desktop b/effects/magiclamp_config.desktop
new file mode 100644
index 0000000000..9170fa5203
--- /dev/null
+++ b/effects/magiclamp_config.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Service
+X-KDE-ServiceTypes=KCModule
+
+X-KDE-Library=kcm_kwin4_effect_builtins
+X-KDE-ParentComponents=kwin4_effect_magiclamp
+X-KDE-PluginKeyword=magiclamp
+
+Name=Magic Lamp
diff --git a/effects/magiclamp_config.h b/effects/magiclamp_config.h
new file mode 100644
index 0000000000..4803b5d472
--- /dev/null
+++ b/effects/magiclamp_config.h
@@ -0,0 +1,56 @@
+/********************************************************************
+ KWin - the KDE window manager
+ This file is part of the KDE project.
+
+ Copyright (C) 2009 Martin Gräßlin
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*********************************************************************/
+
+#ifndef KWIN_MAGICLAMP_CONFIG_H
+#define KWIN_MAGICLAMP_CONFIG_H
+
+#include
+
+#include "ui_magiclamp_config.h"
+
+class KFileDialog;
+
+namespace KWin
+{
+
+class MagicLampEffectConfigForm : public QWidget, public Ui::MagicLampEffectConfigForm
+{
+ Q_OBJECT
+ public:
+ explicit MagicLampEffectConfigForm(QWidget* parent);
+};
+
+class MagicLampEffectConfig : public KCModule
+ {
+ Q_OBJECT
+ public:
+ explicit MagicLampEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
+
+ public slots:
+ virtual void save();
+ virtual void load();
+ virtual void defaults();
+ private:
+ MagicLampEffectConfigForm* m_ui;
+ };
+
+} // namespace
+
+#endif
diff --git a/effects/magiclamp_config.ui b/effects/magiclamp_config.ui
new file mode 100644
index 0000000000..691c82ccc2
--- /dev/null
+++ b/effects/magiclamp_config.ui
@@ -0,0 +1,52 @@
+
+ KWin::MagicLampEffectConfigForm
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ -
+
+
+ Animation duration:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ animationDurationSpin
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Default
+
+
+ msec
+
+
+ 5000
+
+
+ 10
+
+
+
+
+
+
+
+