/******************************************************************** KWin - the KDE window manager This file is part of the KDE project. Copyright (C) 2008 Martin Gräßlin . *********************************************************************/ #include "flipswitch_config.h" #include #include #include namespace KWin { KWIN_EFFECT_CONFIG_FACTORY FlipSwitchEffectConfigForm::FlipSwitchEffectConfigForm(QWidget* parent) : QWidget(parent) { setupUi(this); } FlipSwitchEffectConfig::FlipSwitchEffectConfig(QWidget* parent, const QVariantList& args) : KCModule(EffectFactory::componentData(), parent, args) { m_ui = new FlipSwitchEffectConfigForm(this); QVBoxLayout* layout = new QVBoxLayout(this); layout->addWidget(m_ui); connect(m_ui->checkAnimateFlip, SIGNAL(stateChanged(int)), this, SLOT(changed())); connect(m_ui->spinFlipDuration, SIGNAL(valueChanged(int)), this, SLOT(changed())); load(); } FlipSwitchEffectConfig::~FlipSwitchEffectConfig() { } void FlipSwitchEffectConfig::load() { KCModule::load(); KConfigGroup conf = EffectsHandler::effectConfig( "FlipSwitch" ); int flipDuration = conf.readEntry( "FlipDuration", 0 ); bool animateFlip = conf.readEntry( "AnimateFlip", true ); m_ui->spinFlipDuration->setValue( flipDuration ); if( animateFlip ) { m_ui->checkAnimateFlip->setCheckState( Qt::Checked ); } else { m_ui->checkAnimateFlip->setCheckState( Qt::Unchecked ); } emit changed(false); } void FlipSwitchEffectConfig::save() { KConfigGroup conf = EffectsHandler::effectConfig( "FlipSwitch" ); conf.writeEntry( "FlipDuration", m_ui->spinFlipDuration->value() ); conf.writeEntry( "AnimateFlip", m_ui->checkAnimateFlip->checkState() == Qt::Checked ? true : false ); conf.sync(); emit changed(false); EffectsHandler::sendReloadMessage( "flipswitch" ); } void FlipSwitchEffectConfig::defaults() { m_ui->spinFlipDuration->setValue( 0 ); m_ui->checkAnimateFlip->setCheckState( Qt::Checked ); emit changed(true); } } // namespace #include "flipswitch_config.moc"