1 /********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2008 Lucas Murray <lmurray@undefinedfire.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 *********************************************************************/
21 #include "boxswitch_config.h"
22 #include <kwineffects.h>
24 #include <kconfiggroup.h>
26 #include <QVBoxLayout>
28 KWIN_EFFECT_CONFIG_FACTORY
34 BoxSwitchEffectConfigForm::BoxSwitchEffectConfigForm(QWidget
* parent
) : QWidget(parent
)
39 BoxSwitchEffectConfig::BoxSwitchEffectConfig(QWidget
* parent
, const QVariantList
& args
)
40 : KCModule( EffectFactory::componentData(), parent
, args
)
42 m_ui
= new BoxSwitchEffectConfigForm( this );
44 QVBoxLayout
* layout
= new QVBoxLayout( this );
46 layout
->addWidget( m_ui
);
48 connect( m_ui
->opacitySpin
, SIGNAL( valueChanged(int) ), this, SLOT( changed() ));
49 connect( m_ui
->elevateBox
, SIGNAL( stateChanged(int) ), this, SLOT( changed() ));
50 connect( m_ui
->animateBox
, SIGNAL( stateChanged(int) ), this, SLOT( changed() ));
55 BoxSwitchEffectConfig::~BoxSwitchEffectConfig()
59 void BoxSwitchEffectConfig::load()
63 KConfigGroup conf
= EffectsHandler::effectConfig( "BoxSwitch" );
65 int opacity
= conf
.readEntry( "BackgroundOpacity", 25 );
66 m_ui
->opacitySpin
->setValue( opacity
);
68 bool elevate
= conf
.readEntry( "ElevateSelected", true );
69 m_ui
->elevateBox
->setChecked( elevate
);
71 bool animate
= conf
.readEntry( "AnimateSwitch", false );
72 m_ui
->animateBox
->setChecked( animate
);
77 void BoxSwitchEffectConfig::save()
81 KConfigGroup conf
= EffectsHandler::effectConfig( "BoxSwitch" );
83 conf
.writeEntry( "BackgroundOpacity", m_ui
->opacitySpin
->value() );
85 conf
.writeEntry( "ElevateSelected", m_ui
->elevateBox
->isChecked() );
87 conf
.writeEntry( "AnimateSwitch", m_ui
->animateBox
->isChecked() );
92 EffectsHandler::sendReloadMessage( "boxswitch" );
95 void BoxSwitchEffectConfig::defaults()
97 m_ui
->opacitySpin
->setValue( 25 );
98 m_ui
->elevateBox
->setChecked( true );
99 m_ui
->animateBox
->setChecked( false );
105 #include "boxswitch_config.moc"