Merge lp:~tpeeters/ubuntu-ui-toolkit/60-ActionsFromTabs into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters
Status: Merged
Approved by: Cris Dywan
Approved revision: 1484
Merged at revision: 1489
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/60-ActionsFromTabs
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 108 lines (+26/-20)
3 files modified
modules/Ubuntu/Components/Themes/Ambiance/OverflowPanel.qml (+9/-16)
modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml (+15/-3)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py (+2/-1)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/60-ActionsFromTabs
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+256811@code.launchpad.net

Commit message

Create a list of Actions from a list of Tabs so that OverflowPanel only needs one type of model.

Description of the change

Create a list of Actions from a list of Tabs so that OverflowPanel only needs one type of model.

To post a comment you must log in.
Revision history for this message
Cris Dywan (kalikiana) wrote :

A very nice clean-up step.

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

Approving again. Failure looks like a false positive.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/OverflowPanel.qml'
2--- modules/Ubuntu/Components/Themes/Ambiance/OverflowPanel.qml 2015-04-14 06:35:54 +0000
3+++ modules/Ubuntu/Components/Themes/Ambiance/OverflowPanel.qml 2015-04-20 13:29:38 +0000
4@@ -45,15 +45,9 @@
5 contentWidth: units.gu(20)
6
7 /*!
8- False implies the model is a list of Actions.
9- True implies the model is a ListModel with a 'tab' role,
10- and false implies that the model is a list of actions.
11- */
12- property bool tabsOverflow: false
13- // FIXME: In the input, generate a list of actions from the Tabs
14- // so that we no longer need to make a distinction between the tabs ListModel
15- // and a list of Actions.
16- property var model: null
17+ The actions to list in the popover.
18+ */
19+ property list<Action> model
20
21 Binding {
22 target: overflow.__foreground.__styleInstance
23@@ -73,13 +67,10 @@
24 id: overflowRepeater
25 model: overflow.model
26 AbstractButton {
27- action: overflow.tabsOverflow ? tab.__protected.action
28- : modelData
29+ action: modelData
30
31 // These objectNames are used in the CPOs for header and tabs.
32- objectName: overflow.tabsOverflow ?
33- "tabButton" + index :
34- action.objectName + "_header_overflow_button"
35+ objectName: action.objectName + "_header_overflow_button"
36
37 // close after triggering the action.
38 onClicked: overflow.hide()
39@@ -100,7 +91,7 @@
40
41 Icon {
42 id: actionIcon
43- visible: !overflow.tabsOverflow
44+ visible: "" != action.iconSource
45 source: action.iconSource
46 color: overflow.foregroundColor
47 anchors {
48@@ -122,7 +113,9 @@
49 leftMargin: units.gu(2)
50 right: parent.right
51 }
52- fontSize: overflow.tabsOverflow ? "medium" : "small"
53+ // In the tabs overflow panel there are no icons, and the font-size
54+ // is medium as opposed to the small font-size in the actions overflow panel.
55+ fontSize: actionIcon.visible ? "small" : "medium"
56 elide: Text.ElideRight
57 text: action.text
58 color: overflow.foregroundColor
59
60=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml'
61--- modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2015-04-17 10:06:09 +0000
62+++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2015-04-20 13:29:38 +0000
63@@ -357,8 +357,21 @@
64 OverflowPanel {
65 id: tabsPopover
66 objectName: "tabsPopover"
67- tabsOverflow: true
68- model: styledItem.tabsModel
69+ model: actionsFromTabs(styledItem.tabsModel)
70+
71+ function getActionFromTab(tab) {
72+ return tab.__protected.action;
73+ }
74+
75+ function actionsFromTabs(tabsList) {
76+ var result = [];
77+ var tab;
78+ for (var i=0; i < tabsList.count; i++) {
79+ tab = tabsList.get(i).tab;
80+ result.push(getActionFromTab(tab));
81+ }
82+ return result;
83+ }
84 backgroundColor: headerStyle.panelBackgroundColor
85 foregroundColor: headerStyle.panelForegroundColor
86 highlightColor: headerStyle.panelHighlightColor
87@@ -509,7 +522,6 @@
88 }
89 }
90
91- tabsOverflow: false
92 model: actionsContainer.visibleActions.slice(numberOfSlots.used,
93 numberOfSlots.requested)
94 }
95
96=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py'
97--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2015-04-14 21:02:06 +0000
98+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2015-04-20 13:29:38 +0000
99@@ -206,7 +206,8 @@
100
101 try:
102 tab_button = self.get_root_instance().select_single(
103- objectName='tabButton' + str(index))
104+ objectName='select_tab_' + str(index)
105+ + '_header_overflow_button')
106 except dbus.StateNotFoundError:
107 raise _common.ToolkitException(
108 "Tab button {0} not found.".format(index))

Subscribers

People subscribed via source and target branches