diff --git a/effects/blur/blur_config.cpp b/effects/blur/blur_config.cpp new file mode 100644 index 0000000000..0612599b6b --- /dev/null +++ b/effects/blur/blur_config.cpp @@ -0,0 +1,76 @@ +/* + * Copyright © 2010 Fredrik Höglund + * + * 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; see the file COPYING. if not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "blur_config.h" + +#include + +namespace KWin +{ + +KWIN_EFFECT_CONFIG_FACTORY + +BlurEffectConfig::BlurEffectConfig(QWidget *parent, const QVariantList &args) + : KCModule(EffectFactory::componentData(), parent, args) +{ + ui.setupUi(this); + connect(ui.slider, SIGNAL(valueChanged(int)), SLOT(valueChanged(int))); + + load(); +} + +BlurEffectConfig::~BlurEffectConfig() +{ +} + +void BlurEffectConfig::load() +{ + KCModule::load(); + KConfigGroup cg = EffectsHandler::effectConfig("Blur"); + ui.slider->setValue(cg.readEntry("BlurRadius", 12) / 2); + emit changed(false); +} + +void BlurEffectConfig::save() +{ + KCModule::save(); + + KConfigGroup cg = EffectsHandler::effectConfig("Blur"); + cg.writeEntry("BlurRadius", ui.slider->value() * 2); + cg.sync(); + + emit changed(false); + EffectsHandler::sendReloadMessage("blur"); +} + +void BlurEffectConfig::defaults() +{ + emit changed(true); +} + +void BlurEffectConfig::valueChanged(int value) +{ + Q_UNUSED(value) + emit changed(true); +} + +} // namespace KWin + +#include "blur_config.moc" + diff --git a/effects/blur/blur_config.desktop b/effects/blur/blur_config.desktop new file mode 100644 index 0000000000..b11d333368 --- /dev/null +++ b/effects/blur/blur_config.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Service +X-KDE-ServiceTypes=KCModule + +X-KDE-Library=kcm_kwin4_effect_builtins +X-KDE-ParentComponents=kwin4_effect_blur +X-KDE-PluginKeyword=blur + +Name=Blur + diff --git a/effects/blur/blur_config.h b/effects/blur/blur_config.h new file mode 100644 index 0000000000..6dddd9e404 --- /dev/null +++ b/effects/blur/blur_config.h @@ -0,0 +1,51 @@ +/* + * Copyright © 2010 Fredrik Höglund + * + * 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; see the file COPYING. if not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef BLUR_CONFIG_H +#define BLUR_CONFIG_H + +#include +#include "ui_blur_config.h" + +namespace KWin +{ + +class BlurEffectConfig : public KCModule +{ + Q_OBJECT + +public: + explicit BlurEffectConfig(QWidget *parent = 0, const QVariantList& args = QVariantList()); + ~BlurEffectConfig(); + + void save(); + void load(); + void defaults(); + +private slots: + void valueChanged(int value); + +private: + ::Ui::BlurEffectConfig ui; +}; + +} // namespace KWin + +#endif + diff --git a/effects/blur/blur_config.ui b/effects/blur/blur_config.ui new file mode 100644 index 0000000000..3b99afde4e --- /dev/null +++ b/effects/blur/blur_config.ui @@ -0,0 +1,88 @@ + + + BlurEffectConfig + + + + 0 + 0 + 206 + 72 + + + + + + + Strength of the effect: + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Light + + + + + + + 1 + + + 7 + + + 1 + + + 1 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + + + + + Strong + + + + + + + + + Qt::Vertical + + + + + + + +