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 "showfps_config.h"
23 #include <kwineffects.h>
29 KWIN_EFFECT_CONFIG_FACTORY
35 ShowFpsEffectConfig::ShowFpsEffectConfig(QWidget
* parent
, const QVariantList
& args
) :
36 KCModule(EffectFactory::componentData(), parent
, args
)
38 m_ui
= new Ui::ShowFpsEffectConfigForm
;
41 connect(m_ui
->textPosition
, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
42 connect(m_ui
->textFont
, SIGNAL(fontSelected(const QFont
&)), this, SLOT(changed()));
43 connect(m_ui
->textColor
, SIGNAL(changed(const QColor
&)), this, SLOT(changed()));
44 connect(m_ui
->textAlpha
, SIGNAL(valueChanged(double)), this, SLOT(changed()));
49 ShowFpsEffectConfig::~ShowFpsEffectConfig()
54 void ShowFpsEffectConfig::load()
58 KConfigGroup conf
= EffectsHandler::effectConfig("ShowFps");
60 int position
= conf
.readEntry("TextPosition", int(ShowFpsEffect::INSIDE_GRAPH
));
62 m_ui
->textPosition
->setCurrentIndex(position
);
64 QFont font
= conf
.readEntry("TextFont", QFont());
65 m_ui
->textFont
->setFont(font
);
67 QColor color
= conf
.readEntry("TextColor", QColor());
69 m_ui
->textColor
->setColor(color
);
71 double alpha
= conf
.readEntry("TextAlpha", 1.0);
72 m_ui
->textAlpha
->setValue(alpha
);
77 void ShowFpsEffectConfig::save()
81 KConfigGroup conf
= EffectsHandler::effectConfig("ShowFps");
83 int position
= m_ui
->textPosition
->currentIndex();
84 conf
.writeEntry("TextPosition", position
);
86 QFont font
= m_ui
->textFont
->font();
87 conf
.writeEntry("TextFont", font
);
89 QColor color
= m_ui
->textColor
->color();
90 conf
.writeEntry("TextColor", color
);
92 double alpha
= m_ui
->textAlpha
->value();
93 conf
.writeEntry("TextAlpha", alpha
);
98 EffectsHandler::sendReloadMessage("showfps");
101 void ShowFpsEffectConfig::defaults()
103 m_ui
->textPosition
->setCurrentIndex(0);
104 m_ui
->textFont
->setFont(QFont());
105 m_ui
->textColor
->setColor(QColor());
106 m_ui
->textAlpha
->setValue(1.0);
113 #include "showfps_config.moc"