diff --git a/effects/cube/CMakeLists.txt b/effects/cube/CMakeLists.txt index 49ea572f02..d30612a617 100644 --- a/effects/cube/CMakeLists.txt +++ b/effects/cube/CMakeLists.txt @@ -8,6 +8,11 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} cube/cubeslide.cpp ) +kde4_add_kcfg_files(kwin4_effect_builtins_sources + cube/cubeslideconfig.kcfgc + cube/cubeconfig.kcfgc + ) + # .desktop files install( FILES cube/cube.desktop @@ -35,6 +40,11 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources cube/cubeslide_config.ui ) +kde4_add_kcfg_files(kwin4_effect_builtins_config_sources + cube/cubeslideconfig.kcfgc + cube/cubeconfig.kcfgc + ) + # .desktop files install( FILES cube/cube_config.desktop diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index bfd7263b59..4b1391776d 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -18,16 +18,15 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #include "cube.h" +// KConfigSkeleton +#include "cubeconfig.h" + #include "cube_inside.h" #include #include #include #include -#include -#include -#include -#include #include #include @@ -126,7 +125,7 @@ void CubeEffect::reconfigure(ReconfigureFlags) void CubeEffect::loadConfig(QString config) { - KConfigGroup conf = effects->effectConfig(config); + CubeConfig::self()->readConfig(); foreach (ElectricBorder border, borderActivate) { effects->unreserveElectricBorder(border); } @@ -141,49 +140,47 @@ void CubeEffect::loadConfig(QString config) borderActivateSphere.clear(); QList borderList = QList(); borderList.append(int(ElectricNone)); - borderList = conf.readEntry("BorderActivate", borderList); + borderList = CubeConfig::borderActivate(); foreach (int i, borderList) { borderActivate.append(ElectricBorder(i)); effects->reserveElectricBorder(ElectricBorder(i)); } borderList.clear(); borderList.append(int(ElectricNone)); - borderList = conf.readEntry("BorderActivateCylinder", borderList); + borderList = CubeConfig::borderActivateCylinder(); foreach (int i, borderList) { borderActivateCylinder.append(ElectricBorder(i)); effects->reserveElectricBorder(ElectricBorder(i)); } borderList.clear(); borderList.append(int(ElectricNone)); - borderList = conf.readEntry("BorderActivateSphere", borderList); + borderList = CubeConfig::borderActivateSphere(); foreach (int i, borderList) { borderActivateSphere.append(ElectricBorder(i)); effects->reserveElectricBorder(ElectricBorder(i)); } - cubeOpacity = (float)conf.readEntry("Opacity", 80) / 100.0f; - opacityDesktopOnly = conf.readEntry("OpacityDesktopOnly", false); - displayDesktopName = conf.readEntry("DisplayDesktopName", true); - reflection = conf.readEntry("Reflection", true); - rotationDuration = animationTime(conf, "RotationDuration", 500); - backgroundColor = conf.readEntry("BackgroundColor", QColor(Qt::black)); - capColor = conf.readEntry("CapColor", KColorScheme(QPalette::Active, KColorScheme::Window).background().color()); - paintCaps = conf.readEntry("Caps", true); - closeOnMouseRelease = conf.readEntry("CloseOnMouseRelease", false); - float defaultZPosition = 100.0f; - if (config == "Sphere") - defaultZPosition = 450.0f; - zPosition = conf.readEntry("ZPosition", defaultZPosition); - useForTabBox = conf.readEntry("TabBox", false); - invertKeys = conf.readEntry("InvertKeys", false); - invertMouse = conf.readEntry("InvertMouse", false); - capDeformationFactor = conf.readEntry("CapDeformation", 0) / 100.0f; - useZOrdering = conf.readEntry("ZOrdering", false); + cubeOpacity = (float)CubeConfig::opacity() / 100.0f; + opacityDesktopOnly = CubeConfig::opacityDesktopOnly(); + displayDesktopName = CubeConfig::displayDesktopName(); + reflection = CubeConfig::reflection(); + rotationDuration = animationTime(CubeConfig::rotationDuration() != 0 ? CubeConfig::rotationDuration() : 500); + backgroundColor = CubeConfig::backgroundColor(); + capColor = CubeConfig::capColor(); + paintCaps = CubeConfig::caps(); + closeOnMouseRelease = CubeConfig::closeOnMouseRelease(); + zPosition = CubeConfig::zPosition(); + + useForTabBox = CubeConfig::tabBox(); + invertKeys = CubeConfig::invertKeys(); + invertMouse = CubeConfig::invertMouse(); + capDeformationFactor = (float)CubeConfig::capDeformation() / 100.0f; + useZOrdering = CubeConfig::zOrdering(); delete wallpaper; wallpaper = NULL; delete capTexture; capTexture = NULL; - texturedCaps = conf.readEntry("TexturedCaps", true); + texturedCaps = CubeConfig::texturedCaps(); timeLine.setCurveShape(QTimeLine::EaseInOutCurve); timeLine.setDuration(rotationDuration); @@ -1902,14 +1899,13 @@ void CubeEffect::setActive(bool active) inside->setActive(true); } if (active) { - KConfigGroup conf = effects->effectConfig("Cube"); - QString capPath = conf.readEntry("CapPath", KGlobal::dirs()->findResource("appdata", "cubecap.png")); + QString capPath = CubeConfig::capPath(); if (texturedCaps && !capTexture && !capPath.isEmpty()) { QFutureWatcher *watcher = new QFutureWatcher(this); connect(watcher, SIGNAL(finished()), SLOT(slotCubeCapLoaded())); watcher->setFuture(QtConcurrent::run(this, &CubeEffect::loadCubeCap, capPath)); } - QString wallpaperPath = conf.readEntry("Wallpaper", QString("")); + QString wallpaperPath = CubeConfig::wallpaper().toLocalFile(); if (!wallpaper && !wallpaperPath.isEmpty()) { QFutureWatcher *watcher = new QFutureWatcher(this); connect(watcher, SIGNAL(finished()), SLOT(slotWallPaperLoaded())); diff --git a/effects/cube/cube.kcfg b/effects/cube/cube.kcfg new file mode 100644 index 0000000000..8b23c7a4cc --- /dev/null +++ b/effects/cube/cube.kcfg @@ -0,0 +1,65 @@ + + + + + + + + + + 0 + + + 80 + + + false + + + true + + + true + + + QColor(Qt::black) + + + QColor(KColorScheme(QPalette::Active, KColorScheme::Window).background().color()) + + + KGlobal::dirs()->findResource("appdata", "cubecap.png") + + + true + + + true + + + false + + + false + + + 100 + + + + 0 + + + false + + + false + + + false + + + diff --git a/effects/cube/cube_config.cpp b/effects/cube/cube_config.cpp index 9b6b803b4e..8e1134c25b 100644 --- a/effects/cube/cube_config.cpp +++ b/effects/cube/cube_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 "cube_config.h" +// KConfigSkeleton +#include "cubeconfig.h" + #include #include @@ -70,167 +73,31 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) : sphereAction->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut); m_ui->editor->addCollection(m_actionCollection); - - m_ui->wallpaperRequester->setFilter("*.png *.jpeg *.jpg "); - - connect(m_ui->rotationDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(changed())); - connect(m_ui->cubeOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(changed())); - connect(m_ui->cubeOpacitySpin, SIGNAL(valueChanged(int)), this, SLOT(changed())); - connect(m_ui->desktopOpacityOnlyBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->displayDesktopNameBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->reflectionBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->backgroundColorButton, SIGNAL(changed(QColor)), this, SLOT(changed())); - connect(m_ui->cubeCapsBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->cubeCapsBox, SIGNAL(stateChanged(int)), this, SLOT(capsSelectionChanged())); - connect(m_ui->capsImageBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->capColorButton, SIGNAL(changed(QColor)), this, SLOT(changed())); - connect(m_ui->wallpaperRequester, SIGNAL(textChanged(QString)), this, SLOT(changed())); - connect(m_ui->closeOnMouseReleaseBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->zPositionSlider, SIGNAL(valueChanged(int)), this, SLOT(changed())); - connect(m_ui->walkThroughDesktopBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->invertKeysBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->invertMouseBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->capDeformationSlider, SIGNAL(valueChanged(int)), this, SLOT(changed())); - connect(m_ui->zOrderingBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - + connect(m_ui->kcfg_Caps, SIGNAL(stateChanged(int)), this, SLOT(capsSelectionChanged())); + m_ui->kcfg_Wallpaper->setFilter("*.png *.jpeg *.jpg "); + addConfig(CubeConfig::self(), m_ui); load(); } -void CubeEffectConfig::load() -{ - KCModule::load(); - - KConfigGroup conf = EffectsHandler::effectConfig("Cube"); - - int duration = conf.readEntry("RotationDuration", 0); - float opacity = conf.readEntry("Opacity", 80); - bool desktopOpacityOnly = conf.readEntry("OpacityDesktopOnly", false); - bool desktopName = conf.readEntry("DisplayDesktopName", true); - bool reflection = conf.readEntry("Reflection", true); - QColor background = conf.readEntry("BackgroundColor", QColor(Qt::black)); - QColor capColor = conf.readEntry("CapColor", KColorScheme(QPalette::Active, KColorScheme::Window).background().color()); - bool texturedCaps = conf.readEntry("TexturedCaps", true); - bool caps = conf.readEntry("Caps", true); - bool closeOnMouseRelease = conf.readEntry("CloseOnMouseRelease", false); - bool walkThroughDesktop = conf.readEntry("TabBox", false); - m_ui->zPositionSlider->setValue(conf.readEntry("ZPosition", 100)); - m_ui->wallpaperRequester->setUrl(KUrl(conf.readEntry("Wallpaper", ""))); - bool invertKeys = conf.readEntry("InvertKeys", false); - bool invertMouse = conf.readEntry("InvertMouse", false); - m_ui->capDeformationSlider->setValue(conf.readEntry("CapDeformation", 0)); - bool zOrdering = conf.readEntry("ZOrdering", false); - - m_ui->rotationDurationSpin->setValue(duration); - m_ui->rotationDurationSpin->setSuffix(ki18np(" millisecond", " milliseconds")); - m_ui->cubeOpacitySlider->setValue(opacity); - m_ui->cubeOpacitySpin->setValue(opacity); - m_ui->desktopOpacityOnlyBox->setChecked(desktopOpacityOnly); - if (desktopName) { - m_ui->displayDesktopNameBox->setCheckState(Qt::Checked); - } else { - m_ui->displayDesktopNameBox->setCheckState(Qt::Unchecked); - } - if (reflection) { - m_ui->reflectionBox->setCheckState(Qt::Checked); - } else { - m_ui->reflectionBox->setCheckState(Qt::Unchecked); - } - if (caps) { - m_ui->cubeCapsBox->setCheckState(Qt::Checked); - } else { - m_ui->cubeCapsBox->setCheckState(Qt::Unchecked); - } - if (texturedCaps) { - m_ui->capsImageBox->setCheckState(Qt::Checked); - } else { - m_ui->capsImageBox->setCheckState(Qt::Unchecked); - } - if (closeOnMouseRelease) { - m_ui->closeOnMouseReleaseBox->setCheckState(Qt::Checked); - } else { - m_ui->closeOnMouseReleaseBox->setCheckState(Qt::Unchecked); - } - if (walkThroughDesktop) { - m_ui->walkThroughDesktopBox->setCheckState(Qt::Checked); - } else { - m_ui->walkThroughDesktopBox->setCheckState(Qt::Unchecked); - } - m_ui->backgroundColorButton->setColor(background); - m_ui->capColorButton->setColor(capColor); - m_ui->invertKeysBox->setChecked(invertKeys); - m_ui->invertMouseBox->setChecked(invertMouse); - m_ui->zOrderingBox->setChecked(zOrdering); - capsSelectionChanged(); - - emit changed(false); -} - void CubeEffectConfig::save() { - KConfigGroup conf = EffectsHandler::effectConfig("Cube"); - - conf.writeEntry("RotationDuration", m_ui->rotationDurationSpin->value()); - conf.writeEntry("DisplayDesktopName", m_ui->displayDesktopNameBox->checkState() == Qt::Checked ? true : false); - conf.writeEntry("Reflection", m_ui->reflectionBox->checkState() == Qt::Checked ? true : false); - conf.writeEntry("Opacity", m_ui->cubeOpacitySpin->value()); - conf.writeEntry("OpacityDesktopOnly", m_ui->desktopOpacityOnlyBox->isChecked()); - conf.writeEntry("BackgroundColor", m_ui->backgroundColorButton->color()); - conf.writeEntry("Caps", m_ui->cubeCapsBox->checkState() == Qt::Checked ? true : false); - conf.writeEntry("CapColor", m_ui->capColorButton->color()); - conf.writeEntry("TexturedCaps", m_ui->capsImageBox->checkState() == Qt::Checked ? true : false); - conf.writeEntry("CloseOnMouseRelease", m_ui->closeOnMouseReleaseBox->checkState() == Qt::Checked ? true : false); - conf.writeEntry("Wallpaper", m_ui->wallpaperRequester->url().path()); - conf.writeEntry("ZPosition", m_ui->zPositionSlider->value()); - conf.writeEntry("TabBox", m_ui->walkThroughDesktopBox->checkState() == Qt::Checked ? true : false); - conf.writeEntry("InvertKeys", m_ui->invertKeysBox->isChecked()); - conf.writeEntry("InvertMouse", m_ui->invertMouseBox->isChecked()); - conf.writeEntry("CapDeformation", m_ui->capDeformationSlider->value()); - conf.writeEntry("ZOrdering", m_ui->zOrderingBox->isChecked()); - + KCModule::save(); m_ui->editor->save(); - - conf.sync(); - - emit changed(false); EffectsHandler::sendReloadMessage("cube"); } -void CubeEffectConfig::defaults() -{ - m_ui->rotationDurationSpin->setValue(0); - m_ui->displayDesktopNameBox->setCheckState(Qt::Checked); - m_ui->reflectionBox->setCheckState(Qt::Checked); - m_ui->cubeOpacitySpin->setValue(80); - m_ui->cubeOpacitySlider->setValue(80); - m_ui->desktopOpacityOnlyBox->setChecked(false); - m_ui->backgroundColorButton->setColor(QColor(Qt::black)); - m_ui->cubeCapsBox->setCheckState(Qt::Checked); - m_ui->capColorButton->setColor(KColorScheme(QPalette::Active, KColorScheme::Window).background().color()); - m_ui->capsImageBox->setCheckState(Qt::Checked); - m_ui->closeOnMouseReleaseBox->setCheckState(Qt::Unchecked); - m_ui->wallpaperRequester->setUrl(KUrl("")); - m_ui->zPositionSlider->setValue(100); - m_ui->walkThroughDesktopBox->setCheckState(Qt::Unchecked); - m_ui->invertKeysBox->setChecked(false); - m_ui->invertMouseBox->setChecked(false); - m_ui->capDeformationSlider->setValue(0); - m_ui->zOrderingBox->setChecked(false); - m_ui->editor->allDefault(); - emit changed(true); -} - void CubeEffectConfig::capsSelectionChanged() { - if (m_ui->cubeCapsBox->checkState() == Qt::Checked) { + if (m_ui->kcfg_Caps->checkState() == Qt::Checked) { // activate cap color - m_ui->capColorButton->setEnabled(true); + m_ui->kcfg_CapColor->setEnabled(true); m_ui->capColorLabel->setEnabled(true); - m_ui->capsImageBox->setEnabled(true); + m_ui->kcfg_TexturedCaps->setEnabled(true); } else { // deactivate cap color - m_ui->capColorButton->setEnabled(false); + m_ui->kcfg_CapColor->setEnabled(false); m_ui->capColorLabel->setEnabled(false); - m_ui->capsImageBox->setEnabled(false); + m_ui->kcfg_TexturedCaps->setEnabled(false); } } diff --git a/effects/cube/cube_config.h b/effects/cube/cube_config.h index 8281f9a3fc..b231732fcb 100644 --- a/effects/cube/cube_config.h +++ b/effects/cube/cube_config.h @@ -44,8 +44,6 @@ public: public slots: virtual void save(); - virtual void load(); - virtual void defaults(); private slots: void capsSelectionChanged(); diff --git a/effects/cube/cube_config.ui b/effects/cube/cube_config.ui index 6e9d3003f7..2d9a00d3a2 100644 --- a/effects/cube/cube_config.ui +++ b/effects/cube/cube_config.ui @@ -1,7 +1,8 @@ - + + KWin::CubeEffectConfigForm - - + + 0 0 @@ -9,63 +10,63 @@ 566 - + - - + + 0 - - + + Tab 1 - - - - + + + + Background - - - - + + + + Background color: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - backgroundColorButton + + kcfg_BackgroundColor - - - - + + + + 0 0 - - - + + + Wallpaper: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - wallpaperRequester + + kcfg_Wallpaper - - - - + + + + 0 0 @@ -75,15 +76,15 @@ - - - + + + Activation - - - - + + + + 0 200 @@ -94,70 +95,70 @@ - - - + + + Appearance - - - - + + + + Display desktop name - - - + + + Reflection - - - + + + Rotation duration: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - rotationDurationSpin + + kcfg_RotationDuration - - - - + + + + 0 0 - + 100 0 - - Default + + Default - + 5000 - + 10 - - - + + + Qt::Vertical - + 20 0 @@ -165,9 +166,9 @@ - - - + + + Windows hover above cube @@ -175,79 +176,79 @@ - - - + + + Opacity - - - - + + + + 200 0 - + 100 - + 1 - + 100 - + Qt::Horizontal - + QSlider::TicksBelow - + 10 - - - + + + 75 0 - + % - + 100 - + 100 - - - + + + Transparent - - - + + + Opaque - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - + + + Do not change opacity of windows @@ -255,12 +256,12 @@ - - - + + + Qt::Vertical - + 20 40 @@ -270,60 +271,60 @@ - - + + Tab 2 - - - - + + + + Caps - - - - + + + + Show caps - - - + + + Cap color: - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - capColorButton + + kcfg_CapColor - - - - + + + + 0 0 - - - + + + Display image on caps - - - + + + Qt::Vertical - + 20 40 @@ -334,50 +335,50 @@ - - - + + + Zoom - - - - + + + + Near - - - + + + Far - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - + + + Define how far away the object should appear - + 3000 - + 10 - + 100 - + Qt::Horizontal - + QSlider::TicksBelow - + 100 @@ -385,12 +386,12 @@ - - - + + + Qt::Vertical - + 20 0 @@ -398,40 +399,40 @@ - - - + + + Additional Options - + - - + + If enabled the effect will be deactivated after rotating the cube with the mouse, otherwise it will remain active - + Close after mouse dragging - - + + Use this effect for walking through the desktops - - + + Invert cursor keys - - + + Invert mouse @@ -439,41 +440,41 @@ otherwise it will remain active - - - + + + Sphere Cap Deformation - - - - + + + + 100 - + Qt::Horizontal - + QSlider::TicksBelow - + 25 - - - + + + Sphere - - - + + + Plane - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -507,62 +508,62 @@ otherwise it will remain active KWin::GlobalShortcutsEditor QWidget -
kwineffects.h
+
kwineffects.h
1
tabWidget - displayDesktopNameBox - reflectionBox - zOrderingBox - rotationDurationSpin - cubeOpacitySlider - cubeOpacitySpin - desktopOpacityOnlyBox - backgroundColorButton - wallpaperRequester - cubeCapsBox - capColorButton - capsImageBox - closeOnMouseReleaseBox - walkThroughDesktopBox - invertKeysBox - invertMouseBox - zPositionSlider - capDeformationSlider + kcfg_DisplayDesktopName + kcfg_Reflection + kcfg_ZOrdering + kcfg_RotationDuration + kcfg_Opacity + kcfg_OpacitySpin + kcfg_OpacityDesktopOnly + kcfg_BackgroundColor + kcfg_Wallpaper + kcfg_Caps + kcfg_CapColor + kcfg_TexturedCaps + kcfg_CloseOnMouseRelease + kcfg_TabBox + kcfg_InvertKeys + kcfg_InvertMouse + kcfg_ZPosition + kcfg_CapDeformation - cubeOpacitySpin + kcfg_OpacitySpin valueChanged(int) - cubeOpacitySlider + kcfg_Opacity setValue(int) - - 725 - 102 + + 727 + 85 - - 568 - 101 + + 611 + 88 - cubeOpacitySlider + kcfg_Opacity valueChanged(int) - cubeOpacitySpin + kcfg_OpacitySpin setValue(int) - - 466 - 101 + + 611 + 88 - - 725 - 102 + + 727 + 85 diff --git a/effects/cube/cubeconfig.kcfgc b/effects/cube/cubeconfig.kcfgc new file mode 100644 index 0000000000..44a166b6be --- /dev/null +++ b/effects/cube/cubeconfig.kcfgc @@ -0,0 +1,6 @@ +File=cube.kcfg +ClassName=CubeConfig +NameSpace=KWin +Singleton=true +Mutators=true +IncludeFiles=kcolorscheme.h,KDE/KStandardDirs diff --git a/effects/cube/cubeslide.cpp b/effects/cube/cubeslide.cpp index 40763ef65d..1d0f02fc73 100644 --- a/effects/cube/cubeslide.cpp +++ b/effects/cube/cubeslide.cpp @@ -19,9 +19,10 @@ along with this program. If not, see . *********************************************************************/ #include "cubeslide.h" +// KConfigSkeleton +#include "cubeslideconfig.h" #include -#include #include @@ -55,14 +56,14 @@ bool CubeSlideEffect::supported() void CubeSlideEffect::reconfigure(ReconfigureFlags) { - KConfigGroup conf = effects->effectConfig("CubeSlide"); - rotationDuration = animationTime(conf, "RotationDuration", 500); + CubeSlideConfig::self()->readConfig(); + rotationDuration = animationTime(CubeSlideConfig::rotationDuration() != 0 ? CubeSlideConfig::rotationDuration() : 500); timeLine.setCurveShape(QTimeLine::EaseInOutCurve); timeLine.setDuration(rotationDuration); - dontSlidePanels = conf.readEntry("DontSlidePanels", true); - dontSlideStickyWindows = conf.readEntry("DontSlideStickyWindows", false); - usePagerLayout = conf.readEntry("UsePagerLayout", true); - useWindowMoving = conf.readEntry("UseWindowMoving", false); + dontSlidePanels = CubeSlideConfig::dontSlidePanels(); + dontSlideStickyWindows = CubeSlideConfig::dontSlideStickyWindows(); + usePagerLayout = CubeSlideConfig::usePagerLayout(); + useWindowMoving = CubeSlideConfig::useWindowMoving(); } void CubeSlideEffect::prePaintScreen(ScreenPrePaintData& data, int time) diff --git a/effects/cube/cubeslide.kcfg b/effects/cube/cubeslide.kcfg new file mode 100644 index 0000000000..03f6eb53db --- /dev/null +++ b/effects/cube/cubeslide.kcfg @@ -0,0 +1,25 @@ + + + + + + + 0 + + + true + + + false + + + true + + + false + + + diff --git a/effects/cube/cubeslide_config.cpp b/effects/cube/cubeslide_config.cpp index 6fe19834d4..d607ce092f 100644 --- a/effects/cube/cubeslide_config.cpp +++ b/effects/cube/cubeslide_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 "cubeslide_config.h" +// KConfigSkeleton +#include "cubeslideconfig.h" + #include #include @@ -42,61 +45,17 @@ CubeSlideEffectConfig::CubeSlideEffectConfig(QWidget* parent, const QVariantList layout->addWidget(m_ui); - connect(m_ui->rotationDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(changed())); - connect(m_ui->dontSlidePanelsBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->dontSlideStickyWindowsBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->usePagerBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); - connect(m_ui->windowsMovingBox, SIGNAL(stateChanged(int)), SLOT(changed())); + addConfig(CubeSlideConfig::self(), m_ui); load(); } -void CubeSlideEffectConfig::load() -{ - KCModule::load(); - - KConfigGroup conf = EffectsHandler::effectConfig("CubeSlide"); - - int duration = conf.readEntry("RotationDuration", 0); - bool dontSlidePanels = conf.readEntry("DontSlidePanels", true); - bool dontSlideStickyWindows = conf.readEntry("DontSlideStickyWindows", false); - bool usePager = conf.readEntry("UsePagerLayout", true); - - m_ui->rotationDurationSpin->setValue(duration); - m_ui->dontSlidePanelsBox->setChecked(dontSlidePanels); - m_ui->dontSlideStickyWindowsBox->setChecked(dontSlideStickyWindows); - m_ui->usePagerBox->setChecked(usePager); - m_ui->windowsMovingBox->setChecked(conf.readEntry("UseWindowMoving", false)); - - emit changed(false); -} - void CubeSlideEffectConfig::save() { - KConfigGroup conf = EffectsHandler::effectConfig("CubeSlide"); - - conf.writeEntry("RotationDuration", m_ui->rotationDurationSpin->value()); - conf.writeEntry("DontSlidePanels", m_ui->dontSlidePanelsBox->isChecked()); - conf.writeEntry("DontSlideStickyWindows", m_ui->dontSlideStickyWindowsBox->isChecked()); - conf.writeEntry("UsePagerLayout", m_ui->usePagerBox->isChecked()); - conf.writeEntry("UseWindowMoving", m_ui->windowsMovingBox->isChecked()); - - conf.sync(); - - emit changed(false); + KCModule::save(); EffectsHandler::sendReloadMessage("cubeslide"); } -void CubeSlideEffectConfig::defaults() -{ - m_ui->rotationDurationSpin->setValue(0); - m_ui->dontSlidePanelsBox->setChecked(true); - m_ui->dontSlideStickyWindowsBox->setChecked(false); - m_ui->usePagerBox->setChecked(true); - m_ui->windowsMovingBox->setChecked(false); - emit changed(true); -} - } // namespace #include "cubeslide_config.moc" diff --git a/effects/cube/cubeslide_config.h b/effects/cube/cubeslide_config.h index 4cfc76d884..f04bd1bd36 100644 --- a/effects/cube/cubeslide_config.h +++ b/effects/cube/cubeslide_config.h @@ -44,8 +44,7 @@ public: public slots: virtual void save(); - virtual void load(); - virtual void defaults(); + private: CubeSlideEffectConfigForm* m_ui; }; diff --git a/effects/cube/cubeslide_config.ui b/effects/cube/cubeslide_config.ui index 935993bc05..b9582781a1 100644 --- a/effects/cube/cubeslide_config.ui +++ b/effects/cube/cubeslide_config.ui @@ -12,7 +12,7 @@
- + Do not animate windows on all desktops @@ -32,7 +32,7 @@
- + 0 @@ -60,7 +60,7 @@ - + Do not animate panels @@ -75,19 +75,19 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- rotationDurationSpin + kcfg_RotationDuration
- + Use pager layout for animation - + Start animation when moving windows towards screen edges @@ -103,9 +103,9 @@ - rotationDurationSpin - dontSlidePanelsBox - dontSlideStickyWindowsBox + kcfg_RotationDuration + kcfg_DontSlidePanels + kcfg_DontSlideStickyWindows diff --git a/effects/cube/cubeslideconfig.kcfgc b/effects/cube/cubeslideconfig.kcfgc new file mode 100644 index 0000000000..6059a7e3e2 --- /dev/null +++ b/effects/cube/cubeslideconfig.kcfgc @@ -0,0 +1,5 @@ +File=cubeslide.kcfg +ClassName=CubeSlideConfig +NameSpace=KWin +Singleton=true +Mutators=true