[Pkg-privacy-commits] [tails-installer] 22/27: Animate rectangle color changes

Intrigeri intrigeri at moszumanska.debian.org
Wed May 24 15:27:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to tag 3.91.0
in repository tails-installer.

commit a56d08153400fc099bf52e0b51b80f5d56d88e62
Author: Martin Briza <mbriza at redhat.com>
Date:   Tue Mar 15 16:41:20 2016 +0100

    Animate rectangle color changes
---
 liveusb/components/AdwaitaButton.qml    |  1 -
 liveusb/components/AdwaitaRectangle.qml | 66 +++++++++++++++++++--------------
 2 files changed, 38 insertions(+), 29 deletions(-)

diff --git a/liveusb/components/AdwaitaButton.qml b/liveusb/components/AdwaitaButton.qml
index dd4850b..ef9efa7 100644
--- a/liveusb/components/AdwaitaButton.qml
+++ b/liveusb/components/AdwaitaButton.qml
@@ -10,7 +10,6 @@ Button {
     style: ButtonStyle {
         background: AdwaitaRectangle {
             color: root.color
-            border.color: Qt.colorEqual(root.color, "transparent") ? "#212121" : control.enabled ? "#777777" : "#c2c2c2"
         }
         label: Item {
             implicitWidth: labelText.width + $(16)
diff --git a/liveusb/components/AdwaitaRectangle.qml b/liveusb/components/AdwaitaRectangle.qml
index f318f5e..0650c2c 100644
--- a/liveusb/components/AdwaitaRectangle.qml
+++ b/liveusb/components/AdwaitaRectangle.qml
@@ -1,40 +1,50 @@
 import QtQuick 2.0
 
-Rectangle {
-    id: rect
+Item {
+    id: root
     implicitHeight: $(36)
     implicitWidth: $(36)
-    radius: $(3)
+
+    property alias radius: rect.radius
+    property color color: palette.button
+
 
     Rectangle {
-        radius: parent.radius - $(1)
-        anchors.margins: $(0.5)
+        id: rect
         anchors.fill: parent
-        gradient: control.enabled ? !(control.pressed || control.checked) ? !control.hovered ? regularGradient: hoveredGradient : downGradient : disabledGradient
-        Gradient {
-            id: disabledGradient
-            GradientStop { position: 0.0; color: "light gray" }
-        }
-        Gradient {
-            id: regularGradient
-            GradientStop { position: 0.0; color: "#14ffffff" }
-            GradientStop { position: 1.0; color: "#14000000" }
-        }
-        Gradient {
-            id: hoveredGradient
-            GradientStop { position: 0.0; color: "#14ffffff" }
-            GradientStop { position: 1.0; color: "#05ffffff" }
-        }
-        Gradient {
-            id: downGradient
-            GradientStop { position: 0.0; color: "#1e000000" }
-            GradientStop { position: 1.0; color: "#14000000" }
+        radius: $(3)
+
+        readonly property int animationDuration: 150
+        color: control.enabled ? root.color : "light gray"
+        Behavior on color { ColorAnimation { duration: rect.animationDuration } }
+
+        border {
+            width: 1
+            color: Qt.colorEqual(root.color, "transparent") ? "#212121" : control.enabled ? "#777777" : "#c2c2c2"
         }
-    }
 
-    border {
-        width: 1
-        color: "#a1a1a1"
+        Rectangle {
+            id: overlay
+            radius: parent.radius - $(1)
+            anchors.margins: $(0.5)
+            anchors.fill: parent
+            //gradient: control.enabled ? !(control.pressed || control.checked) ? !control.hovered ? regularGradient: hoveredGradient : downGradient : disabledGradient
+            gradient: Gradient {
+                GradientStop {
+                    position: 0.0
+                    color: overlay.topColor
+                    Behavior on color { ColorAnimation { duration: 100 } }
+                }
+                GradientStop {
+                    position: 1.0
+                    color: overlay.bottomColor
+                    Behavior on color { ColorAnimation { duration: 100 } }
+                }
+            }
+
+            property color topColor: control.enabled ? !(control.pressed || control.checked) ? !control.hovered ?  "#14ffffff" : "#14ffffff" : "#1e000000" : "transparent"
+            property color bottomColor: control.enabled ? !(control.pressed || control.checked) ? !control.hovered ? "#14000000" : "#05ffffff" : "#14000000" : "transparent"
+        }
     }
 
     SystemPalette {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tails-installer.git



More information about the Pkg-privacy-commits mailing list