diff --git a/effects/dashboard/CMakeLists.txt b/effects/dashboard/CMakeLists.txt index 792c87546e..54e8c47ea4 100644 --- a/effects/dashboard/CMakeLists.txt +++ b/effects/dashboard/CMakeLists.txt @@ -6,6 +6,8 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} dashboard/dashboard.cpp dashboard/dashboard.cpp ) +kde4_add_kcfg_files(kwin4_effect_builtins_sources dashboard/dashboardconfig.kcfgc) + # .desktop files install( FILES dashboard/dashboard.desktop @@ -19,6 +21,8 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources dashboard/dashboard_config.cpp dashboard/dashboard_config.ui ) +kde4_add_kcfg_files(kwin4_effect_builtins_config_sources dashboard/dashboardconfig.kcfgc) + install( FILES dashboard/dashboard_config.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) diff --git a/effects/dashboard/dashboard.cpp b/effects/dashboard/dashboard.cpp index 693f38fb7f..cbe792ccd3 100644 --- a/effects/dashboard/dashboard.cpp +++ b/effects/dashboard/dashboard.cpp @@ -19,6 +19,9 @@ along with this program. If not, see . *********************************************************************/ #include "dashboard.h" +// KConfigSkeleton +#include "dashboardconfig.h" + #include namespace KWin @@ -66,14 +69,10 @@ void DashboardEffect::unpropagate() void DashboardEffect::reconfigure(ReconfigureFlags) { - // read settings again - KConfigGroup config = EffectsHandler::effectConfig("Dashboard"); - - brightness = qreal(config.readEntry("Brightness", 50)) / 100.0; - saturation = qreal(config.readEntry("Saturation", 50)) / 100.0; - duration = config.readEntry("Duration", 500); - - blur = config.readEntry("Blur", false); + brightness = DashboardConfig::brightness()/ 100.0; + saturation = DashboardConfig::saturation()/ 100.0; + duration = DashboardConfig::duration() != 0 ? DashboardConfig::duration() : 500; + blur = DashboardConfig::blur(); timeline.setDuration(animationTime(duration)); } diff --git a/effects/dashboard/dashboard.kcfg b/effects/dashboard/dashboard.kcfg new file mode 100644 index 0000000000..9fbdf09c5a --- /dev/null +++ b/effects/dashboard/dashboard.kcfg @@ -0,0 +1,21 @@ + + + + + + 50 + + + 50 + + + 0 + + + false + + + diff --git a/effects/dashboard/dashboard_config.cpp b/effects/dashboard/dashboard_config.cpp index 7bdbdf9706..f1442c0c57 100644 --- a/effects/dashboard/dashboard_config.cpp +++ b/effects/dashboard/dashboard_config.cpp @@ -18,6 +18,9 @@ */ #include "dashboard_config.h" +// KConfigSkeleton +#include "dashboardconfig.h" + #include namespace KWin @@ -30,10 +33,7 @@ DashboardEffectConfig::DashboardEffectConfig(QWidget *parent, const QVariantList { ui.setupUi(this); - connect(ui.brightness, SIGNAL(valueChanged(int)), SLOT(changed())); - connect(ui.saturation, SIGNAL(valueChanged(int)), SLOT(changed())); - connect(ui.duration, SIGNAL(valueChanged(int)), SLOT(changed())); - connect(ui.blur, SIGNAL(stateChanged(int)), SLOT(changed())); + addConfig(DashboardConfig::self(), this); load(); } @@ -42,51 +42,12 @@ DashboardEffectConfig::~DashboardEffectConfig() { } -void DashboardEffectConfig::load() -{ - KCModule::load(); - KConfigGroup config = EffectsHandler::effectConfig("Dashboard"); - - const int brightness = config.readEntry("Brightness", 50); - ui.brightness->setValue(brightness); - - const int saturation = config.readEntry("Saturation", 50); - ui.saturation->setValue(saturation); - - const int duration = config.readEntry("Duration", 500); - ui.duration->setValue(duration); - - bool blur = config.readEntry("Blur", false); - ui.blur->setChecked(blur); - - emit changed(false); -} - void DashboardEffectConfig::save() { KCModule::save(); - KConfigGroup config = EffectsHandler::effectConfig("Dashboard"); - - config.writeEntry("Brightness", ui.brightness->value()); - config.writeEntry("Saturation", ui.saturation->value()); - config.writeEntry("Duration", ui.duration->value()); - config.writeEntry("Blur", ui.blur->isChecked()); - - config.sync(); - - emit changed(false); EffectsHandler::sendReloadMessage("dashboard"); } -void DashboardEffectConfig::defaults() -{ - ui.brightness->setValue(50); - ui.saturation->setValue(50); - ui.duration->setValue(500); - ui.blur->setChecked(false); - emit changed(true); -} - } // namespace KWin diff --git a/effects/dashboard/dashboard_config.h b/effects/dashboard/dashboard_config.h index a70beb8980..aaa09d6fb9 100644 --- a/effects/dashboard/dashboard_config.h +++ b/effects/dashboard/dashboard_config.h @@ -35,8 +35,6 @@ public: ~DashboardEffectConfig(); void save(); - void load(); - void defaults(); private: bool isBlurEffectAvailable(); diff --git a/effects/dashboard/dashboard_config.ui b/effects/dashboard/dashboard_config.ui index 83a3a6a543..7e8e07dd09 100644 --- a/effects/dashboard/dashboard_config.ui +++ b/effects/dashboard/dashboard_config.ui @@ -6,8 +6,8 @@ 0 0 - 197 - 183 + 239 + 189 @@ -44,7 +44,7 @@ - + 0 @@ -110,7 +110,7 @@ - + 0 @@ -166,7 +166,7 @@ - + 3000 @@ -188,7 +188,7 @@ - + The blur effect must be enabled before it can be used. diff --git a/effects/dashboard/dashboardconfig.kcfgc b/effects/dashboard/dashboardconfig.kcfgc new file mode 100644 index 0000000000..772ad03cbe --- /dev/null +++ b/effects/dashboard/dashboardconfig.kcfgc @@ -0,0 +1,5 @@ +File=dashboard.kcfg +ClassName=DashboardConfig +NameSpace=KWin +Singleton=true +Mutators=true