add more spacing
[personal-kdebase.git] / workspace / kwin / effects / flipswitch_config.cpp
blobfc63eda2c2128ad63694a1d031d85a76843ebf8f
1 /********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.com
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *********************************************************************/
20 #include "flipswitch_config.h"
21 #include <kwineffects.h>
23 #include <kconfiggroup.h>
25 #include <QVBoxLayout>
26 #ifndef KDE_USE_FINAL
27 KWIN_EFFECT_CONFIG_FACTORY
28 #endif
30 namespace KWin
33 FlipSwitchEffectConfigForm::FlipSwitchEffectConfigForm(QWidget* parent) : QWidget(parent)
35 setupUi(this);
38 FlipSwitchEffectConfig::FlipSwitchEffectConfig(QWidget* parent, const QVariantList& args) :
39 KCModule(EffectFactory::componentData(), parent, args)
41 m_ui = new FlipSwitchEffectConfigForm(this);
43 QVBoxLayout* layout = new QVBoxLayout(this);
45 layout->addWidget(m_ui);
47 connect(m_ui->checkAnimateFlip, SIGNAL(stateChanged(int)), this, SLOT(changed()));
48 connect(m_ui->spinFlipDuration, SIGNAL(valueChanged(int)), this, SLOT(changed()));
50 load();
53 FlipSwitchEffectConfig::~FlipSwitchEffectConfig()
57 void FlipSwitchEffectConfig::load()
59 KCModule::load();
61 KConfigGroup conf = EffectsHandler::effectConfig( "FlipSwitch" );
63 int flipDuration = conf.readEntry( "FlipDuration", 0 );
64 bool animateFlip = conf.readEntry( "AnimateFlip", true );
65 m_ui->spinFlipDuration->setValue( flipDuration );
66 if( animateFlip )
68 m_ui->checkAnimateFlip->setCheckState( Qt::Checked );
70 else
72 m_ui->checkAnimateFlip->setCheckState( Qt::Unchecked );
75 emit changed(false);
78 void FlipSwitchEffectConfig::save()
80 KConfigGroup conf = EffectsHandler::effectConfig( "FlipSwitch" );
82 conf.writeEntry( "FlipDuration", m_ui->spinFlipDuration->value() );
83 conf.writeEntry( "AnimateFlip", m_ui->checkAnimateFlip->checkState() == Qt::Checked ? true : false );
85 conf.sync();
87 emit changed(false);
88 EffectsHandler::sendReloadMessage( "flipswitch" );
91 void FlipSwitchEffectConfig::defaults()
93 m_ui->spinFlipDuration->setValue( 0 );
94 m_ui->checkAnimateFlip->setCheckState( Qt::Checked );
95 emit changed(true);
99 } // namespace
101 #include "flipswitch_config.moc"