commit 3163943905e5b373de1d4e5048798bebc659cef7 Author: David Edmundson Date: Mon Jul 22 15:48:04 2019 +0200 animationspeed diff --git a/kcmkwin/kwinrules/CMakeLists.txt b/kcmkwin/kwinrules/CMakeLists.txt index 34bc7cbac..9a4823581 100644 --- a/kcmkwin/kwinrules/CMakeLists.txt +++ b/kcmkwin/kwinrules/CMakeLists.txt @@ -24,6 +24,7 @@ set(kcm_libs Qt5::Concurrent Qt5::X11Extras KF5::Completion + KF5::ConfigCore KF5::ConfigWidgets KF5::I18n KF5::Service diff --git a/kwin.kcfg b/kwin.kcfg index 2203dbfa7..c36bc55af 100644 --- a/kwin.kcfg +++ b/kwin.kcfg @@ -248,11 +248,6 @@ 4 6 - - 3 - 0 - 6 - glx @@ -301,4 +296,10 @@ thumbnails + + + 1 + 0 + + diff --git a/options.cpp b/options.cpp index 7af5093b3..6bdf830c4 100644 --- a/options.cpp +++ b/options.cpp @@ -150,6 +150,13 @@ Options::Options(QObject *parent) { m_settings->setDefaults(); syncFromKcfgc(); + + m_configWatcher = KConfigWatcher::create(m_settings->config()); + connect(m_configWatcher, this, [this](const KConfigGroup &group, const QByteArrayList &names) { + if (group.name() == QLatin1String("KDE") && names.contains(QLatin1String("AnimationSpeed"))) { + + } + } } Options::~Options() @@ -966,9 +973,6 @@ void Options::reloadCompositingSettings(bool force) previews = HiddenPreviewsAlways; setHiddenPreviews(previews); - // TOOD: add setter - animationSpeed = qBound(0, config.readEntry("AnimationSpeed", Options::defaultAnimationSpeed()), 6); - auto interfaceToKey = [](OpenGLPlatformInterface interface) { switch (interface) { case GlxPlatformInterface: @@ -1099,8 +1103,7 @@ Options::MouseCommand Options::wheelToMouseCommand(MouseWheelCommand com, int de double Options::animationTimeFactor() const { - const double factors[] = { 0, 0.2, 0.5, 1, 2, 4, 20 }; - return factors[ animationSpeed ]; + return m_settings->animationSpeed(); } Options::WindowOperation Options::operationMaxButtonClick(Qt::MouseButtons button) const diff --git a/options.h b/options.h index 112ba9442..2991ddc55 100644 --- a/options.h +++ b/options.h @@ -26,6 +26,8 @@ along with this program. If not, see . #include "main.h" #include "placement.h" +#include + namespace KWin { @@ -765,9 +767,6 @@ public: static OpenGLPlatformInterface defaultGlPlatformInterface() { return kwinApp()->shouldUseWaylandForCompositing() ? EglPlatformInterface : GlxPlatformInterface; }; - static int defaultAnimationSpeed() { - return 3; - } /** * Performs loading all settings except compositing related. @@ -851,6 +850,8 @@ private: void setElectricBorders(int borders); void syncFromKcfgc(); QScopedPointer m_settings; + KConfigWatcher::Ptr m_configWatcher; + FocusPolicy m_focusPolicy; bool m_nextFocusPrefersMouse; bool m_clickRaise; @@ -918,7 +919,6 @@ private: bool borderless_maximized_windows; bool show_geometry_tip; bool condensed_title; - int animationSpeed; // 0 - instant, 5 - very slow QHash m_modifierOnlyShortcuts;