Merge lp:~nik90/telegram-app/settings-listitemlayouts into lp:telegram-app

Proposed by Nekhelesh Ramananthan on 2016-03-05
Status: Needs review
Proposed branch: lp:~nik90/telegram-app/settings-listitemlayouts
Merge into: lp:telegram-app
Diff against target: 412 lines (+122/-145)
5 files modified
README.md (+1/-1)
telegram/app/qml/AccountSettings.qml (+102/-82)
telegram/app/qml/ProfilePage.qml (+2/-6)
telegram/app/qml/components/SubtitledListItem.qml (+15/-53)
telegram/manifest.json.in (+2/-3)
To merge this branch: bzr merge lp:~nik90/telegram-app/settings-listitemlayouts
Reviewer Review Type Date Requested Status
Jin (community) 2016-03-05 Needs Information on 2016-04-17
Review via email: mp+288200@code.launchpad.net

Commit message

- migrated settings listitem to listitemlayouts
- updated framework to ubuntu-sdk-15.04.3 (available since OTA-9)
- fixed chroot dependency typo in README.md
- Refactored SubtitledListItem

Description of the change

This MP,
- migrates settings listitem to listitemlayouts
- updated framework to ubuntu-sdk-15.04.3 (available since OTA-9)
- fixed chroot dependency typo in README.md
- Refactored SubtitledListItem

To post a comment you must log in.
Jin (jindallo) :
Jin (jindallo) wrote :

Hello buddy,

Please kindly feedback us what you think about the comment we left,
and feel free to contact us when you are available.

Now this merge request is on hold.

review: Needs Information
Nekhelesh Ramananthan (nik90) wrote :

Hmm I don't get email notifications when you just add diff comments without actually adding a comment in the MP. Strange.

Anyway, I updated the framework to keep up with the OTA version after all telegram is one of the core apps shipped on the phone. I would expect it to be up to date when it comes to framework versions.

Tim Peeters (tpeeters) wrote :

IF this goes in first: https://code.launchpad.net/~tpeeters/telegram-app/new-header/+merge/297787 (it is urgent because we don't want to show the red outline to warn for using the deprecated header to the users), then there will be a merge conflict in this branch. Should not be too hard to solve, but if there are issues (or you want more information), feel free to ask me :)

Unmerged revisions

160. By Nekhelesh Ramananthan on 2016-03-05

Refactored SubtitledListItem and reverted back to ListItem.Header

159. By Nekhelesh Ramananthan on 2016-03-05

Updated framework to ubuntu-sdk-15.04.3

158. By Nekhelesh Ramananthan on 2016-03-05

Converted settings page listitems to ListItemLayout

157. By Nekhelesh Ramananthan on 2016-03-04

Fixed dependency typo in README.md

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.md'
2--- README.md 2015-10-12 14:07:59 +0000
3+++ README.md 2016-03-05 12:47:04 +0000
4@@ -11,7 +11,7 @@
5 #### Get and build dependencies.
6
7 In the above click chroot, install:
8- libthumbnailer-qt-dev libthumbnailer-qt1.0:armhf thumbnailer-service:armhf
9+ libthumbnailer-qt-dev:armhf libthumbnailer-qt1.0:armhf thumbnailer-service:armhf
10
11 This app requires:
12 - libqtelegram-aseman-edition library and
13
14=== modified file 'telegram/app/qml/AccountSettings.qml'
15--- telegram/app/qml/AccountSettings.qml 2015-11-16 11:26:36 +0000
16+++ telegram/app/qml/AccountSettings.qml 2016-03-05 12:47:04 +0000
17@@ -1,9 +1,8 @@
18 import QtQuick 2.4
19 import Ubuntu.Components 1.3
20-import Ubuntu.Components.ListItems 0.1 as ListItem
21-import Ubuntu.Components.Popups 1.0 as Popup
22+import Ubuntu.Components.Popups 1.3 as Popup
23 import Ubuntu.Content 1.0
24-
25+import Ubuntu.Components.ListItems 1.3 as ListItems
26 import TelegramQML 1.0
27
28 import "components"
29@@ -33,8 +32,10 @@
30 ]
31
32 objectName: "settingsPage"
33- title: i18n.tr("Settings")
34- head.actions: actions
35+ header: PageHeader {
36+ title: i18n.tr("Settings")
37+ trailingActionBar.actions: actions
38+ }
39
40 function changeFullName() {
41 var properties = { "telegram": telegram, "firstName": user.firstName, "lastName": user.lastName };
42@@ -89,119 +90,142 @@
43 VisualItemModel {
44 id: model
45
46- ListItem.Header {
47+ ListItems.Header {
48 // TRANSLATORS: Settings section header, visible above phone and username fields.
49 text: i18n.tr("Info")
50 }
51
52- ListItem.Subtitled {
53- text: telegram.phoneNumber
54- // TRANSLATORS: Visible right under phone number in settings page.
55- subText: i18n.tr("Phone")
56- showDivider: false
57- highlightWhenPressed: false
58+ ListItem {
59+ divider.visible: false
60+ height: units.gu(6)
61+ ListItemLayout {
62+ id: phoneNumberLayout
63+ title.text: telegram.phoneNumber
64+ // TRANSLATORS: Visible right under phone number in settings page.
65+ subtitle.text: i18n.tr("Phone")
66+ padding.bottom: units.gu(1)
67+ padding.top: units.gu(1)
68+ }
69 }
70
71- ListItem.Subtitled {
72- text: user.username
73- // TRANSLATORS: Visible right under username in settings page.
74- subText: i18n.tr("Username")
75- showDivider: false
76+ ListItem {
77+ divider.visible: false
78+ height: units.gu(6)
79+ ListItemLayout {
80+ id: usernameLayout
81+ title.text: user.username
82+ // TRANSLATORS: Visible right under username in settings page.
83+ subtitle.text: i18n.tr("Username")
84+ padding.bottom: units.gu(1)
85+ padding.top: units.gu(1)
86+ }
87 onClicked: changeUsername()
88 }
89
90- ListItem.Header {
91+ ListItems.Header {
92 // TRANSLATORS: Settings section header.
93 text: i18n.tr("Messages")
94 }
95
96- ListItem.Standard {
97- // TRANSLATORS: Text of notifications switch in settings.
98- text: i18n.tr("Notifications")
99- height: visible ? implicitHeight : 0
100- visible: (Cutegram.pushNumber == telegram.phoneNumber)
101- showDivider: false
102-
103- Switch {
104- checked: Cutegram.pushNotifications
105- anchors {
106- right: parent.right
107- rightMargin: units.gu(2)
108- verticalCenter: parent.verticalCenter
109- }
110-
111- onCheckedChanged: {
112- Cutegram.pushNotifications = checked;
113-
114- if (pushClient.token == "") {
115- if (checked) {
116- Cutegram.pushNotifications = false;
117- mainView.openPushDialog();
118- }
119- } else {
120- if (checked) {
121- pushClient.registerForPush();
122+ ListItem {
123+ divider.visible: false
124+ height: visible ? units.gu(6) : 0
125+ visible: (Cutegram.pushNumber === telegram.phoneNumber)
126+
127+ ListItemLayout {
128+ id: notificationLayout
129+ // TRANSLATORS: Text of notifications switch in settings.
130+ title.text: i18n.tr("Notifications")
131+
132+ Switch {
133+ checked: Cutegram.pushNotifications
134+ SlotsLayout.position: SlotsLayout.Last
135+
136+ onCheckedChanged: {
137+ Cutegram.pushNotifications = checked;
138+
139+ if (pushClient.token == "") {
140+ if (checked) {
141+ Cutegram.pushNotifications = false;
142+ mainView.openPushDialog();
143+ }
144 } else {
145- pushClient.unregisterFromPush();
146+ if (checked) {
147+ pushClient.registerForPush();
148+ } else {
149+ pushClient.unregisterFromPush();
150+ }
151 }
152 }
153 }
154 }
155 }
156
157- ListItem.Standard {
158- text: i18n.tr("Send by Enter")
159- showDivider: false
160+ ListItem {
161+ divider.visible: false
162+ height: units.gu(6)
163+ ListItemLayout {
164+ title.text: i18n.tr("Send by Enter")
165
166- Switch {
167- checked: Cutegram.sendWithEnter
168- anchors {
169- right: parent.right
170- rightMargin: units.gu(2)
171- verticalCenter: parent.verticalCenter
172+ Switch {
173+ checked: Cutegram.sendWithEnter
174+ SlotsLayout.position: SlotsLayout.Last
175+ onCheckedChanged: Cutegram.sendWithEnter = checked
176 }
177-
178- onCheckedChanged: Cutegram.sendWithEnter = checked
179 }
180 }
181
182 // TODO Terminate all sessions
183
184- ListItem.Header {
185+ ListItems.Header {
186 // TRANSLATORS: Settings section header.
187 text: i18n.tr("Support")
188 }
189
190- ListItem.Standard {
191- showDivider: false
192- // TRANSLATORS: Text of settings item visible in the Support section.
193- text: i18n.tr("Ask a Question")
194+ ListItem {
195+ height: units.gu(6)
196+ divider.visible: false
197+ ListItemLayout {
198+ // TRANSLATORS: Text of settings item visible in the Support section.
199+ title.text: i18n.tr("Ask a Question")
200+ }
201 onClicked: Qt.openUrlExternally("http://askubuntu.com/search?q=telegram")
202 }
203
204- ListItem.Standard {
205- showDivider: false
206- // TRANSLATORS: Text of settings item visible in the Support section
207- text: i18n.tr("Telegram FAQ")
208+ ListItem {
209+ height: units.gu(6)
210+ divider.visible: false
211+ ListItemLayout {
212+ // TRANSLATORS: Text of settings item visible in the Support section
213+ title.text: i18n.tr("Telegram FAQ")
214+ }
215 onClicked: Qt.openUrlExternally("https://telegram.org/faq")
216 }
217
218- ListItem.Header {
219- // TRANSLATORS: Settings section header.
220- text: i18n.tr("Account")
221+ ListItem {
222+ height: units.gu(4)
223+ ListItemLayout {
224+ // TRANSLATORS: Settings section header.
225+ title.text: i18n.tr("Account")
226+ title.font.weight: Font.DemiBold
227+ padding.bottom: units.gu(1)
228+ padding.top: units.gu(1)
229+ }
230 }
231
232- ListItem.Standard {
233- showDivider: true
234- text: i18n.tr("Log out") + " | " + telegram.phoneNumber
235+ ListItem {
236+ height: units.gu(6)
237+ ListItemLayout {
238+ title.text: i18n.tr("Log out") + " | " + telegram.phoneNumber
239+ }
240 onClicked: PopupUtils.open(logout_dialog_component)
241 }
242
243- ListItem.SingleControl {
244- showDivider: false
245- control: Label {
246+ ListItem {
247+ divider.visible: false
248+ Label {
249 width: parent.width
250- height: units.gu(5)
251+ height: units.gu(6)
252 horizontalAlignment: Text.AlignHCenter
253 verticalAlignment: Text.AlignVCenter
254 // TRANSLATORS: Visible at bottom of settings screen. The argument is application version.
255@@ -222,7 +246,7 @@
256 ClickableContactImage {
257 id: profile_image
258 anchors {
259- top: parent.top
260+ top: page.header.bottom
261 topMargin: units.gu(2)
262 left: parent.left
263 leftMargin: units.gu(2)
264@@ -247,13 +271,9 @@
265 right: parent.right
266 verticalCenter: profile_image.verticalCenter
267 }
268- highlightWhenPressed: false
269- divider.visible: false
270
271- title: user.firstName + " " + user.lastName
272- titleIsBold: true
273- titleMaxLineCount: 2
274- subtitle: {
275+ title.text: user.firstName + " " + user.lastName
276+ subtitle.text: {
277 var result = "";
278 switch(user.status.classType)
279 {
280
281=== modified file 'telegram/app/qml/ProfilePage.qml'
282--- telegram/app/qml/ProfilePage.qml 2015-11-16 11:26:59 +0000
283+++ telegram/app/qml/ProfilePage.qml 2016-03-05 12:47:04 +0000
284@@ -202,10 +202,8 @@
285 right: parent.right
286 verticalCenter: profile_image.verticalCenter
287 }
288- highlightWhenPressed: false
289- divider.visible: false
290
291- title: {
292+ title.text: {
293 if (!dialog) return "";
294
295 if (isChat)
296@@ -214,9 +212,7 @@
297 return user ? user.firstName + " " + user.lastName : ""//emojis.textToEmojiText(user ? user.firstName + " " + user.lastName : "", 18, true);
298 }
299
300- titleIsBold: true
301- titleMaxLineCount: 2
302- subtitle: {
303+ subtitle.text: {
304 //groupModel.count + " " + i18n.tr("members")
305
306 var result = ""
307
308=== modified file 'telegram/app/qml/components/SubtitledListItem.qml'
309--- telegram/app/qml/components/SubtitledListItem.qml 2015-09-30 14:55:01 +0000
310+++ telegram/app/qml/components/SubtitledListItem.qml 2016-03-05 12:47:04 +0000
311@@ -1,59 +1,21 @@
312 import QtQuick 2.4
313 import Ubuntu.Components 1.3
314-import Ubuntu.Components.ListItems 1.0 as ListItem
315
316-ListItem.Empty {
317+ListItem {
318 id: item
319- width: parent.width
320- height: units.gu(8)
321-
322- property string title: ""
323- property string titleColor: UbuntuColors.darkGrey
324- property bool titleIsBold: false
325- property int titleMaxLineCount: 1
326- property string subtitle: ""
327- property string subtitleColor: UbuntuColors.lightGrey
328- property bool subtitleIsBold: false
329-
330- Text {
331- id: title
332- anchors {
333- top: parent.top
334- topMargin: units.gu(1)
335- left: parent.left
336- leftMargin: units.gu(2)
337- right: parent.right
338- rightMargin: units.gu(2)
339- }
340- width: parent.width
341- verticalAlignment: TextInput.AlignVCenter
342-
343- maximumLineCount: item.titleMaxLineCount
344- wrapMode: Text.Wrap
345- elide: Text.ElideRight
346- font.pixelSize: FontUtils.sizeToPixels("large")
347- font.weight: item.titleIsBold ? Font.Bold : Font.Light
348- color: item.titleColor
349- text: item.title
350- }
351-
352- Text {
353- id: subtitle
354- anchors {
355- top: title.bottom
356- topMargin: units.dp(4)
357- left: title.left
358- bottom: parent.bottom
359- bottomMargin: units.gu(1)
360- right: title.right
361- }
362- width: parent.width
363- verticalAlignment: TextInput.AlignVCenter
364-
365- elide: Text.ElideRight
366- font.pixelSize: FontUtils.sizeToPixels("medium")
367- font.weight: item.subtitleIsBold ? Font.Bold : Font.Light
368- color: item.subtitleColor
369- text: item.subtitle
370+
371+ property alias title: itemLayout.title
372+ property alias subtitle: itemLayout.subtitle
373+
374+ height: itemLayout.height
375+ divider.visible: false
376+
377+ ListItemLayout {
378+ id: itemLayout
379+
380+ title.font.bold: true
381+ title.wrapMode: Text.Wrap
382+ title.textSize: Label.Large
383+ title.maximumLineCount: 2
384 }
385 }
386
387=== modified file 'telegram/manifest.json.in'
388--- telegram/manifest.json.in 2016-03-03 04:17:25 +0000
389+++ telegram/manifest.json.in 2016-03-05 12:47:04 +0000
390@@ -1,7 +1,7 @@
391 {
392 "name": "com.ubuntu.telegram",
393 "description": "Telegram for Ubuntu Phone",
394- "framework" : "ubuntu-sdk-15.04.1",
395+ "framework": "ubuntu-sdk-15.04.3",
396 "architecture": "@CLICK_ARCH@",
397 "title": "Telegram",
398 "hooks": {
399@@ -9,7 +9,7 @@
400 "account-application": "telegram.application",
401 "apparmor": "apparmor-telegram.json",
402 "content-hub": "content-hub.json",
403- "desktop": "telegram.desktop",
404+ "desktop": "telegram.desktop",
405 "urls": "urls.json"
406 },
407 "push": {
408@@ -24,4 +24,3 @@
409 "version": "2.0.8.1",
410 "maintainer": "Ubuntu Telegram team <libqtelegram-team@lists.launchpad.net>"
411 }
412-

Subscribers

People subscribed via source and target branches

to status/vote changes: