on xenial help sign in
update shaking behavior as info appeared in spec
03049a3Michael Zanetti
qml/Components/PinLockscreen.qml+74−68
@@ -45,90 +45,96 @@ Column {
45 }
45 }
46 }
46 }
47
47
48− Label {
48+ Column {
49− id: infoField
49+ id: shakeContainer
50− objectName: "infoTextLabel"
51− fontSize: "large"
52− color: "#f3f3e7"
53 anchors.horizontalCenter: parent.horizontalCenter
50 anchors.horizontalCenter: parent.horizontalCenter
54− text: root.infoText
51+ width: parent.width
55− }
52+ spacing: units.gu(2)
56−
57− Item {
58− id: pinContainer
59− anchors { left: parent.left; right: parent.right; margins: units.gu(2) }
60− height: units.gu(4)
61
53
62− Row {
54+ Label {
63− id: pinentryField
55+ id: infoField
64− objectName: "pinentryField"
56+ objectName: "infoTextLabel"
57+ fontSize: "large"
58+ color: "#f3f3e7"
65 anchors.horizontalCenter: parent.horizontalCenter
59 anchors.horizontalCenter: parent.horizontalCenter
66− anchors.verticalCenter: parent.verticalCenter
60+ text: root.infoText
67− spacing: Math.max(0, Math.min(units.gu(3), (parent.width / root.maxPinLength) - units.gu(3)))
61+ }
68−
69− property string text
70− property bool incorrectOverride: false
71
62
63+ Item {
64+ id: pinContainer
65+ anchors { left: parent.left; right: parent.right; margins: units.gu(2) }
66+ height: units.gu(4)
67+
68+ Row {
69+ id: pinentryField
70+ objectName: "pinentryField"
71+ anchors.horizontalCenter: parent.horizontalCenter
72+ anchors.verticalCenter: parent.verticalCenter
73+ spacing: Math.max(0, Math.min(units.gu(3), (parent.width / root.maxPinLength) - units.gu(3)))
74+
75+ property string text
76+ property bool incorrectOverride: false
77+
72− Repeater {
78+ Repeater {
73− model: pinentryField.text.length
79+ model: pinentryField.text.length
74− delegate: Rectangle {
80+ delegate: Rectangle {
75− color: "#f3f3e7"
81+ color: "#f3f3e7"
76− width: Math.min(units.gu(2), (pinContainer.width - pinContainer.height*2 ) / (root.maxPinLength >= 0 ? root.maxPinLength : 16))
82+ width: Math.min(units.gu(2), (pinContainer.width - pinContainer.height*2 ) / (root.maxPinLength >= 0 ? root.maxPinLength : 16))
77− height: width
83+ height: width
78− radius: width / 2
84+ radius: width / 2
85+ }
79 }
86 }
80− }
81
87
82− function appendNumber(number) {
88+ function appendNumber(number) {
83− if (incorrectOverride) {
89+ if (incorrectOverride) {
84− incorrectOverride = false;
90+ incorrectOverride = false;
91+ }
92+
93+ pinentryField.text = pinentryField.text + number
85 }
94 }
86
95
96+ function backspace() {
87− pinentryField.text = pinentryField.text + number
97+ pinentryField.text = pinentryField.text.substring(0, pinentryField.text.length-1)
98+ }
88 }
99 }
89−
100+ Label {
90− function backspace() {
101+ id: wrongNoticeLabel
91− pinentryField.text = pinentryField.text.substring(0, pinentryField.text.length-1)
102+ objectName: "wrongNoticeLabel"
103+ fontSize: "x-large"
104+ color: "#f3f3e7"
105+ anchors.horizontalCenter: parent.horizontalCenter
106+ text: root.errorText
107+ visible: pinentryField.incorrectOverride
92 }
108 }
93− }
94− Label {
95− id: wrongNoticeLabel
96− objectName: "wrongNoticeLabel"
97− fontSize: "x-large"
98− color: "#f3f3e7"
99− anchors.horizontalCenter: parent.horizontalCenter
100− text: root.errorText
101− visible: pinentryField.incorrectOverride
102− }
103
109
104− AbstractButton {
110+ AbstractButton {
105− objectName: "backspaceIcon"
111+ objectName: "backspaceIcon"
106− anchors { right: parent.right; top: parent.top; bottom: parent.bottom }
112+ anchors { right: parent.right; top: parent.top; bottom: parent.bottom }
107− width: height
113+ width: height
108
114
109− Icon {
115+ Icon {
110− anchors.fill: parent
116+ anchors.fill: parent
111− name: "erase"
117+ name: "erase"
112− color: "#f3f3e7"
118+ color: "#f3f3e7"
113− }
119+ }
114
120
115− opacity: (pinentryField.text.length && !pinentryField.incorrectOverride) > 0 ? 1 : 0
121+ opacity: (pinentryField.text.length && !pinentryField.incorrectOverride) > 0 ? 1 : 0
116
122
117− Behavior on opacity {
123+ Behavior on opacity {
118− UbuntuNumberAnimation {}
124+ UbuntuNumberAnimation {}
119− }
125+ }
120
126
121− onClicked: pinentryField.backspace()
127+ onClicked: pinentryField.backspace()
128+ }
122 }
129 }
123− }
124
130
125−
126− Label {
131+ Label {
127− objectName: "retryLabel"
132+ objectName: "retryLabel"
128− fontSize: "x-small"
133+ fontSize: "x-small"
129− color: "#f3f3e7"
134+ color: "#f3f3e7"
130− anchors.horizontalCenter: parent.horizontalCenter
135+ anchors.horizontalCenter: parent.horizontalCenter
131− text: root.retryText
136+ text: root.retryText
137+ }
132 }
138 }
133
139
134 ThinDivider {
140 ThinDivider {
@@ -204,6 +210,6 @@ Column {
204 WrongPasswordAnimation {
210 WrongPasswordAnimation {
205 id: wrongPasswordAnimation
211 id: wrongPasswordAnimation
206 objectName: "wrongPasswordAnimation"
212 objectName: "wrongPasswordAnimation"
207− target: root
213+ target: shakeContainer
208 }
214 }
209}
215}