not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kwin / effects / diminactive_config.cpp
blobc766d53ababa60efa814ef8ba3480287092d5a17
1 /********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
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 "diminactive_config.h"
23 #include <kwineffects.h>
25 #include <klocale.h>
26 #include <kdebug.h>
27 #include <kconfiggroup.h>
28 #include <kaction.h>
29 #include <KShortcutsEditor>
31 #include <QWidget>
32 #include <QVBoxLayout>
34 KWIN_EFFECT_CONFIG_FACTORY
36 namespace KWin
39 DimInactiveEffectConfigForm::DimInactiveEffectConfigForm(QWidget* parent) : QWidget(parent)
41 setupUi(this);
44 DimInactiveEffectConfig::DimInactiveEffectConfig(QWidget* parent, const QVariantList& args) :
45 KCModule(EffectFactory::componentData(), parent, args)
47 m_ui = new DimInactiveEffectConfigForm(this);
49 QVBoxLayout* layout = new QVBoxLayout(this);
51 layout->addWidget(m_ui);
53 connect(m_ui->spinStrength, SIGNAL(valueChanged(int)), this, SLOT(changed()));
54 connect(m_ui->checkPanel, SIGNAL(toggled(bool)), this, SLOT(changed()));
55 connect(m_ui->checkDesktop, SIGNAL(toggled(bool)), this, SLOT(changed()));
56 connect(m_ui->checkGroup, SIGNAL(toggled(bool)), this, SLOT(changed()));
58 load();
61 void DimInactiveEffectConfig::load()
63 KCModule::load();
65 KConfigGroup conf = EffectsHandler::effectConfig("DimInactive");
67 int strength = conf.readEntry("Strength", 25);
68 bool panel = conf.readEntry("DimPanels", false);
69 bool desktop = conf.readEntry("DimDesktop", false);
70 bool group = conf.readEntry("DimByGroup", true);
71 m_ui->spinStrength->setValue(strength);
72 m_ui->checkPanel->setChecked(panel);
73 m_ui->checkDesktop->setChecked(desktop);
74 m_ui->checkGroup->setChecked(group);
76 emit changed(false);
79 void DimInactiveEffectConfig::save()
81 KConfigGroup conf = EffectsHandler::effectConfig("DimInactive");
83 conf.writeEntry("Strength", m_ui->spinStrength->value());
84 conf.writeEntry("DimPanels", m_ui->checkPanel->isChecked());
85 conf.writeEntry("DimDesktop", m_ui->checkDesktop->isChecked());
86 conf.writeEntry("DimByGroup", m_ui->checkGroup->isChecked());
88 conf.sync();
90 KCModule::save();
91 emit changed(false);
92 EffectsHandler::sendReloadMessage( "diminactive" );
95 void DimInactiveEffectConfig::defaults()
97 m_ui->spinStrength->setValue(25);
98 m_ui->checkPanel->setChecked(false);
99 m_ui->checkDesktop->setChecked(false);
100 m_ui->checkGroup->setChecked(true);
101 emit changed(true);
105 } // namespace
107 #include "diminactive_config.moc"