Merge lp:~renatofilho/address-book-app/visuals-update into lp:address-book-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Bill Filler
Approved revision: 538
Merged at revision: 536
Proposed branch: lp:~renatofilho/address-book-app/visuals-update
Merge into: lp:address-book-app
Diff against target: 369 lines (+119/-24)
16 files modified
src/imports/Settings/SettingsPage.qml (+3/-3)
src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml (+2/-1)
src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml (+0/-1)
src/imports/Ubuntu/AddressBook/ContactView/BasicFieldView.qml (+0/-1)
src/imports/Ubuntu/Contacts/CMakeLists.txt (+1/-0)
src/imports/Ubuntu/Contacts/ContactAvatar.qml (+19/-7)
src/imports/Ubuntu/Contacts/ContactDelegate.qml (+1/-1)
src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml (+0/-2)
src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml (+0/-1)
src/imports/Ubuntu/Contacts/Contacts.js (+7/-0)
src/imports/Ubuntu/Contacts/FastScroll.qml (+20/-5)
src/imports/Ubuntu/Contacts/ListItemWithActions.qml (+1/-1)
src/imports/Ubuntu/Contacts/Triangle.qml (+52/-0)
src/imports/Ubuntu/Contacts/contacts.cpp (+5/-0)
src/imports/Ubuntu/Contacts/contacts.h (+1/-0)
tests/qml/tst_ContactAvatar.qml (+7/-1)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/visuals-update
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+283608@code.launchpad.net

Commit message

Use a list of colors as avatar background color.
Use flat visual for avatar ubuntu shape.
Does not use 'lightAubergine' for labels.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
533. By Renato Araujo Oliveira Filho

Update visuals for fast scrool.

534. By Renato Araujo Oliveira Filho

Update ContactAvatar test to work with the new component.

535. By Renato Araujo Oliveira Filho

Fixed warning messaging while creating ContactEditorPage.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
536. By Renato Araujo Oliveira Filho

Use a hahs of contact full name to create a better result.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
537. By Renato Araujo Oliveira Filho

Does not change the contact delegate label color to white while selected.

538. By Renato Araujo Oliveira Filho

Does not show orange rectangle on selected item in settings if no keyboard is present.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/imports/Settings/SettingsPage.qml'
2--- src/imports/Settings/SettingsPage.qml 2016-01-05 14:04:19 +0000
3+++ src/imports/Settings/SettingsPage.qml 2016-02-04 13:19:27 +0000
4@@ -92,7 +92,7 @@
5 Rectangle {
6 color: UbuntuColors.orange
7 anchors.fill: parent
8- visible:addGoogleAccountItem.activeFocus && pageStack.hasKeyboard
9+ visible: addGoogleAccountItem.activeFocus && pageStack.hasKeyboard
10 z: -1
11 }
12 }
13@@ -116,12 +116,12 @@
14 // FIXME: Using a private property here. This uses the old list item and the only way to change the text
15 // color is with this property.
16 // We should remove it when update the app to the new ListItem.
17- __foregroundColor: (activeFocus && (pageStack.columns > 1)) ? Theme.palette.normal.foregroundText :
18+ __foregroundColor: (activeFocus && pageStack.hasKeyboard) ? Theme.palette.normal.foregroundText :
19 Theme.palette.normal.foreground
20 Rectangle {
21 color: UbuntuColors.orange
22 anchors.fill: parent
23- visible: importFromSimItem.activeFocus
24+ visible: importFromSimItem.activeFocus && pageStack.hasKeyboard
25 z: -1
26 }
27 }
28
29=== modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml'
30--- src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2016-01-07 12:21:49 +0000
31+++ src/imports/Ubuntu/AddressBook/ContactEditor/ContactEditorPage.qml 2016-02-04 13:19:27 +0000
32@@ -118,7 +118,8 @@
33 if (!item)
34 return
35
36- var position = activeItem.mapToItem(editEditor, item.x, item.y);
37+
38+ var position = item.mapToItem(editEditor, item.x, item.y);
39 // check if the item is already visible
40 var bottomY = scrollArea.contentY + scrollArea.height
41 var itemBottom = position.y + (item.height * 3) // extra margin
42
43=== modified file 'src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml'
44--- src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml 2016-01-06 18:54:07 +0000
45+++ src/imports/Ubuntu/AddressBook/ContactEditor/TextInputDetail.qml 2016-02-04 13:19:27 +0000
46@@ -91,7 +91,6 @@
47 overlaySpacing: 0
48 frameSpacing: 0
49 background: Item {}
50- color: UbuntuColors.lightAubergine
51 }
52 onActiveFocusChanged: {
53 if (activeFocus) {
54
55=== modified file 'src/imports/Ubuntu/AddressBook/ContactView/BasicFieldView.qml'
56--- src/imports/Ubuntu/AddressBook/ContactView/BasicFieldView.qml 2015-12-10 19:13:20 +0000
57+++ src/imports/Ubuntu/AddressBook/ContactView/BasicFieldView.qml 2016-02-04 13:19:27 +0000
58@@ -59,7 +59,6 @@
59
60 // style
61 fontSize: "medium"
62- color: UbuntuColors.lightAubergine
63 }
64 }
65 }
66
67=== modified file 'src/imports/Ubuntu/Contacts/CMakeLists.txt'
68--- src/imports/Ubuntu/Contacts/CMakeLists.txt 2015-09-03 17:15:32 +0000
69+++ src/imports/Ubuntu/Contacts/CMakeLists.txt 2016-02-04 13:19:27 +0000
70@@ -31,6 +31,7 @@
71 SIMList.qml
72 SIMCardImportPage.qml
73 SubtitledWithColors.qml
74+ Triangle.qml
75 VCardParser.qml
76 )
77
78
79=== modified file 'src/imports/Ubuntu/Contacts/ContactAvatar.qml'
80--- src/imports/Ubuntu/Contacts/ContactAvatar.qml 2015-10-26 13:18:11 +0000
81+++ src/imports/Ubuntu/Contacts/ContactAvatar.qml 2016-02-04 13:19:27 +0000
82@@ -40,8 +40,9 @@
83 initialsLabel.contactDisplayName = Qt.binding(function() { return ContactsJS.formatToDisplayWithDetails(contactElement, ContactDetail.Name, [Name.FirstName, Name.LastName], fallbackDisplayName) })
84 }
85
86+ aspect: UbuntuShape.Flat
87 radius: "medium"
88- backgroundColor: Theme.palette.normal.overlay
89+ backgroundColor: ContactsJS.contactColor(displayName)
90
91 Label {
92 id: initialsLabel
93@@ -51,8 +52,8 @@
94
95 anchors.centerIn: parent
96 text: Contacts.contactInitialsFromString(contactDisplayName)
97- color: UbuntuColors.lightAubergine
98- visible: (img.status != Image.Ready)
99+ color: "white"
100+ visible: (img.status != Image.Ready) && !fallbackIcon.visible
101 fontSize: "large"
102 }
103
104@@ -65,13 +66,24 @@
105
106 property string avatarUrl: ContactsJS.getAvatar(contactElement, fallbackAvatarUrl)
107
108- anchors.centerIn: visible ? avatar : undefined
109 asynchronous: true
110- source: avatar.showAvatarPicture ? avatar.avatarUrl : ""
111- height: visible ? units.gu(3) : avatar.height
112+ source: avatar.showAvatarPicture && (avatar.avatarUrl.indexOf("image://theme/") === -1) ? avatar.avatarUrl : ""
113+ height: avatar.height
114 width: height
115- visible: avatar.avatarUrl.indexOf("image://theme/") === 0
116+ visible: false
117 sourceSize.width: avatar.width
118 sourceSize.height: avatar.height
119 }
120+
121+ Icon {
122+ id: fallbackIcon
123+ objectName: "fallbackIcon"
124+
125+ source: visible ? img.avatarUrl : ""
126+ visible: avatar.showAvatarPicture && (avatar.avatarUrl.indexOf("image://theme/") === 0)
127+ color: "white"
128+ anchors.centerIn: avatar
129+ height: units.gu(3)
130+ width: height
131+ }
132 }
133
134=== modified file 'src/imports/Ubuntu/Contacts/ContactDelegate.qml'
135--- src/imports/Ubuntu/Contacts/ContactDelegate.qml 2015-12-10 19:13:20 +0000
136+++ src/imports/Ubuntu/Contacts/ContactDelegate.qml 2016-02-04 13:19:27 +0000
137@@ -76,7 +76,7 @@
138 verticalCenter: parent.verticalCenter
139 right: parent.right
140 }
141- color: UbuntuColors.lightAubergine
142+ color: UbuntuColors.darkGrey
143 text: root.displayLabel != "" ? root.displayLabel : i18n.dtr("address-book-app", "No name")
144 elide: Text.ElideRight
145 }
146
147=== modified file 'src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml'
148--- src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml 2015-10-26 13:18:11 +0000
149+++ src/imports/Ubuntu/Contacts/ContactDetailPickerPhoneNumberDelegate.qml 2016-02-04 13:19:27 +0000
150@@ -80,7 +80,6 @@
151 }
152
153 text: i18n.dtr("address-book-app", "Add number...")
154- color: UbuntuColors.lightAubergine
155 }
156 visible: phoneNumberEntries.count == 0
157 MouseArea {
158@@ -104,7 +103,6 @@
159 text: modelData.number
160 subText: phoneTypeModel.get(phoneTypeModel.getTypeIndex(modelData)).label
161 onClicked: root.detailClicked(modelData, "call")
162- textColor: UbuntuColors.lightAubergine
163
164 MouseArea {
165 anchors {
166
167=== modified file 'src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml'
168--- src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml 2015-10-26 13:18:11 +0000
169+++ src/imports/Ubuntu/Contacts/ContactListButtonDelegate.qml 2016-02-04 13:19:27 +0000
170@@ -73,7 +73,6 @@
171 right: parent.right
172 rightMargin: units.gu(2)
173 }
174- color: UbuntuColors.lightAubergine
175 elide: Text.ElideRight
176 visible: root.showContents
177 }
178
179=== modified file 'src/imports/Ubuntu/Contacts/Contacts.js'
180--- src/imports/Ubuntu/Contacts/Contacts.js 2015-06-01 18:26:26 +0000
181+++ src/imports/Ubuntu/Contacts/Contacts.js 2016-02-04 13:19:27 +0000
182@@ -1,5 +1,6 @@
183
184 var phoneTypeModel = null
185+var contactColors = ["#DC3023", "#FF8936", "#FFB95A", "#8DB255", "#749F8D", "#48929B", "#A87CA0"]
186
187 // Format contact name to be displayed
188 function formatToDisplayWithDetails(contact, contactDetail, detailFields, defaultTitle)
189@@ -145,3 +146,9 @@
190 {
191 return (contact && (contact.contactId === "qtcontacts:::"))
192 }
193+
194+function contactColor(name)
195+{
196+ var hash = Contacts.qHash(name)
197+ return contactColors[(hash % contactColors.length)]
198+}
199
200=== modified file 'src/imports/Ubuntu/Contacts/FastScroll.qml'
201--- src/imports/Ubuntu/Contacts/FastScroll.qml 2015-12-10 19:08:19 +0000
202+++ src/imports/Ubuntu/Contacts/FastScroll.qml 2016-02-04 13:19:27 +0000
203@@ -72,15 +72,16 @@
204 }
205
206
207- Rectangle {
208+ UbuntuShape {
209 id: magnified
210
211+ aspect: UbuntuShape.Flat
212 color: Theme.palette.normal.foreground
213- radius: height * 0.3
214- height: pinSize * 2
215- width: height
216+ radius: "medium"
217+ height: units.gu(6)
218+ width: units.gu(8)
219 opacity: internal.fastScrolling && root.enabled ? 1.0 : 0.0
220- x: -cursor.width - units.gu(3)
221+ x: -magnified.width
222 y: {
223 if (internal.currentItem) {
224 var itemCenterY = rail.y + internal.currentItem.y + (internal.currentItem.height / 2)
225@@ -90,6 +91,20 @@
226 }
227 }
228
229+ Triangle {
230+ id: arrow
231+
232+ color: magnified.color
233+ fill: true
234+ height: units.gu(1.5)
235+ width: units.gu(0.5)
236+ anchors {
237+ verticalCenter: parent.verticalCenter
238+ right: parent.right
239+ rightMargin: -width
240+ }
241+ }
242+
243 Label {
244 color: Theme.palette.normal.foregroundText
245 anchors.fill: parent
246
247=== modified file 'src/imports/Ubuntu/Contacts/ListItemWithActions.qml'
248--- src/imports/Ubuntu/Contacts/ListItemWithActions.qml 2016-01-06 15:09:18 +0000
249+++ src/imports/Ubuntu/Contacts/ListItemWithActions.qml 2016-02-04 13:19:27 +0000
250@@ -246,7 +246,7 @@
251 width: units.gu(3)
252 height: units.gu(3)
253 name: modelData.iconName
254- color: root.activeAction === modelData ? UbuntuColors.lightAubergine : UbuntuColors.lightGrey
255+ color: root.activeAction === modelData ? UbuntuColors.orange : UbuntuColors.lightGrey
256 }
257 }
258 }
259
260=== added file 'src/imports/Ubuntu/Contacts/Triangle.qml'
261--- src/imports/Ubuntu/Contacts/Triangle.qml 1970-01-01 00:00:00 +0000
262+++ src/imports/Ubuntu/Contacts/Triangle.qml 2016-02-04 13:19:27 +0000
263@@ -0,0 +1,52 @@
264+/*
265+ * Copyright (C) 2016 Canonical, Ltd.
266+ *
267+ * This program is free software; you can redistribute it and/or modify
268+ * it under the terms of the GNU General Public License as published by
269+ * the Free Software Foundation; version 3.
270+ *
271+ * This program is distributed in the hope that it will be useful,
272+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
273+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
274+ * GNU General Public License for more details.
275+ *
276+ * You should have received a copy of the GNU General Public License
277+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
278+ */
279+
280+import QtQuick 2.4
281+
282+Canvas {
283+ id: triangle
284+ antialiasing: true
285+
286+ property color color: "#ffffff"
287+ property int lineWidth: 3
288+ property bool fill: false
289+
290+ onLineWidthChanged:requestPaint();
291+ onFillChanged:requestPaint();
292+
293+ onPaint: {
294+ var ctx = getContext("2d");
295+ ctx.save();
296+ ctx.clearRect(0,0,triangle.width, triangle.height);
297+ ctx.strokeStyle = triangle.color;
298+ ctx.lineWidth = triangle.lineWidth
299+ ctx.fillStyle = triangle.color
300+ ctx.globalAlpha = 1.0
301+ ctx.lineJoin = "round";
302+ ctx.beginPath();
303+
304+ ctx.translate(0, 0);
305+ ctx.lineTo(0, triangle.height);
306+ ctx.lineTo(triangle.width, 0.5 * triangle.height);
307+ ctx.lineTo(0, 0);
308+
309+ if (triangle.fill)
310+ ctx.fill();
311+ if (triangle.stroke)
312+ ctx.stroke();
313+ ctx.restore();
314+ }
315+}
316
317=== modified file 'src/imports/Ubuntu/Contacts/contacts.cpp'
318--- src/imports/Ubuntu/Contacts/contacts.cpp 2015-10-28 19:42:30 +0000
319+++ src/imports/Ubuntu/Contacts/contacts.cpp 2016-02-04 13:19:27 +0000
320@@ -109,6 +109,11 @@
321 return QFile::exists(updaterLockFile());
322 }
323
324+uint UbuntuContacts::qHash(const QString &str)
325+{
326+ return ::qHash(str);
327+}
328+
329 QString UbuntuContacts::updaterLockFile()
330 {
331 return QString("%1/%2").arg(QDir::tempPath()).arg("/address-book-updater.lock");
332
333=== modified file 'src/imports/Ubuntu/Contacts/contacts.h'
334--- src/imports/Ubuntu/Contacts/contacts.h 2015-10-28 19:42:30 +0000
335+++ src/imports/Ubuntu/Contacts/contacts.h 2016-02-04 13:19:27 +0000
336@@ -40,6 +40,7 @@
337 Q_INVOKABLE bool containsLetters(const QString &value);
338 Q_INVOKABLE bool removeFile(const QUrl &file);
339 Q_INVOKABLE bool updateIsRunning() const;
340+ Q_INVOKABLE uint qHash(const QString &str);
341
342 Q_SIGNALS:
343 void imageCopyDone(const QString &id, const QString &fileName);
344
345=== modified file 'tests/qml/tst_ContactAvatar.qml'
346--- tests/qml/tst_ContactAvatar.qml 2015-10-26 13:18:11 +0000
347+++ tests/qml/tst_ContactAvatar.qml 2016-02-04 13:19:27 +0000
348@@ -151,14 +151,20 @@
349 waitForRendering(avatarComponent);
350 var avatarInitials = findChild(avatarComponent, "avatarInitials")
351 var avatarImage = findChild(avatarComponent, "avatarImage")
352+ var avatarFallback = findChild(avatarComponent, "fallbackIcon")
353
354 avatarComponent.showAvatarPicture = true
355 tryCompare(avatarInitials, "visible", false)
356- tryCompare(avatarImage, "source", avatarComponent.fallbackAvatarUrl)
357+ tryCompare(avatarImage, "source", "")
358+ tryCompare(avatarFallback, "visible", true)
359+ tryCompare(avatarFallback, "source", avatarComponent.fallbackAvatarUrl)
360
361 avatarComponent.showAvatarPicture = false
362 tryCompare(avatarImage, "source", "")
363 tryCompare(avatarImage, "status", Image.Null)
364+ tryCompare(avatarFallback, "visible", false)
365+ tryCompare(avatarFallback, "source", "")
366+
367 tryCompare(avatarInitials, "visible", true)
368 }
369 }

Subscribers

People subscribed via source and target branches