Paste P443

Masterwork From Distant Lands
ActivePublic

Authored by davidedmundson on Aug 1 2019, 9:24 PM.
commit 3163943905e5b373de1d4e5048798bebc659cef7
Author: David Edmundson <kde@davidedmundson.co.uk>
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 @@
<min>4</min>
<max>6</max>
</entry>
- <entry name="AnimationSpeed" type="Int">
- <default>3</default>
- <min>0</min>
- <max>6</max>
- </entry>
<entry name="GLPlatformInterface" type="String">
<default>glx</default>
</entry>
@@ -301,4 +296,10 @@
<default>thumbnails</default>
</entry>
</group>
+ <group name="KDE">
+ <entry name="AnimationSpeed" type="Double">
+ <default>1</default>
+ <min>0</min>
+ </entry>
+ </group>
</kcfg>
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 <http://www.gnu.org/licenses/>.
#include "main.h"
#include "placement.h"
+#include <KConfigWatcher>
+
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<Settings> 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<Qt::KeyboardModifier, QStringList> m_modifierOnlyShortcuts;
davidedmundson edited the content of this paste. (Show Details)Aug 1 2019, 9:24 PM
davidedmundson changed the title of this paste from untitled to Masterwork From Distant Lands.