1 /********************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
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 "maketransparent_config.h"
23 #include <kwineffects.h>
27 #include <kconfiggroup.h>
29 #include <QGridLayout>
34 KWIN_EFFECT_CONFIG_FACTORY
40 MakeTransparentEffectConfig::MakeTransparentEffectConfig(QWidget
* parent
, const QVariantList
& args
) :
41 KCModule(EffectFactory::componentData(), parent
, args
)
45 QGridLayout
* layout
= new QGridLayout(this);
47 layout
->addWidget(new QLabel(i18n("Changes opacity of following elements:"), this), 0, 0, 1, 2);
49 layout
->addWidget(new QLabel(i18n("Decorations:"), this), 1, 0);
50 mDecoration
= new QSpinBox(this);
51 mDecoration
->setRange(10, 100);
52 mDecoration
->setSuffix("%");
53 connect(mDecoration
, SIGNAL(valueChanged(int)), this, SLOT(changed()));
54 layout
->addWidget(mDecoration
, 1, 1);
56 layout
->addWidget(new QLabel(i18n("Inactive windows:"), this), 2, 0);
57 mInactive
= new QSpinBox(this);
58 mInactive
->setRange(10, 100);
59 mInactive
->setSuffix("%");
60 connect(mInactive
, SIGNAL(valueChanged(int)), this, SLOT(changed()));
61 layout
->addWidget(mInactive
, 2, 1);
63 layout
->addWidget(new QLabel(i18n("Moved/resized windows:"), this), 3, 0);
64 mMoveResize
= new QSpinBox(this);
65 mMoveResize
->setRange(10, 100);
66 mMoveResize
->setSuffix("%");
67 connect(mMoveResize
, SIGNAL(valueChanged(int)), this, SLOT(changed()));
68 layout
->addWidget(mMoveResize
, 3, 1);
70 layout
->addWidget(new QLabel(i18n("Dialogs:"), this), 4, 0);
71 mDialogs
= new QSpinBox(this);
72 mDialogs
->setRange(10, 100);
73 mDialogs
->setSuffix("%");
74 connect(mDialogs
, SIGNAL(valueChanged(int)), this, SLOT(changed()));
75 layout
->addWidget(mDialogs
, 4, 1);
77 layout
->addItem(new QSpacerItem(10, 10, QSizePolicy::Minimum
, QSizePolicy::Expanding
), 4, 0, 1, 2);
82 void MakeTransparentEffectConfig::load()
87 KConfigGroup conf
= EffectsHandler::effectConfig("MakeTransparent");
88 mDecoration
->setValue( (int)( conf
.readEntry( "Decoration", 1.0 ) * 100 ) );
89 mMoveResize
->setValue( (int)( conf
.readEntry( "MoveResize", 0.8 ) * 100 ) );
90 mDialogs
->setValue( (int)( conf
.readEntry( "Dialogs", 1.0 ) * 100 ) );
91 mInactive
->setValue( (int)( conf
.readEntry( "Inactive", 1.0 ) * 100 ) );
96 void MakeTransparentEffectConfig::save()
101 KConfigGroup conf
= EffectsHandler::effectConfig("MakeTransparent");
102 conf
.writeEntry( "Decoration", mDecoration
->value() / 100.0 );
103 conf
.writeEntry( "MoveResize", mMoveResize
->value() / 100.0 );
104 conf
.writeEntry( "Dialogs", mDialogs
->value() / 100.0 );
105 conf
.writeEntry( "Inactive", mInactive
->value() / 100.0 );
109 EffectsHandler::sendReloadMessage( "maketransparent" );
112 void MakeTransparentEffectConfig::defaults()
115 mDecoration
->setValue( 100 );
116 mMoveResize
->setValue( 80 );
117 mDialogs
->setValue( 100 );
118 mInactive
->setValue( 100 );
125 #include "maketransparent_config.moc"