2008-09-05 10:48:18 +00:00
|
|
|
/********************************************************************
|
|
|
|
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() ));
|
2008-09-06 09:58:49 +00:00
|
|
|
connect( m_ui->elevateBox, SIGNAL( stateChanged(int) ), this, SLOT( changed() ));
|
2008-10-05 11:41:15 +00:00
|
|
|
connect( m_ui->animateBox, SIGNAL( stateChanged(int) ), this, SLOT( changed() ));
|
2008-09-05 10:48:18 +00:00
|
|
|
|
|
|
|
load();
|
|
|
|
}
|
|
|
|
|
|
|
|
BoxSwitchEffectConfig::~BoxSwitchEffectConfig()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void BoxSwitchEffectConfig::load()
|
|
|
|
{
|
|
|
|
KCModule::load();
|
|
|
|
|
|
|
|
KConfigGroup conf = EffectsHandler::effectConfig( "BoxSwitch" );
|
|
|
|
|
|
|
|
int opacity = conf.readEntry( "BackgroundOpacity", 25 );
|
|
|
|
m_ui->opacitySpin->setValue( opacity );
|
|
|
|
|
2008-09-06 09:58:49 +00:00
|
|
|
bool elevate = conf.readEntry( "ElevateSelected", true );
|
|
|
|
m_ui->elevateBox->setChecked( elevate );
|
|
|
|
|
2008-10-05 11:41:15 +00:00
|
|
|
bool animate = conf.readEntry( "AnimateSwitch", false );
|
|
|
|
m_ui->animateBox->setChecked( animate );
|
|
|
|
|
2008-09-05 10:48:18 +00:00
|
|
|
emit changed(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BoxSwitchEffectConfig::save()
|
|
|
|
{
|
|
|
|
KCModule::save();
|
|
|
|
|
|
|
|
KConfigGroup conf = EffectsHandler::effectConfig( "BoxSwitch" );
|
|
|
|
|
|
|
|
conf.writeEntry( "BackgroundOpacity", m_ui->opacitySpin->value() );
|
|
|
|
|
2008-09-06 09:58:49 +00:00
|
|
|
conf.writeEntry( "ElevateSelected", m_ui->elevateBox->isChecked() );
|
|
|
|
|
2008-10-05 11:41:15 +00:00
|
|
|
conf.writeEntry( "AnimateSwitch", m_ui->animateBox->isChecked() );
|
|
|
|
|
2008-09-05 10:48:18 +00:00
|
|
|
conf.sync();
|
|
|
|
|
|
|
|
emit changed(false);
|
|
|
|
EffectsHandler::sendReloadMessage( "boxswitch" );
|
|
|
|
}
|
|
|
|
|
|
|
|
void BoxSwitchEffectConfig::defaults()
|
|
|
|
{
|
|
|
|
m_ui->opacitySpin->setValue( 25 );
|
2008-09-06 09:58:49 +00:00
|
|
|
m_ui->elevateBox->setChecked( true );
|
2008-10-05 11:41:15 +00:00
|
|
|
m_ui->animateBox->setChecked( false );
|
2008-09-05 10:48:18 +00:00
|
|
|
emit changed(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#include "boxswitch_config.moc"
|