diff --git a/effects/showfps/CMakeLists.txt b/effects/showfps/CMakeLists.txt
index 5d4f812fc7..7e9f67cf8a 100644
--- a/effects/showfps/CMakeLists.txt
+++ b/effects/showfps/CMakeLists.txt
@@ -6,6 +6,8 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
showfps/showfps.cpp
)
+kde4_add_kcfg_files(kwin4_effect_builtins_sources showfps/showfpsconfig.kcfgc)
+
# .desktop files
install( FILES
showfps/showfps.desktop
@@ -20,6 +22,8 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources
showfps/showfps_config.ui
)
+kde4_add_kcfg_files(kwin4_effect_builtins_config_sources showfps/showfpsconfig.kcfgc)
+
# .desktop files
install( FILES
showfps/showfps_config.desktop
diff --git a/effects/showfps/showfps.cpp b/effects/showfps/showfps.cpp
index 8410cfceab..b3dd9b7494 100644
--- a/effects/showfps/showfps.cpp
+++ b/effects/showfps/showfps.cpp
@@ -20,11 +20,10 @@ along with this program. If not, see .
#include "showfps.h"
-#include
+// KConfigSkeleton
+#include "showfpsconfig.h"
-#include
-#include
-#include
+#include
#include
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
@@ -66,10 +65,10 @@ ShowFpsEffect::ShowFpsEffect()
void ShowFpsEffect::reconfigure(ReconfigureFlags)
{
- KConfigGroup config(KGlobal::config(), "EffectShowFps");
- alpha = config.readEntry("Alpha", 0.5);
- x = config.readEntry("X", -10000);
- y = config.readEntry("Y", 0);
+ ShowFpsConfig::self()->readConfig();
+ alpha = ShowFpsConfig::alpha();
+ x = ShowFpsConfig::x();
+ y = ShowFpsConfig::y();
if (x == -10000) // there's no -0 :(
x = displayWidth() - 2 * NUM_PAINTS - FPS_WIDTH;
else if (x < 0)
@@ -80,11 +79,10 @@ void ShowFpsEffect::reconfigure(ReconfigureFlags)
y = displayHeight() - MAX_TIME - y;
fps_rect = QRect(x, y, FPS_WIDTH + 2 * NUM_PAINTS, MAX_TIME);
- config = effects->effectConfig("ShowFps");
- int textPosition = config.readEntry("TextPosition", int(INSIDE_GRAPH));
- textFont = config.readEntry("TextFont", QFont());
- textColor = config.readEntry("TextColor", QColor());
- double textAlpha = config.readEntry("TextAlpha", 1.0);
+ int textPosition = ShowFpsConfig::textPosition();
+ textFont = ShowFpsConfig::textFont();
+ textColor = ShowFpsConfig::textColor();
+ double textAlpha = ShowFpsConfig::textAlpha();
if (!textColor.isValid())
textColor = QPalette().color(QPalette::Active, QPalette::WindowText);
diff --git a/effects/showfps/showfps.kcfg b/effects/showfps/showfps.kcfg
new file mode 100644
index 0000000000..33a95c13a1
--- /dev/null
+++ b/effects/showfps/showfps.kcfg
@@ -0,0 +1,28 @@
+
+
+
+
+
+ 0
+
+
+
+ invalid
+
+
+ 1.0
+
+
+ 0.5
+
+
+ -10000
+
+
+ 0
+
+
+
diff --git a/effects/showfps/showfps_config.cpp b/effects/showfps/showfps_config.cpp
index 0135b073ca..f5d5911239 100644
--- a/effects/showfps/showfps_config.cpp
+++ b/effects/showfps/showfps_config.cpp
@@ -19,6 +19,10 @@ along with this program. If not, see .
*********************************************************************/
#include "showfps_config.h"
+
+// KConfigSkeleton
+#include "showfpsconfig.h"
+
#include "showfps.h"
#include
@@ -37,10 +41,7 @@ ShowFpsEffectConfig::ShowFpsEffectConfig(QWidget* parent, const QVariantList& ar
m_ui = new Ui::ShowFpsEffectConfigForm;
m_ui->setupUi(this);
- connect(m_ui->textPosition, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
- connect(m_ui->textFont, SIGNAL(fontSelected(QFont)), this, SLOT(changed()));
- connect(m_ui->textColor, SIGNAL(changed(QColor)), this, SLOT(changed()));
- connect(m_ui->textAlpha, SIGNAL(valueChanged(double)), this, SLOT(changed()));
+ addConfig(ShowFpsConfig::self(), this);
load();
}
@@ -50,63 +51,12 @@ ShowFpsEffectConfig::~ShowFpsEffectConfig()
delete m_ui;
}
-void ShowFpsEffectConfig::load()
-{
- KCModule::load();
-
- KConfigGroup conf = EffectsHandler::effectConfig("ShowFps");
-
- int position = conf.readEntry("TextPosition", int(ShowFpsEffect::INSIDE_GRAPH));
- if (position > -1)
- m_ui->textPosition->setCurrentIndex(position);
-
- QFont font = conf.readEntry("TextFont", QFont());
- m_ui->textFont->setFont(font);
-
- QColor color = conf.readEntry("TextColor", QColor());
- if (color.isValid())
- m_ui->textColor->setColor(color);
-
- double alpha = conf.readEntry("TextAlpha", 1.0);
- m_ui->textAlpha->setValue(alpha);
-
- emit changed(false);
-}
-
void ShowFpsEffectConfig::save()
{
KCModule::save();
-
- KConfigGroup conf = EffectsHandler::effectConfig("ShowFps");
-
- int position = m_ui->textPosition->currentIndex();
- conf.writeEntry("TextPosition", position);
-
- QFont font = m_ui->textFont->font();
- conf.writeEntry("TextFont", font);
-
- QColor color = m_ui->textColor->color();
- conf.writeEntry("TextColor", color);
-
- double alpha = m_ui->textAlpha->value();
- conf.writeEntry("TextAlpha", alpha);
-
- conf.sync();
-
- emit changed(false);
EffectsHandler::sendReloadMessage("showfps");
}
-void ShowFpsEffectConfig::defaults()
-{
- m_ui->textPosition->setCurrentIndex(0);
- m_ui->textFont->setFont(QFont());
- m_ui->textColor->setColor(QColor());
- m_ui->textAlpha->setValue(1.0);
-
- emit changed(true);
-}
-
} // namespace
#include "showfps_config.moc"
diff --git a/effects/showfps/showfps_config.h b/effects/showfps/showfps_config.h
index ad79519d4e..2492871297 100644
--- a/effects/showfps/showfps_config.h
+++ b/effects/showfps/showfps_config.h
@@ -37,8 +37,6 @@ public:
public slots:
virtual void save();
- virtual void load();
- virtual void defaults();
private:
Ui::ShowFpsEffectConfigForm *m_ui;
diff --git a/effects/showfps/showfps_config.ui b/effects/showfps/showfps_config.ui
index 711abc6ce3..0a5eb31305 100644
--- a/effects/showfps/showfps_config.ui
+++ b/effects/showfps/showfps_config.ui
@@ -1,148 +1,149 @@
-
+
+
KWin::ShowFpsEffectConfigForm
-
-
+
+
0
0
- 310
- 166
+ 356
+ 180
-
+
-
-
-
+
+
Text
-
-
-
-
-
+
+
-
+
+
Text position:
-
+
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
- textPosition
+
+ kcfg_TextPosition
- -
-
-
-
+
-
+
+
+
0
0
-
-
+
Inside Graph
-
-
+
Nowhere
-
-
+
Top Left
-
-
+
Top Right
-
-
+
Bottom Left
-
-
+
Bottom Right
- -
-
-
+
-
+
+
Text font:
-
+
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- -
-
-
-
+
-
+
+
+
0
0
- -
-
-
+
-
+
+
Text color:
-
+
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
- textColor
+
+ kcfg_TextColor
- -
-
-
-
+
-
+
+
+
0
0
- -
-
-
+
-
+
+
Text alpha:
-
+
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
- textAlpha
+
+ kcfg_TextAlpha
- -
-
-
-
+
-
+
+
+
0
0
-
+
2
-
+
1.000000000000000
-
+
0.100000000000000
-
+
1.000000000000000
@@ -158,16 +159,16 @@
QPushButton
-
- KComboBox
- QComboBox
-
-
KFontRequester
QWidget
+
+ KComboBox
+ QComboBox
+
+
diff --git a/effects/showfps/showfpsconfig.kcfgc b/effects/showfps/showfpsconfig.kcfgc
new file mode 100644
index 0000000000..c08427e13d
--- /dev/null
+++ b/effects/showfps/showfpsconfig.kcfgc
@@ -0,0 +1,5 @@
+File=showfps.kcfg
+ClassName=ShowFpsConfig
+NameSpace=KWin
+Singleton=true
+Mutators=true