diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt
index 317d67e617..30b731352f 100644
--- a/effects/CMakeLists.txt
+++ b/effects/CMakeLists.txt
@@ -91,6 +91,7 @@ set( kwin4_effect_builtins_sources
presentwindows/presentwindows_proxy.cpp
resize/resize.cpp
showfps/showfps.cpp
+ slide/slide.cpp
thumbnailaside/thumbnailaside.cpp
touchpoints/touchpoints.cpp
trackmouse/trackmouse.cpp
@@ -119,6 +120,7 @@ kconfig_add_kcfg_files(kwin4_effect_builtins_sources
presentwindows/presentwindowsconfig.kcfgc
resize/resizeconfig.kcfgc
showfps/showfpsconfig.kcfgc
+ slide/slideconfig.kcfgc
slidingpopups/slidingpopupsconfig.kcfgc
thumbnailaside/thumbnailasideconfig.kcfgc
trackmouse/trackmouseconfig.kcfgc
@@ -158,7 +160,7 @@ add_subdirectory( resize )
include( screenedge/CMakeLists.txt )
add_subdirectory( showfps )
include( showpaint/CMakeLists.txt )
-include( slide/CMakeLists.txt )
+add_subdirectory( slide )
include( slideback/CMakeLists.txt )
include( slidingpopups/CMakeLists.txt )
add_subdirectory( thumbnailaside )
diff --git a/effects/slide/CMakeLists.txt b/effects/slide/CMakeLists.txt
index 71b806f019..fa35bef2ae 100644
--- a/effects/slide/CMakeLists.txt
+++ b/effects/slide/CMakeLists.txt
@@ -1,7 +1,24 @@
#######################################
-# Effect
+# Config
+set(kwin_slide_config_SRCS slide_config.cpp)
+ki18n_wrap_ui(kwin_slide_config_SRCS slide_config.ui)
+qt5_add_dbus_interface(kwin_slide_config_SRCS ${kwin_effects_dbus_xml} kwineffects_interface)
+kconfig_add_kcfg_files(kwin_slide_config_SRCS slideconfig.kcfgc)
-# Source files
-set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
- slide/slide.cpp
- )
+add_library(kwin_slide_config MODULE ${kwin_slide_config_SRCS})
+
+target_link_libraries(kwin_slide_config
+ Qt5::DBus
+ KF5::ConfigWidgets
+ KF5::I18n
+ KF5::Service
+)
+
+kcoreaddons_desktop_to_json(kwin_slide_config slide_config.desktop SERVICE_TYPES kcmodule.desktop)
+
+install(
+ TARGETS
+ kwin_slide_config
+ DESTINATION
+ ${PLUGIN_INSTALL_DIR}/kwin/effects/configs
+)
diff --git a/effects/slide/slide.cpp b/effects/slide/slide.cpp
index ab2cbd6095..37e2d7d34a 100644
--- a/effects/slide/slide.cpp
+++ b/effects/slide/slide.cpp
@@ -20,6 +20,8 @@ along with this program. If not, see .
*********************************************************************/
#include "slide.h"
+// KConfigSkeleton
+#include "slideconfig.h"
#include
@@ -29,6 +31,7 @@ namespace KWin
SlideEffect::SlideEffect()
: slide(false)
{
+ initConfig();
connect(effects, SIGNAL(desktopChanged(int,int)), this, SLOT(slotDesktopChanged(int,int)));
connect(effects, &EffectsHandler::windowAdded, this, &SlideEffect::windowAdded);
connect(effects, &EffectsHandler::windowDeleted, this, [this](EffectWindow *w) {
@@ -45,7 +48,11 @@ bool SlideEffect::supported()
void SlideEffect::reconfigure(ReconfigureFlags)
{
- mTimeLine.setDuration(animationTime(250));
+ SlideConfig::self()->read();
+
+ const auto d = animationTime(
+ SlideConfig::duration() != 0 ? SlideConfig::duration() : 250);
+ mTimeLine.setDuration(d);
}
void SlideEffect::prePaintScreen(ScreenPrePaintData& data, int time)
diff --git a/effects/slide/slide.kcfg b/effects/slide/slide.kcfg
new file mode 100644
index 0000000000..a2230a5154
--- /dev/null
+++ b/effects/slide/slide.kcfg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ 0
+
+
+
diff --git a/effects/slide/slide_config.cpp b/effects/slide/slide_config.cpp
new file mode 100644
index 0000000000..fffb1b7e85
--- /dev/null
+++ b/effects/slide/slide_config.cpp
@@ -0,0 +1,64 @@
+/********************************************************************
+ KWin - the KDE window manager
+ This file is part of the KDE project.
+
+Copyright (C) 2017 Vlad Zagorodniy
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*********************************************************************/
+
+#include "slide_config.h"
+// KConfigSkeleton
+#include "slideconfig.h"
+#include
+
+#include
+
+#include
+#include
+
+K_PLUGIN_FACTORY_WITH_JSON(SlideEffectConfigFactory,
+ "slide_config.json",
+ registerPlugin();)
+
+namespace KWin
+{
+
+SlideEffectConfig::SlideEffectConfig(QWidget *parent, const QVariantList &args)
+ : KCModule(KAboutData::pluginData(QStringLiteral("slide")), parent, args)
+{
+ mUi.setupUi(this);
+ SlideConfig::instance(KWIN_CONFIG);
+ addConfig(SlideConfig::self(), this);
+
+ load();
+}
+
+SlideEffectConfig::~SlideEffectConfig()
+{
+}
+
+void SlideEffectConfig::save()
+{
+ KCModule::save();
+
+ OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"),
+ QStringLiteral("/Effects"),
+ QDBusConnection::sessionBus());
+ interface.reconfigureEffect(QStringLiteral("slide"));
+}
+
+} // namespace KWin
+
+#include "slide_config.moc"
diff --git a/effects/slide/slide_config.desktop b/effects/slide/slide_config.desktop
new file mode 100644
index 0000000000..c2866e36b6
--- /dev/null
+++ b/effects/slide/slide_config.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Service
+X-KDE-ServiceTypes=KCModule
+
+X-KDE-Library=kwin_slide_config
+X-KDE-ParentComponents=slide
+
+Name=Slide
+Name[x-test]=xxSlidexx
diff --git a/effects/slide/slide_config.h b/effects/slide/slide_config.h
new file mode 100644
index 0000000000..7022fe52bc
--- /dev/null
+++ b/effects/slide/slide_config.h
@@ -0,0 +1,47 @@
+/********************************************************************
+ KWin - the KDE window manager
+ This file is part of the KDE project.
+
+Copyright (C) 2017 Vlad Zagorodniy
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*********************************************************************/
+
+
+#ifndef SLIDE_CONFIG_H
+#define SLIDE_CONFIG_H
+
+#include
+#include "ui_slide_config.h"
+
+namespace KWin
+{
+
+class SlideEffectConfig : public KCModule
+{
+ Q_OBJECT
+
+public:
+ explicit SlideEffectConfig(QWidget *parent = 0, const QVariantList& args = QVariantList());
+ ~SlideEffectConfig();
+
+ void save();
+
+private:
+ ::Ui::SlideEffectConfig mUi;
+};
+
+} // namespace KWin
+
+#endif
diff --git a/effects/slide/slide_config.ui b/effects/slide/slide_config.ui
new file mode 100644
index 0000000000..3ffd35693c
--- /dev/null
+++ b/effects/slide/slide_config.ui
@@ -0,0 +1,53 @@
+
+
+ SlideEffectConfig
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ -
+
+
+ Duration:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ kcfg_Duration
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Default
+
+
+ milliseconds
+
+
+ 9999
+
+
+ 10
+
+
+
+
+
+
+
+
diff --git a/effects/slide/slideconfig.kcfgc b/effects/slide/slideconfig.kcfgc
new file mode 100644
index 0000000000..680f393cbc
--- /dev/null
+++ b/effects/slide/slideconfig.kcfgc
@@ -0,0 +1,5 @@
+File=slide.kcfg
+ClassName=SlideConfig
+NameSpace=KWin
+Singleton=true
+Mutators=true