From 3723a2fd0878ca6f78c798b84271d26bfadfa04d Mon Sep 17 00:00:00 2001
From: Michail Vourlakos <mvourlakos@gmail.com>
Date: Mon, 2 Jan 2017 20:44:07 +0200
Subject: [PATCH] support durationTime through the configuration

---
 containment/contents/config/main.xml          |   9 ++
 containment/contents/ui/main.qml              |   4 +-
 plasmoid/contents/ui/main.qml                 |   2 +-
 .../configuration/AppearanceConfig.qml        | 110 ++++++++++++++++++
 4 files changed, 122 insertions(+), 3 deletions(-)

diff --git a/containment/contents/config/main.xml b/containment/contents/config/main.xml
index ba0af6dcb..21a0ab57c 100644
--- a/containment/contents/config/main.xml
+++ b/containment/contents/config/main.xml
@@ -66,5 +66,14 @@
     <entry name="reverseLinesPosition" type="Bool">
       <default>false</default>
     </entry>
+    <entry name="durationTime" type="Enum">
+      <choices>
+            <choice name="None"/>
+            <choice name="x1"/>
+            <choice name="x2"/>
+            <choice name="x3"/>
+      </choices>
+      <default>2</default>
+    </entry>
   </group>
 </kcfg>
diff --git a/containment/contents/ui/main.qml b/containment/contents/ui/main.qml
index e83086d30..87dd12f0b 100644
--- a/containment/contents/ui/main.qml
+++ b/containment/contents/ui/main.qml
@@ -82,7 +82,7 @@ DragDrop.DropArea {
                                                   ( plasmoid.configuration.panelPosition === Latte.Dock.Double ?
                                                        Latte.Dock.Center :plasmoid.configuration.panelPosition )
 
-    property real zoomFactor: windowSystem.compositingActive ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1
+    property real zoomFactor: (windowSystem.compositingActive && durationTime>0) ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1
 
     readonly property string plasmoidName: "org.kde.latte.plasmoid"
 
@@ -105,7 +105,7 @@ DragDrop.DropArea {
     property bool showGlow: plasmoid.configuration.showGlow
     property bool threeColorsWindows: plasmoid.configuration.threeColorsWindows
 
-    property int durationTime: nowDock ? nowDock.durationTime : 2
+    property int durationTime: plasmoid.configuration.durationTime
     property int nowDockHoveredIndex: nowDock ? nowDock.hoveredIndex : -1
     property int iconMargin: nowDock ? nowDock.iconMargin : 0.12 * iconSize
     property int statesLineSize: nowDock ? nowDock.statesLineSize : 0
diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml
index 38effbdb9..e41b57710 100644
--- a/plasmoid/contents/ui/main.qml
+++ b/plasmoid/contents/ui/main.qml
@@ -100,7 +100,7 @@ Item {
     property bool showGlow: nowDockPanel ? nowDockPanel.showGlow : plasmoid.configuration.showGlow
     property bool threeColorsWindows: nowDockPanel ? nowDockPanel.threeColorsWindows : plasmoid.configuration.threeColorsWindows
 
-    property int durationTime: plasmoid.configuration.durationTime
+    property int durationTime: nowDockPanel ? nowDockPanel.durationTime : plasmoid.configuration.durationTime
     property int iconSize: nowDockPanel ? nowDockPanel.iconSize : Math.max(plasmoid.configuration.iconSize, 16)
     property int tasksHeight: mouseHandler.height
     property int tasksWidth: mouseHandler.width
diff --git a/shell/contents/configuration/AppearanceConfig.qml b/shell/contents/configuration/AppearanceConfig.qml
index dbbee9488..03aa70ea5 100644
--- a/shell/contents/configuration/AppearanceConfig.qml
+++ b/shell/contents/configuration/AppearanceConfig.qml
@@ -90,6 +90,7 @@ PlasmaComponents.Page{
         Column{
             width: parent.width
             spacing: 0.8*theme.defaultFont.pointSize
+            enabled: plasmoid.configuration.durationTime > 0
             Header{
                 text: i18n("Zoom On Hover")
             }
@@ -153,6 +154,114 @@ PlasmaComponents.Page{
             }
         }
 
+        /**Animations Speed***/
+
+        Column{
+            width:parent.width
+            spacing: 0.8*theme.defaultFont.pointSize
+
+            Header{
+                text: i18n("Animations")
+            }
+
+            Flow{
+                width: parent.width
+                spacing: 2
+
+                property bool inStartup: true
+                property int duration: plasmoid.configuration.durationTime
+
+                onDurationChanged: updateDurationVisual();
+
+                Component.onCompleted: {
+                    updateDurationVisual();
+                    inStartup = false;
+                }
+
+                function updateDurationVisual(){
+                    if(duration === 0){
+                        firstDuration.checked = true;
+                        secondDuration.checked = false;
+                        thirdDuration.checked = false;
+                        fourthDuration.checked = false;
+                    }
+                    else if(duration === 1){
+                        firstDuration.checked = false;
+                        secondDuration.checked = true;
+                        thirdDuration.checked = false;
+                        fourthDuration.checked = false;
+                    }
+                    else if(duration === 2){
+                        firstDuration.checked = false;
+                        secondDuration.checked = false;
+                        thirdDuration.checked = true;
+                        fourthDuration.checked = false;
+                    }
+                    else if(duration === 3){
+                        firstDuration.checked = false;
+                        secondDuration.checked = false;
+                        thirdDuration.checked = false;
+                        fourthDuration.checked = true;
+                    }
+                }
+
+
+                PlasmaComponents.Button{
+                    id: firstDuration
+                    checkable: true
+                    text: i18n("None")
+                    width: (parent.width / 4) - 2
+
+                    onCheckedChanged: {
+                        if(checked && !parent.inStartup){
+                            plasmoid.configuration.durationTime = 0;
+                        }
+                    }
+                    onClicked: checked=true;
+                }
+                PlasmaComponents.Button{
+                    id: secondDuration
+                    checkable: true
+                    text: i18n("x1")
+                    width: (parent.width / 4) - 2
+
+                    onCheckedChanged: {
+                        if(checked && !parent.inStartup){
+                            plasmoid.configuration.durationTime = 1;
+                        }
+                    }
+                    onClicked: checked=true;
+                }
+                PlasmaComponents.Button{
+                    id: thirdDuration
+                    checkable: true
+                    text: i18n("x2")
+                    width: (parent.width / 4) - 2
+
+                    onCheckedChanged: {
+                        if(checked && !parent.inStartup){
+                            plasmoid.configuration.durationTime = 2;
+                        }
+                    }
+                    onClicked: checked=true;
+                }
+
+                PlasmaComponents.Button{
+                    id: fourthDuration
+                    checkable: true
+                    text: i18n("x3")
+                    width: (parent.width/4) - 1
+
+                    onCheckedChanged: {
+                        if(checked && !parent.inStartup){
+                            plasmoid.configuration.durationTime = 3;
+                        }
+                    }
+                    onClicked: checked=true;
+                }
+            }
+        }
+
 
         Column{
             width: parent.width
@@ -235,6 +344,7 @@ PlasmaComponents.Page{
             }
         }
 
+        /******Shadows**********/
         Column{
             width: parent.width
             spacing: 0.8*theme.defaultFont.pointSize