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>
31
KWIN_EFFECT_CONFIG_FACTORY
33
BoxSwitchEffectConfigForm::BoxSwitchEffectConfigForm(QWidget* parent) : QWidget(parent)
38
BoxSwitchEffectConfig::BoxSwitchEffectConfig(QWidget* parent, const QVariantList& args)
39
: KCModule(EffectFactory::componentData(), parent, args)
41
m_ui = new BoxSwitchEffectConfigForm(this);
43
QVBoxLayout* layout = new QVBoxLayout(this);
45
layout->addWidget(m_ui);
47
connect(m_ui->opacitySpin, SIGNAL(valueChanged(int)), this, SLOT(changed()));
48
connect(m_ui->elevateBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
49
connect(m_ui->animateBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
54
BoxSwitchEffectConfig::~BoxSwitchEffectConfig()
58
void BoxSwitchEffectConfig::load()
62
KConfigGroup conf = EffectsHandler::effectConfig("BoxSwitch");
64
int opacity = conf.readEntry("BackgroundOpacity", 25);
65
m_ui->opacitySpin->setValue(opacity);
67
bool elevate = conf.readEntry("ElevateSelected", true);
68
m_ui->elevateBox->setChecked(elevate);
70
bool animate = conf.readEntry("AnimateSwitch", false);
71
m_ui->animateBox->setChecked(animate);
76
void BoxSwitchEffectConfig::save()
80
KConfigGroup conf = EffectsHandler::effectConfig("BoxSwitch");
82
conf.writeEntry("BackgroundOpacity", m_ui->opacitySpin->value());
84
conf.writeEntry("ElevateSelected", m_ui->elevateBox->isChecked());
86
conf.writeEntry("AnimateSwitch", m_ui->animateBox->isChecked());
91
EffectsHandler::sendReloadMessage("boxswitch");
94
void BoxSwitchEffectConfig::defaults()
96
m_ui->opacitySpin->setValue(25);
97
m_ui->elevateBox->setChecked(true);
98
m_ui->animateBox->setChecked(false);
104
#include "boxswitch_config.moc"