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>
27 KWIN_EFFECT_CONFIG_FACTORY
33 FlipSwitchEffectConfigForm::FlipSwitchEffectConfigForm(QWidget
* parent
) : QWidget(parent
)
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()));
53 FlipSwitchEffectConfig::~FlipSwitchEffectConfig()
57 void FlipSwitchEffectConfig::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
);
68 m_ui
->checkAnimateFlip
->setCheckState( Qt::Checked
);
72 m_ui
->checkAnimateFlip
->setCheckState( Qt::Unchecked
);
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 );
88 EffectsHandler::sendReloadMessage( "flipswitch" );
91 void FlipSwitchEffectConfig::defaults()
93 m_ui
->spinFlipDuration
->setValue( 0 );
94 m_ui
->checkAnimateFlip
->setCheckState( Qt::Checked
);
101 #include "flipswitch_config.moc"