on xenial help sign in
Use theme colors; use UbuntuShape
commit54075252bd1849cd648f0e662dafab3614910375 authorMichael Terry <michael.terry@canonical.com> dateWed 18 May 2016, 15:00 (10 years ago) parent7268a5c
3 files changed+43−28
qml/Greeter/GreeterPrompt.qml+29−13 qml/Greeter/LoginList.qml+10−13 tests/qmltests/Greeter/tst_WideView.qml+4−2
qml/Greeter/GreeterPrompt.qml+29−13
@@ -32,14 +32,25 @@ FocusScope {
3232
3333 function reset() {
3434 passwordInput.text = "";
35− passwordInput.focus = false;
36− passwordInput.enabled = true;
35+ focus = false;
36+ enabled = true;
37+ }
38+
39+ StyledItem {
40+ id: d
41+
42+ property color color: root.enabled ? theme.palette.normal.backgroundText
43+ : theme.palette.disabled.backgroundText
44+ property color inverseColor: root.enabled ? theme.palette.normal.background
45+ : theme.palette.disabled.background
46+ property color errorColor: root.enabled ? theme.palette.normal.negative
47+ : theme.palette.disabled.negative
3748 }
3849
3950 Rectangle {
4051 anchors.fill: parent
4152 border.width: units.dp(1)
42− border.color: UbuntuColors.porcelain
53+ border.color: d.color
4354 radius: units.gu(0.5)
4455 color: "transparent"
4556 }
@@ -52,7 +63,7 @@ FocusScope {
5263
5364 Label {
5465 anchors.centerIn: parent
55− color: UbuntuColors.porcelain
66+ color: d.color
5667 text: root.text
5768 }
5869 }
@@ -68,12 +79,12 @@ FocusScope {
6879 hasClearButton: false
6980
7081 style: Item {
71− property color color: UbuntuColors.porcelain
72− property color selectedTextColor: UbuntuColors.jet
73− property color selectionColor: UbuntuColors.porcelain
82+ property color color: d.color
83+ property color selectedTextColor: d.inverseColor
84+ property color selectionColor: d.color
7485 property color borderColor: "transparent"
7586 property color backgroundColor: "transparent"
76− property color errorColor: UbuntuColors.red
87+ property color errorColor: d.errorColor
7788 property real frameSpacing: units.gu(0.5)
7889 anchors.fill: parent
7990
@@ -89,16 +100,21 @@ FocusScope {
89100 name: "keyboard-caps-enabled"
90101 height: units.gu(2)
91102 width: units.gu(2)
92− color: UbuntuColors.porcelain
93− visible: false // TODO: detect when caps lock is on
103+ color: d.color
104+ visible: root.isSecret && false // TODO: detect when caps lock is on
94105 }
95106 ]
96107
108+ cursorDelegate: Rectangle {
109+ width: units.dp(1)
110+ color: d.color
111+ }
112+
97113 onAccepted: {
98− if (!enabled)
114+ if (!root.enabled)
99115 return;
100116 root.focus = true; // so that it can handle Escape presses for us
101− enabled = false;
117+ root.enabled = false;
102118 root.responded(text);
103119 }
104120
@@ -107,7 +123,7 @@ FocusScope {
107123 Connections {
108124 target: Qt.inputMethod
109125 onVisibleChanged: {
110− if (!Qt.inputMethod.visible) {
126+ if (passwordInput.visible && !Qt.inputMethod.visible) {
111127 passwordInput.focus = false;
112128 }
113129 }
qml/Greeter/LoginList.qml+10−13
@@ -91,7 +91,7 @@ Item {
9191 userList.currentIndex = currentIndex;
9292 }
9393
94− Rectangle {
94+ UbuntuShape {
9595 id: highlightItem
9696 anchors {
9797 left: parent.left
@@ -99,11 +99,8 @@ Item {
9999 verticalCenter: parent.verticalCenter
100100 }
101101 height: root.highlightedHeight
102− color: Qt.rgba(0.1, 0.1, 0.1, 0.4)
103− border.color: Qt.rgba(0.4, 0.4, 0.4, 0.4)
104− border.width: units.dp(1)
105− radius: units.gu(1.5)
106− antialiasing: true
102+ aspect: UbuntuShape.Flat
103+ backgroundColor: Qt.rgba(0, 0, 0, 0.4)
107104 }
108105
109106 ListView {
@@ -161,15 +158,15 @@ Item {
161158
162159 anchors {
163160 left: parent.left
164− leftMargin: units.gu(2)
161+ leftMargin: units.gu(1)
165162 right: parent.right
166− rightMargin: units.gu(2)
167− top: parent.top
168− // Add an offset to topMargin for any items below the highlight
169− topMargin: units.gu(1) + (parent.belowHighlight ? parent.belowOffset : 0)
163+ rightMargin: units.gu(1)
164+ bottom: parent.top
165+ // Add an offset to bottomMargin for any items below the highlight
166+ bottomMargin: -(units.gu(3) + (parent.belowHighlight ? parent.belowOffset : 0))
170167 }
171168 text: realName
172− color: UbuntuColors.porcelain
169+ color: theme.palette.normal.backgroundText
173170
174171 Behavior on anchors.topMargin { NumberAnimation { duration: root.moveDuration; easing.type: Easing.InOutQuad; } }
175172 }
@@ -212,7 +209,7 @@ Item {
212209 rightMargin: units.gu(1)
213210 }
214211
215− color: UbuntuColors.porcelain
212+ color: theme.palette.normal.backgroundText
216213 width: root.width - anchors.leftMargin - anchors.rightMargin
217214 fontSize: "small"
218215 textFormat: Text.StyledText
tests/qmltests/Greeter/tst_WideView.qml+4−2
@@ -22,11 +22,13 @@ import IntegratedLightDM 0.1 as LightDM
2222import Ubuntu.Components 1.3
2323import Unity.Test 0.1 as UT
2424
25−Item {
25+StyledItem {
2626 id: root
2727 width: units.gu(120)
2828 height: units.gu(80)
2929
30+ theme.name: "Ubuntu.Components.Themes.SuruDark"
31+
3032 Binding {
3133 target: LightDM.Users
3234 property: "mockMode"
@@ -103,7 +105,7 @@ Item {
103105
104106 Rectangle {
105107 id: controls
106− color: "white"
108+ color: theme.palette.normal.background
107109 width: units.gu(40)
108110 height: parent.height
109111