kwin/effects/boxswitch_config.cpp
Lucas Murray 1e4b9efdd4 Added background window opacity setting to box switch.
BUG: 165300

svn path=/trunk/KDE/kdebase/workspace/; revision=857409
2008-09-05 10:48:18 +00:00

91 lines
2.3 KiB
C++

/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2008 Lucas Murray <lmurray@undefinedfire.com>
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. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "boxswitch_config.h"
#include <kwineffects.h>
#include <kconfiggroup.h>
#include <QVBoxLayout>
#ifndef KDE_USE_FINAL
KWIN_EFFECT_CONFIG_FACTORY
#endif
namespace KWin
{
BoxSwitchEffectConfigForm::BoxSwitchEffectConfigForm(QWidget* parent) : QWidget(parent)
{
setupUi(this);
}
BoxSwitchEffectConfig::BoxSwitchEffectConfig(QWidget* parent, const QVariantList& args)
: KCModule( EffectFactory::componentData(), parent, args )
{
m_ui = new BoxSwitchEffectConfigForm( this );
QVBoxLayout* layout = new QVBoxLayout( this );
layout->addWidget( m_ui );
connect( m_ui->opacitySpin, SIGNAL( valueChanged(int) ), this, SLOT( changed() ));
load();
}
BoxSwitchEffectConfig::~BoxSwitchEffectConfig()
{
}
void BoxSwitchEffectConfig::load()
{
KCModule::load();
KConfigGroup conf = EffectsHandler::effectConfig( "BoxSwitch" );
int opacity = conf.readEntry( "BackgroundOpacity", 25 );
m_ui->opacitySpin->setValue( opacity );
emit changed(false);
}
void BoxSwitchEffectConfig::save()
{
KCModule::save();
KConfigGroup conf = EffectsHandler::effectConfig( "BoxSwitch" );
conf.writeEntry( "BackgroundOpacity", m_ui->opacitySpin->value() );
conf.sync();
emit changed(false);
EffectsHandler::sendReloadMessage( "boxswitch" );
}
void BoxSwitchEffectConfig::defaults()
{
m_ui->opacitySpin->setValue( 25 );
emit changed(true);
}
} // namespace
#include "boxswitch_config.moc"