~aacid/unity8/fix_cropped_image_binding_loop

« back to all changes in this revision

Viewing changes to qml/Notifications/SwipeToAct.qml

  • Committer: CI Train Bot
  • Author(s): Lukáš Tinkl
  • Date: 2015-09-25 12:12:43 UTC
  • mfrom: (1968.2.6 clickNotifications)
  • Revision ID: ci-train-bot@canonical.com-20150925121243-teq4pdo0mdp6uqxd
Using InputInfo, determine if we need swipe or click to dismiss the notifications (e.g. incoming phone call)
Approved by: Michael Zanetti

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 20014-2015 Canonical, Ltd.
 
2
 * Copyright (C) 2014-2015 Canonical, Ltd.
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
5
5
 * it under the terms of the GNU General Public License as published by
15
15
 */
16
16
 
17
17
import QtQuick 2.3
18
 
import Ubuntu.Components 1.1
 
18
import Ubuntu.Components 1.2
19
19
 
20
20
Item {
21
21
    id: swipeToAct
22
22
 
23
 
    height: childrenRect.height
 
23
    height: clickToAct ? leftButton.height : childrenRect.height
24
24
 
25
25
    signal leftTriggered()
26
26
    signal rightTriggered()
28
28
    property string leftIconName
29
29
    property string rightIconName
30
30
 
 
31
    property bool clickToAct
 
32
 
31
33
    QtObject {
32
34
        id: priv
33
35
 
64
66
        }
65
67
    }
66
68
 
 
69
    Button {
 
70
        id: leftButton
 
71
        objectName: "leftButton"
 
72
        anchors.verticalCenter: parent.verticalCenter
 
73
        anchors.left: parent.left
 
74
        iconName: leftIconName
 
75
        visible: clickToAct
 
76
        width: (parent.width / 2) - priv.gap
 
77
        color: UbuntuColors.red
 
78
        onClicked: {
 
79
            leftTriggered()
 
80
        }
 
81
    }
 
82
 
 
83
    Button {
 
84
        id: rightButton
 
85
        objectName: "rightButton"
 
86
        anchors.verticalCenter: parent.verticalCenter
 
87
        anchors.right: parent.right
 
88
        iconName: rightIconName
 
89
        visible: clickToAct
 
90
        width: (parent.width / 2) - priv.gap
 
91
        color: UbuntuColors.green
 
92
        onClicked: {
 
93
            rightTriggered()
 
94
        }
 
95
    }
 
96
 
67
97
    UbuntuShape {
68
98
        id: row
69
99
        width: parent.width
70
100
        height: priv.sliderHeight
71
101
        color: priv.sliderBGColor
72
102
        borderSource: "none"
 
103
        visible: !clickToAct
73
104
 
74
105
        UbuntuShape {
75
106
            id: leftShape
 
107
            objectName: "leftArea"
76
108
            anchors.top: parent.top
77
109
            anchors.left: parent.left
78
110
            anchors.margins: priv.gap
167
199
                color: "white"
168
200
            }
169
201
        }
 
202
 
170
203
        Row {
171
204
            anchors.verticalCenter: parent.verticalCenter
172
205
            anchors.left: slider.right
189
222
 
190
223
        UbuntuShape {
191
224
            id: rightShape
 
225
            objectName: "rightArea"
192
226
            anchors.top: parent.top
193
227
            anchors.right: parent.right
194
228
            anchors.margins: priv.gap
214
248
    MouseArea {
215
249
        id: mouseArea
216
250
        objectName: "swipeMouseArea"
 
251
        enabled: !clickToAct
217
252
 
218
253
        anchors.fill: row
219
254
        drag.target: slider