~mterry/+junk/u8

« back to all changes in this revision

Viewing changes to qml/Greeter/CoverPage.qml

Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    property real dragHandleLeftMargin
26
26
    property real launcherOffset
27
27
    property alias background: greeterBackground.source
 
28
    property alias hasCustomBackground: backgroundShade.visible
28
29
    property real backgroundTopMargin
29
30
    property var infographicModel
30
31
    property bool draggable: true
31
32
 
32
33
    property alias infographics: infographics
33
34
 
34
 
    readonly property real showProgress: MathUtils.clamp((width - Math.abs(x)) / width, 0, 1)
 
35
    readonly property real showProgress: MathUtils.clamp((width - Math.abs(x + launcherOffset)) / width, 0, 1)
35
36
 
36
37
    signal tease()
37
38
    signal clicked()
41
42
        hide();
42
43
    }
43
44
 
 
45
    function showErrorMessage(msg) {
 
46
        d.errorMessage = msg;
 
47
        showLabelAnimation.start();
 
48
        errorMessageAnimation.start();
 
49
    }
 
50
 
44
51
    QtObject {
45
52
        id: d
46
53
        property bool forceRightOnNextHideAnimation: false
 
54
        property string errorMessage
47
55
    }
48
56
 
49
57
    prepareToHide: function () {
75
83
        color: "black"
76
84
    }
77
85
 
78
 
    CrossFadeImage {
 
86
    Wallpaper {
79
87
        id: greeterBackground
80
88
        objectName: "greeterBackground"
81
89
        anchors {
82
90
            fill: parent
83
91
            topMargin: root.backgroundTopMargin
84
92
        }
85
 
        fillMode: Image.PreserveAspectCrop
86
 
        // Limit how much memory we'll reserve for this image
87
 
        sourceSize.height: height
88
 
        sourceSize.width: width
89
93
    }
90
94
 
 
95
    // Darkens wallpaper so that we can read text on it and see infographic
91
96
    Rectangle {
 
97
        id: backgroundShade
 
98
        objectName: "backgroundShade"
92
99
        anchors.fill: parent
93
100
        color: "black"
94
101
        opacity: 0.4
 
102
        visible: false
95
103
    }
96
104
 
97
105
    Infographics {
110
118
 
111
119
    Label {
112
120
        id: swipeHint
 
121
        objectName: "swipeHint"
113
122
        property real baseOpacity: 0.5
114
123
        opacity: 0.0
115
124
        anchors.horizontalCenter: parent.horizontalCenter
116
125
        anchors.bottom: parent.bottom
117
126
        anchors.bottomMargin: units.gu(5)
118
 
        text: "《    " + i18n.tr("Unlock") + "    》"
 
127
        text: "《    " + (d.errorMessage ? d.errorMessage : i18n.tr("Unlock")) + "    》"
119
128
        color: "white"
120
129
        font.weight: Font.Light
121
130
 
 
131
        readonly property var opacityAnimation: showLabelAnimation // for testing
 
132
 
122
133
        SequentialAnimation on opacity {
123
134
            id: showLabelAnimation
124
135
            running: false
135
146
                to: 0.0
136
147
                duration: UbuntuAnimation.SleepyDuration
137
148
            }
 
149
 
 
150
            onRunningChanged: {
 
151
                if (!running)
 
152
                    d.errorMessage = "";
 
153
            }
138
154
        }
139
155
    }
140
156
 
 
157
    WrongPasswordAnimation {
 
158
        id: errorMessageAnimation
 
159
        objectName: "errorMessageAnimation"
 
160
        target: swipeHint
 
161
    }
 
162
 
141
163
    DragHandle {
142
164
        id: dragHandle
143
165
        objectName: "coverPageDragHandle"