2008-02-21 13:20:22 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2008 Martin Gräßlin <ubuntu@martin-graesslin.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 "coverswitch_config.h"
|
|
|
|
#include <kwineffects.h>
|
|
|
|
|
|
|
|
#include <kconfiggroup.h>
|
|
|
|
|
2008-09-16 07:41:39 +00:00
|
|
|
#include <QVBoxLayout>
|
2008-02-21 13:20:22 +00:00
|
|
|
#ifndef KDE_USE_FINAL
|
|
|
|
KWIN_EFFECT_CONFIG_FACTORY
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
CoverSwitchEffectConfigForm::CoverSwitchEffectConfigForm(QWidget* parent) : QWidget(parent)
|
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
CoverSwitchEffectConfig::CoverSwitchEffectConfig(QWidget* parent, const QVariantList& args) :
|
|
|
|
KCModule(EffectFactory::componentData(), parent, args)
|
|
|
|
{
|
|
|
|
m_ui = new CoverSwitchEffectConfigForm(this);
|
|
|
|
|
2008-09-16 07:41:39 +00:00
|
|
|
QVBoxLayout* layout = new QVBoxLayout(this);
|
2008-02-21 13:20:22 +00:00
|
|
|
|
2008-09-16 07:41:39 +00:00
|
|
|
layout->addWidget(m_ui);
|
2008-02-21 13:20:22 +00:00
|
|
|
|
|
|
|
connect(m_ui->checkAnimateSwitch, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
|
|
|
connect(m_ui->checkAnimateStart, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
|
|
|
connect(m_ui->checkAnimateStop, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
|
|
|
connect(m_ui->checkReflection, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
2008-11-11 21:32:45 +00:00
|
|
|
connect(m_ui->checkThumbnails, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
|
|
|
connect(m_ui->checkDynamicThumbnails, SIGNAL(stateChanged(int)), this, SLOT(changed()));
|
|
|
|
connect(m_ui->spinThumbnailWindows, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
2008-02-21 13:20:22 +00:00
|
|
|
connect(m_ui->spinDuration, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
2008-11-11 21:32:45 +00:00
|
|
|
connect(m_ui->zPositionSlider, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
|
|
|
|
|
|
|
connect(m_ui->checkThumbnails, SIGNAL(stateChanged(int)), this, SLOT(thumbnailsChanged()));
|
|
|
|
connect(m_ui->checkDynamicThumbnails, SIGNAL(stateChanged(int)), this, SLOT(thumbnailsChanged()));
|
2008-02-21 13:20:22 +00:00
|
|
|
|
|
|
|
load();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CoverSwitchEffectConfig::load()
|
|
|
|
{
|
|
|
|
KCModule::load();
|
|
|
|
|
|
|
|
KConfigGroup conf = EffectsHandler::effectConfig( "CoverSwitch" );
|
|
|
|
|
2008-11-11 21:32:45 +00:00
|
|
|
m_ui->spinDuration->setValue( conf.readEntry( "Duration", 0 ) );
|
|
|
|
m_ui->checkAnimateSwitch->setChecked( conf.readEntry( "AnimateSwitch", true ));
|
|
|
|
m_ui->checkAnimateStart->setChecked( conf.readEntry( "AnimateStart", true ));
|
|
|
|
m_ui->checkAnimateStop->setChecked( conf.readEntry( "AnimateStop", true ));
|
|
|
|
m_ui->checkReflection->setChecked( conf.readEntry( "Reflection", true ));
|
|
|
|
m_ui->checkThumbnails->setChecked( conf.readEntry( "Thumbnails", true ));
|
|
|
|
m_ui->checkDynamicThumbnails->setChecked( conf.readEntry( "DynamicThumbnails", true ));
|
|
|
|
m_ui->spinThumbnailWindows->setValue( conf.readEntry( "ThumbnailWindows", 8 ));
|
|
|
|
m_ui->zPositionSlider->setValue( conf.readEntry( "ZPosition", 900 ));
|
|
|
|
|
|
|
|
thumbnailsChanged();
|
2008-02-21 13:20:22 +00:00
|
|
|
|
|
|
|
emit changed(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CoverSwitchEffectConfig::save()
|
|
|
|
{
|
|
|
|
KConfigGroup conf = EffectsHandler::effectConfig( "CoverSwitch" );
|
|
|
|
|
|
|
|
conf.writeEntry( "Duration", m_ui->spinDuration->value() );
|
2008-11-11 21:32:45 +00:00
|
|
|
conf.writeEntry( "AnimateSwitch", m_ui->checkAnimateSwitch->isChecked() );
|
|
|
|
conf.writeEntry( "AnimateStart", m_ui->checkAnimateStart->isChecked() );
|
|
|
|
conf.writeEntry( "AnimateStop", m_ui->checkAnimateStop->isChecked() );
|
|
|
|
conf.writeEntry( "Reflection", m_ui->checkReflection->isChecked() );
|
|
|
|
conf.writeEntry( "Thumbnails", m_ui->checkThumbnails->isChecked() );
|
|
|
|
conf.writeEntry( "DynamicThumbnails", m_ui->checkDynamicThumbnails->isChecked() );
|
|
|
|
conf.writeEntry( "ThumbnailWindows", m_ui->spinThumbnailWindows->value() );
|
|
|
|
conf.writeEntry( "ZPosition", m_ui->zPositionSlider->value() );
|
2008-02-21 13:20:22 +00:00
|
|
|
|
|
|
|
conf.sync();
|
|
|
|
|
|
|
|
emit changed(false);
|
|
|
|
EffectsHandler::sendReloadMessage( "coverswitch" );
|
|
|
|
}
|
|
|
|
|
|
|
|
void CoverSwitchEffectConfig::defaults()
|
|
|
|
{
|
2008-08-30 07:25:54 +00:00
|
|
|
m_ui->spinDuration->setValue( 0 );
|
2008-02-21 13:20:22 +00:00
|
|
|
m_ui->checkAnimateSwitch->setCheckState( Qt::Checked );
|
|
|
|
m_ui->checkAnimateStart->setCheckState( Qt::Checked );
|
|
|
|
m_ui->checkAnimateStop->setCheckState( Qt::Checked );
|
|
|
|
m_ui->checkReflection->setCheckState( Qt::Checked );
|
2008-11-11 21:32:45 +00:00
|
|
|
m_ui->checkThumbnails->setCheckState( Qt::Checked );
|
|
|
|
m_ui->checkDynamicThumbnails->setCheckState( Qt::Checked );
|
|
|
|
m_ui->spinThumbnailWindows->setValue( 8 );
|
|
|
|
m_ui->zPositionSlider->setValue( 900 );
|
2008-02-21 13:20:22 +00:00
|
|
|
emit changed(true);
|
|
|
|
}
|
|
|
|
|
2008-11-11 21:32:45 +00:00
|
|
|
void CoverSwitchEffectConfig::thumbnailsChanged()
|
|
|
|
{
|
|
|
|
bool enabled = m_ui->checkThumbnails->isChecked() && m_ui->checkDynamicThumbnails->isChecked();
|
|
|
|
m_ui->checkDynamicThumbnails->setEnabled( m_ui->checkThumbnails->isChecked() );
|
|
|
|
m_ui->spinThumbnailWindows->setEnabled( enabled );
|
|
|
|
m_ui->labelThumbnailWindows->setEnabled( enabled );
|
|
|
|
}
|
2008-02-21 13:20:22 +00:00
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#include "coverswitch_config.moc"
|