Merge lp:~ken-vandine/ubuntu-ui-extras/share_much_needed_tlc into lp:~ubuntu-sdk-team/ubuntu-ui-extras/trunk

Proposed by Ken VanDine
Status: Superseded
Proposed branch: lp:~ken-vandine/ubuntu-ui-extras/share_much_needed_tlc
Merge into: lp:~ubuntu-sdk-team/ubuntu-ui-extras/trunk
Diff against target: 481 lines (+204/-227)
2 files modified
modules/Ubuntu/Components/Extras/Share.qml (+168/-196)
modules/Ubuntu/Components/Extras/Share/ShareMenu.qml (+36/-31)
To merge this branch: bzr merge lp:~ken-vandine/ubuntu-ui-extras/share_much_needed_tlc
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu SDK team Pending
Review via email: mp+207526@code.launchpad.net

This proposal has been superseded by a proposal from 2014-02-24.

Commit message

Fixed deprecations, refactored a bit for simplicity. Use an Item instead of a Rectangle
to be more consistent with the toolkit.

Filter accounts by provider, limiting the model to just Facebook. This lets us remove all the
conditionals for facebook.

Description of the change

Fixed deprecations, refactored a bit for simplicity. Use an Item instead of a Rectangle
to be more consistent with the toolkit.

Filter accounts by provider, limiting the model to just Facebook. This lets us remove all the
conditionals for facebook.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
58. By Ken VanDine

Merged trunk

59. By Ken VanDine

Switch the Item back to a Rectangle, makes the input fields easier to read.

Unmerged revisions

59. By Ken VanDine

Switch the Item back to a Rectangle, makes the input fields easier to read.

58. By Ken VanDine

Merged trunk

57. By Ken VanDine

Fixed deprecations, refactored a bit. Use an Item instead of a Rectangle
to be more consistent with the toolkit.

56. By Ken VanDine

Fixed deprecations, refactored a bit for simplicity. Also filter accounts by
provider, limiting the model to just Facebook. This lets us remove all the
conditionals for facebook.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/Extras/Share.qml'
2--- modules/Ubuntu/Components/Extras/Share.qml 2013-08-29 13:14:08 +0000
3+++ modules/Ubuntu/Components/Extras/Share.qml 2014-02-24 18:43:45 +0000
4@@ -17,14 +17,14 @@
5 import QtQuick 2.0
6 import QtQuick.Window 2.0
7 import Ubuntu.Components 0.1
8+import Ubuntu.Components.ListItems 0.1 as ListItem
9 import Friends 0.2
10 import Ubuntu.OnlineAccounts 0.1
11 import Ubuntu.Components.Extras 0.1
12
13-Rectangle {
14+Item {
15 id: shareComponent
16 objectName: "shareComponent"
17- color: Theme.palette.normal.background
18
19 property string fileToShare
20 property string userAccountId
21@@ -62,208 +62,180 @@
22 appName: "share-app"
23 }
24
25- Item {
26- id: serviceHeader
27- y: 0
28- anchors.left: parent.left
29- anchors.right: parent.right
30- anchors.topMargin: units.gu(1)
31- anchors.leftMargin: units.gu(1)
32- anchors.rightMargin: units.gu(1)
33- height: accountsList.height + units.gu(3)
34-
35- ListView {
36- id: accountsList
37- width: parent.width
38- anchors.fill: parent
39- model: accounts
40- delegate: Rectangle {
41+ Component {
42+ id: itemDelegate
43+ Item {
44+ anchors {
45+ left: parent.left
46+ right: parent.right
47+ }
48+ AccountService {
49+ id: accts
50+ objectHandle: accountServiceHandle
51+ }
52+ ListItem.Subtitled {
53+ anchors {
54+ left: parent.left
55+ right: parent.right
56+ }
57+ visible: (accountId == userAccountId)
58+ iconName: accts.provider.iconName
59+ text: accts.provider.displayName
60+ subText: displayName
61+ showDivider: false
62+ }
63+ }
64+ }
65+
66+ Column {
67+ anchors.fill: parent
68+ spacing: units.gu(1)
69+
70+ Item {
71+ id: serviceHeader
72+ y: 0
73+ anchors.left: parent.left
74+ anchors.right: parent.right
75+ anchors.topMargin: units.gu(1)
76+ anchors.leftMargin: units.gu(1)
77+ anchors.rightMargin: units.gu(1)
78+ height: accountsList.height + units.gu(3)
79+
80+ ListView {
81+ id: accountsList
82 width: parent.width
83- height: visible ? childrenRect.height : 0
84- visible: (accountId == userAccountId)
85- AccountService {
86- id: accts
87- objectHandle: accountService
88- }
89-
90- UbuntuShape {
91- id: logo
92- anchors.left: parent.left
93- anchors.top: parent.top
94- width: units.gu(5)
95- height: units.gu(5)
96-
97- image: Image {
98- fillMode: Image.PreserveAspectFit
99- source: "image://gicon/" + accts.provider.iconName
100- sourceSize.height: logo.height
101- sourceSize.width: logo.width
102- }
103- }
104-
105- Label {
106- id: serviceTitle
107- anchors.top: parent.top
108- anchors.left: logo.right
109- anchors.leftMargin: units.gu(1)
110- anchors.rightMargin: units.gu(1)
111-
112- text: accts.provider.displayName
113- fontSize: "large"
114- font.weight: Font.DemiBold
115- }
116-
117- Label {
118- anchors.top: serviceTitle.bottom
119- anchors.left: logo.right
120- anchors.right: parent.right
121- anchors.leftMargin: units.gu(1)
122- anchors.rightMargin: units.gu(1)
123-
124- elide: Text.ElideRight
125- text: displayName
126- fontSize: "medium"
127- }
128+ anchors.fill: parent
129+ model: accounts
130+ delegate: itemDelegate
131 }
132 }
133- }
134-
135- Rectangle {
136- id: topLine
137- color: "#cccccc"
138- height: units.dp(1)
139- anchors.left: parent.left
140- anchors.right: parent.right
141- anchors.top: serviceHeader.bottom
142- }
143-
144- UbuntuShape {
145- id: messageArea
146- objectName: "messageArea"
147- anchors.left: parent.left
148- anchors.right: parent.right
149- anchors.top: topLine.bottom
150- anchors.topMargin: units.gu(1)
151- anchors.leftMargin: units.gu(1)
152- anchors.rightMargin: units.gu(1)
153-
154- height: units.gu(20)
155- color: "#f2f2f2"
156-
157- TextEdit {
158- id: message
159- color: "#333333"
160- anchors.top: parent.top
161- anchors.left: snapshot.right
162- anchors.bottom: parent.bottom
163- anchors.margins: units.gu(1)
164- wrapMode: Text.Wrap
165- width: parent.width - snapshot.width -
166- snapshot.anchors.margins * 2 -
167- message.anchors.leftMargin - message.anchors.rightMargin
168-
169- clip: true
170- font.pixelSize: FontUtils.sizeToPixels("medium")
171- font.weight: Font.Light
172- focus: true
173- }
174-
175- ActivityIndicator {
176- id: activitySpinner
177- anchors.centerIn: message
178- visible: false
179- running: visible
180- }
181+
182+ ListItem.ThinDivider {}
183
184 UbuntuShape {
185- id: snapshot
186- anchors.top: parent.top
187- anchors.left: parent.left
188- anchors.margins: units.gu(1)
189- width: units.gu(10)
190- height: units.gu(10)
191-
192- image: Image {
193- source: fileToShare
194- sourceSize.height: snapshot.height
195- sourceSize.width: snapshot.width
196- fillMode: Image.PreserveAspectCrop
197- }
198- }
199- }
200-
201- Item {
202- id: actionsBar
203- anchors.left: parent.left
204- anchors.right: parent.right
205- anchors.top: messageArea.bottom
206- anchors.topMargin: units.gu(2)
207- anchors.leftMargin: units.gu(1)
208- anchors.rightMargin: units.gu(1)
209- height: childrenRect.height
210-
211- Button {
212- objectName: "cancelButton"
213- anchors.left: parent.left
214- text: i18n.dtr("ubuntu-ui-extras", "Cancel")
215- color: "#cccccc"
216- width: units.gu(10)
217- height: units.gu(4)
218- onClicked: shareComponent.canceled()
219- }
220-
221- Button {
222- objectName: "postButton"
223+ id: messageArea
224+ objectName: "messageArea"
225+ anchors.left: parent.left
226 anchors.right: parent.right
227- anchors.top: parent.top
228- text: i18n.dtr("ubuntu-ui-extras", "Post")
229- color: "#dd4814"
230- width: units.gu(10)
231- height: units.gu(4)
232- enabled: !activitySpinner.visible
233- onClicked: {
234- activitySpinner.visible = true;
235- friends.uploadForAccountAsync(userAccountId,
236- "file://" + resizer.resizedFile,
237- message.text)
238- }
239- }
240- }
241-
242- UbuntuShape {
243- id: useLocation
244- anchors.left: parent.left
245- anchors.top: actionsBar.bottom
246- anchors.leftMargin: units.gu(1)
247- anchors.topMargin: units.gu(1)
248- color: selected ? "#cccccc" : "transparent"
249- property bool selected: false
250- width: units.gu(4.5)
251- height: units.gu(4)
252-
253- AbstractButton {
254- anchors.fill: parent
255- onClicked: parent.selected = !parent.selected
256-
257- Image {
258- source: "assets/icon_location.png"
259+ anchors.topMargin: units.gu(1)
260+ anchors.leftMargin: units.gu(1)
261+ anchors.rightMargin: units.gu(1)
262+
263+ height: units.gu(20)
264+ color: "#f2f2f2"
265+
266+ TextEdit {
267+ id: message
268+ color: "#333333"
269 anchors.top: parent.top
270- anchors.topMargin: units.gu(0.5)
271+ anchors.left: snapshot.right
272 anchors.bottom: parent.bottom
273- anchors.bottomMargin: units.gu(0.5)
274- anchors.horizontalCenter: parent.horizontalCenter
275- fillMode: Image.PreserveAspectFit
276- }
277- }
278- }
279-
280- Label {
281- anchors.left: useLocation.right
282- anchors.baseline: useLocation.top
283- anchors.baselineOffset: units.gu(3)
284- anchors.leftMargin: units.gu(1)
285- text: i18n.dtr("ubuntu-ui-extras", "Include location")
286- fontSize: "small"
287+ anchors.margins: units.gu(1)
288+ wrapMode: Text.Wrap
289+ width: parent.width - snapshot.width -
290+ snapshot.anchors.margins * 2 -
291+ message.anchors.leftMargin - message.anchors.rightMargin
292+ clip: true
293+ font.pixelSize: FontUtils.sizeToPixels("medium")
294+ font.weight: Font.Light
295+ focus: true
296+ }
297+
298+ ActivityIndicator {
299+ id: activitySpinner
300+ anchors.centerIn: message
301+ visible: false
302+ running: visible
303+ }
304+
305+ UbuntuShape {
306+ id: snapshot
307+ anchors.top: parent.top
308+ anchors.left: parent.left
309+ anchors.margins: units.gu(1)
310+ width: units.gu(10)
311+ height: units.gu(10)
312+
313+ image: Image {
314+ source: fileToShare
315+ sourceSize.height: snapshot.height
316+ sourceSize.width: snapshot.width
317+ fillMode: Image.PreserveAspectCrop
318+ }
319+ }
320+ }
321+
322+ Item {
323+ id: actionsBar
324+ anchors.left: parent.left
325+ anchors.right: parent.right
326+ anchors.topMargin: units.gu(2)
327+ anchors.leftMargin: units.gu(1)
328+ anchors.rightMargin: units.gu(1)
329+ height: childrenRect.height
330+
331+ Button {
332+ objectName: "cancelButton"
333+ anchors.left: parent.left
334+ text: i18n.dtr("ubuntu-ui-extras", "Cancel")
335+ color: "#cccccc"
336+ width: units.gu(10)
337+ height: units.gu(4)
338+ onClicked: shareComponent.canceled()
339+ }
340+
341+ Button {
342+ objectName: "postButton"
343+ anchors.right: parent.right
344+ anchors.top: parent.top
345+ text: i18n.dtr("ubuntu-ui-extras", "Post")
346+ color: "#dd4814"
347+ width: units.gu(10)
348+ height: units.gu(4)
349+ enabled: !activitySpinner.visible
350+ onClicked: {
351+ activitySpinner.visible = true;
352+ friends.uploadForAccountAsync(userAccountId,
353+ "file://" + resizer.resizedFile,
354+ message.text)
355+ }
356+ }
357+ }
358+
359+ UbuntuShape {
360+ id: useLocation
361+ anchors {
362+ left: parent.left
363+ leftMargin: units.gu(1)
364+ topMargin: units.gu(1)
365+ }
366+ color: selected ? "#cccccc" : "transparent"
367+ property bool selected: false
368+ width: units.gu(4.5)
369+ height: units.gu(4)
370+
371+ AbstractButton {
372+ anchors.fill: parent
373+ onClicked: parent.selected = !parent.selected
374+ Image {
375+ source: "assets/icon_location.png"
376+ anchors.centerIn: parent
377+ height: parent.height * 0.75
378+ fillMode: Image.PreserveAspectFit
379+ smooth: true
380+ }
381+ }
382+ }
383+
384+ Label {
385+ anchors.left: useLocation.right
386+ anchors.baseline: useLocation.top
387+ anchors.baselineOffset: units.gu(3)
388+ anchors.leftMargin: units.gu(1)
389+ text: i18n.dtr("ubuntu-ui-extras", "Include location")
390+ fontSize: "small"
391+ }
392+
393 }
394
395 states: [
396
397=== modified file 'modules/Ubuntu/Components/Extras/Share/ShareMenu.qml'
398--- modules/Ubuntu/Components/Extras/Share/ShareMenu.qml 2013-08-20 12:29:04 +0000
399+++ modules/Ubuntu/Components/Extras/Share/ShareMenu.qml 2014-02-24 18:43:45 +0000
400@@ -28,6 +28,39 @@
401
402 signal selected(string accountId)
403
404+ Component {
405+ id: itemDelegate
406+ Item {
407+ anchors {
408+ left: parent.left
409+ right: parent.right
410+ }
411+ AccountService {
412+ id: service
413+ objectHandle: accountServiceHandle
414+ }
415+
416+ height: childrenRect.height
417+
418+ ListItem.Subtitled {
419+ anchors {
420+ left: parent.left
421+ right: parent.right
422+ }
423+
424+ text: service.provider.displayName
425+ subText: displayName
426+ iconName: service.provider.iconName
427+ __iconHeight: units.gu(5)
428+ __iconWidth: units.gu(5)
429+
430+ onClicked: {
431+ sharemenu.selected(accountId);
432+ }
433+ }
434+ }
435+ }
436+
437 ListView {
438 anchors {
439 top: parent.top
440@@ -36,38 +69,10 @@
441 }
442 height: childrenRect.height
443 interactive: false
444-
445 model: AccountServiceModel {
446 serviceType: "microblogging"
447- includeDisabled: true
448- }
449-
450- delegate: Item {
451- width: parent.width
452- height: childrenRect.height
453- visible: serviceName == "Facebook"
454-
455- AccountService {
456- id: service
457- objectHandle: accountService
458- }
459-
460- ListItem.Subtitled {
461- text: service.provider.displayName
462- subText: displayName
463- icon: "image://gicon/" + service.provider.iconName
464- __iconHeight: units.gu(5)
465- __iconWidth: units.gu(5)
466-
467- onClicked: {
468- if (service.provider.displayName == "Facebook") {
469- sharemenu.selected(accountId);
470- } else {
471- console.log("Sharing to this service is not supported yet.");
472- sharemenu.selected(null);
473- }
474- }
475- }
476- }
477+ provider: "facebook"
478+ }
479+ delegate: itemDelegate
480 }
481 }

Subscribers

People subscribed via source and target branches

to all changes: