diff --git a/effects/flipswitch/CMakeLists.txt b/effects/flipswitch/CMakeLists.txt
index e838c607be..ec90ca5ad0 100644
--- a/effects/flipswitch/CMakeLists.txt
+++ b/effects/flipswitch/CMakeLists.txt
@@ -6,6 +6,8 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
flipswitch/flipswitch.cpp
)
+kde4_add_kcfg_files(kwin4_effect_builtins_sources flipswitch/flipswitchconfig.kcfgc)
+
# .desktop files
install( FILES
flipswitch/flipswitch.desktop
@@ -20,6 +22,8 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources
flipswitch/flipswitch_config.ui
)
+kde4_add_kcfg_files(kwin4_effect_builtins_config_sources flipswitch/flipswitchconfig.kcfgc)
+
# .desktop files
install( FILES
flipswitch/flipswitch_config.desktop
diff --git a/effects/flipswitch/flipswitch.cpp b/effects/flipswitch/flipswitch.cpp
index 78fdca621c..a88a6d3933 100644
--- a/effects/flipswitch/flipswitch.cpp
+++ b/effects/flipswitch/flipswitch.cpp
@@ -18,12 +18,13 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*********************************************************************/
#include "flipswitch.h"
+// KConfigSkeleton
+#include "flipswitchconfig.h"
#include
#include
#include
#include
-#include
#include
#include
@@ -94,7 +95,7 @@ bool FlipSwitchEffect::supported()
void FlipSwitchEffect::reconfigure(ReconfigureFlags)
{
- KConfigGroup conf = effects->effectConfig("FlipSwitch");
+ FlipSwitchConfig::self()->readConfig();
foreach (ElectricBorder border, m_borderActivate) {
effects->unreserveElectricBorder(border);
}
@@ -103,30 +104,24 @@ void FlipSwitchEffect::reconfigure(ReconfigureFlags)
}
m_borderActivate.clear();
m_borderActivateAll.clear();
- QList borderList = QList();
- borderList.append(int(ElectricNone));
- borderList = conf.readEntry("BorderActivate", borderList);
- foreach (int i, borderList) {
+ foreach (int i, FlipSwitchConfig::borderActivate()) {
m_borderActivate.append(ElectricBorder(i));
effects->reserveElectricBorder(ElectricBorder(i));
}
- borderList.clear();
- borderList.append(int(ElectricNone));
- borderList = conf.readEntry("BorderActivateAll", borderList);
- foreach (int i, borderList) {
+ foreach (int i, FlipSwitchConfig::borderActivateAll()) {
m_borderActivateAll.append(ElectricBorder(i));
effects->reserveElectricBorder(ElectricBorder(i));
}
- m_tabbox = conf.readEntry("TabBox", false);
- m_tabboxAlternative = conf.readEntry("TabBoxAlternative", false);
- float duration = animationTime(conf, "Duration", 200);
+ m_tabbox = FlipSwitchConfig::tabBox();
+ m_tabboxAlternative = FlipSwitchConfig::tabBoxAlternative();
+ const int duration = animationTime(FlipSwitchConfig::duration() != 0 ? FlipSwitchConfig::duration() : 200);
m_timeLine.setDuration(duration);
m_startStopTimeLine.setDuration(duration);
- m_angle = conf.readEntry("Angle", 30);
- m_xPosition = float(conf.readEntry("XPosition", 33)) / 100.0f;
- m_yPosition = float(conf.readEntry("YPosition", 100)) / 100.0f;
- m_windowTitle = conf.readEntry("WindowTitle", true);
+ m_angle = FlipSwitchConfig::angle();
+ m_xPosition = FlipSwitchConfig::xPosition() / 100.0f;
+ m_yPosition = FlipSwitchConfig::yPosition() / 100.0f;
+ m_windowTitle = FlipSwitchConfig::windowTitle();
}
void FlipSwitchEffect::prePaintScreen(ScreenPrePaintData& data, int time)
diff --git a/effects/flipswitch/flipswitch.kcfg b/effects/flipswitch/flipswitch.kcfg
new file mode 100644
index 0000000000..94611c11b1
--- /dev/null
+++ b/effects/flipswitch/flipswitch.kcfg
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+ false
+
+
+ false
+
+
+ 0
+
+
+ 30
+
+
+ 33
+
+
+ 100
+
+
+ true
+
+
+
diff --git a/effects/flipswitch/flipswitch_config.cpp b/effects/flipswitch/flipswitch_config.cpp
index 4e9560c7d3..7b105db9d8 100644
--- a/effects/flipswitch/flipswitch_config.cpp
+++ b/effects/flipswitch/flipswitch_config.cpp
@@ -18,6 +18,9 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*********************************************************************/
#include "flipswitch_config.h"
+// KConfigSkeleton
+#include "flipswitchconfig.h"
+
#include
#include
@@ -59,12 +62,7 @@ FlipSwitchEffectConfig::FlipSwitchEffectConfig(QWidget* parent, const QVariantLi
m_ui->shortcutEditor->addCollection(m_actionCollection);
- connect(m_ui->durationSpin, SIGNAL(valueChanged(int)), SLOT(changed()));
- connect(m_ui->angleSpin, SIGNAL(valueChanged(int)), SLOT(changed()));
- connect(m_ui->horizontalSlider, SIGNAL(valueChanged(int)), SLOT(changed()));
- connect(m_ui->verticalSlider, SIGNAL(valueChanged(int)), SLOT(changed()));
- connect(m_ui->windowTitleBox, SIGNAL(stateChanged(int)), SLOT(changed()));
- connect(m_ui->shortcutEditor, SIGNAL(keyChange()), this, SLOT(changed()));
+ addConfig(FlipSwitchConfig::self(), m_ui);
load();
}
@@ -73,53 +71,13 @@ FlipSwitchEffectConfig::~FlipSwitchEffectConfig()
{
}
-void FlipSwitchEffectConfig::load()
-{
- KCModule::load();
-
- KConfigGroup conf = EffectsHandler::effectConfig("FlipSwitch");
-
- m_ui->durationSpin->setValue(conf.readEntry("Duration", 0));
- m_ui->angleSpin->setValue(conf.readEntry("Angle", 30));
- m_ui->horizontalSlider->setValue(conf.readEntry("XPosition", 33));
- // slider bottom is 0, effect bottom is 100
- m_ui->verticalSlider->setValue(100 - conf.readEntry("YPosition", 100));
- m_ui->windowTitleBox->setChecked(conf.readEntry("WindowTitle", true));
-
- emit changed(false);
-}
-
void FlipSwitchEffectConfig::save()
{
- KConfigGroup conf = EffectsHandler::effectConfig("FlipSwitch");
+ KCModule::save();
- conf.writeEntry("Duration", m_ui->durationSpin->value());
- conf.writeEntry("Angle", m_ui->angleSpin->value());
- conf.writeEntry("XPosition", m_ui->horizontalSlider->value());
- // slider bottom is 0, effect bottom is 100
- conf.writeEntry("YPosition", 100 - m_ui->verticalSlider->value());
- conf.writeEntry("WindowTitle", m_ui->windowTitleBox->isChecked());
-
- m_ui->shortcutEditor->save();
-
- conf.sync();
-
- emit changed(false);
EffectsHandler::sendReloadMessage("flipswitch");
}
-void FlipSwitchEffectConfig::defaults()
-{
- m_ui->durationSpin->setValue(0);
- m_ui->angleSpin->setValue(30);
- m_ui->horizontalSlider->setValue(33);
- // slider bottom is 0, effect bottom is 100
- m_ui->verticalSlider->setValue(0);
- m_ui->windowTitleBox->setChecked(true);
- m_ui->shortcutEditor->allDefault();
- emit changed(true);
-}
-
} // namespace
diff --git a/effects/flipswitch/flipswitch_config.h b/effects/flipswitch/flipswitch_config.h
index 3ae7bbe0db..d53d8ed608 100644
--- a/effects/flipswitch/flipswitch_config.h
+++ b/effects/flipswitch/flipswitch_config.h
@@ -46,8 +46,6 @@ public:
public slots:
virtual void save();
- virtual void load();
- virtual void defaults();
private:
FlipSwitchEffectConfigForm* m_ui;
diff --git a/effects/flipswitch/flipswitch_config.ui b/effects/flipswitch/flipswitch_config.ui
index 4e0ce3d717..a36ed096ee 100644
--- a/effects/flipswitch/flipswitch_config.ui
+++ b/effects/flipswitch/flipswitch_config.ui
@@ -26,12 +26,12 @@
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- durationSpin
+ kcfg_Duration
-
-
+
0
@@ -55,12 +55,12 @@
Angle:
- angleSpin
+ kcfg_Angle
-
-
+
0
@@ -81,14 +81,14 @@
Horizontal position of front:
- horizontalSlider
+ kcfg_XPosition
-
-
-
+
100
@@ -136,14 +136,14 @@
Vertical position of front:
- verticalSlider
+ kcfg_YPosition
-
-
-
+
100
@@ -186,7 +186,7 @@
-
-
+
Display window &titles
@@ -233,7 +233,7 @@
- durationSpin
+ kcfg_Duration
diff --git a/effects/flipswitch/flipswitchconfig.kcfgc b/effects/flipswitch/flipswitchconfig.kcfgc
new file mode 100644
index 0000000000..15fb710535
--- /dev/null
+++ b/effects/flipswitch/flipswitchconfig.kcfgc
@@ -0,0 +1,5 @@
+File=flipswitch.kcfg
+ClassName=FlipSwitchConfig
+NameSpace=KWin
+Singleton=true
+Mutators=true