Merge lp:~aacid/unity8/previewButtonsDifferentWidth into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Andrea Cimitan
Approved revision: 2656
Merged at revision: 2681
Proposed branch: lp:~aacid/unity8/previewButtonsDifferentWidth
Merge into: lp:unity8
Diff against target: 130 lines (+49/-7)
3 files modified
qml/Dash/Previews/PreviewActionCombo.qml (+13/-2)
qml/Dash/Previews/PreviewActions.qml (+3/-2)
tests/qmltests/Dash/Previews/tst_PreviewActions.qml (+33/-3)
To merge this branch: bzr merge lp:~aacid/unity8/previewButtonsDifferentWidth
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) Approve
Unity8 CI Bot continuous-integration Approve
Review via email: mp+307828@code.launchpad.net

Commit message

Make the PreviewButtons be of the width of the button and not half the total width

half the total width is still the max width and the combos are still all the same width

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2656
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2333/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3071
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1717
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1717
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1717
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3099
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2956
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2956/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2956
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2956/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2956
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2956/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2956
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2956/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2956
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2956/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2956
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2956/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2956
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2956/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2956
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2956/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2956
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2956/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2333/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

Code is fine, failures (I retriggered) shouldn't be related

 * Did you perform an exploratory manual test run of the code change and any related functionality?
y
 * Did CI run pass? If not, please explain why.
not related

review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2656
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2341/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3081
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1727
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1727
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1727
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3109
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2966
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2966/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2966
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2966/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2966
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2966/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2966
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2966/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2966
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2966/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2966
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2966/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2966
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2966/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2966
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2966/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2966
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2966/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2341/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

I noticed that the buttons in the dash appear to have outer shadow - can we at least make them flat and remove the inset? aspect: UbuntuShape.Flat

review: Needs Fixing
Revision history for this message
Albert Astals Cid (aacid) wrote :

The button doesn't really have an aspect, so that's hard to achieve with the current Ubuntu.Button component being used.

Revision history for this message
Andrea Cimitan (cimi) wrote :

We agreed to leave it this way until sdk adds different capability to the button component

review: Approve
2657. By Albert Astals Cid

Design wants more spacing

IMHO this should be part of the SDK button implicitWidth already, but oh well

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Dash/Previews/PreviewActionCombo.qml'
2--- qml/Dash/Previews/PreviewActionCombo.qml 2016-04-01 13:20:27 +0000
3+++ qml/Dash/Previews/PreviewActionCombo.qml 2016-11-02 16:47:23 +0000
4@@ -21,6 +21,7 @@
5 id: root
6
7 implicitHeight: childrenRect.height
8+ implicitWidth: Math.max(moreButton.implicitWidth, column.maxButtonImplicitWidth)
9
10 signal triggeredAction(var actionData)
11
12@@ -39,14 +40,23 @@
13 }
14
15 Column {
16+ id: column
17 anchors {
18 top: moreButton.bottom
19 topMargin: height > 0 ? spacing : 0
20 }
21 objectName: "buttonColumn"
22 spacing: units.gu(1)
23- width: parent.width
24 height: moreButton.expanded ? implicitHeight : 0
25+
26+ property real maxButtonImplicitWidth: 0
27+ function calculateImplicitWidth() {
28+ maxButtonImplicitWidth = 0;
29+ for (var i in children) {
30+ maxButtonImplicitWidth = Math.max(maxButtonImplicitWidth, children[i].implicitWidth);
31+ }
32+ }
33+
34 clip: true
35 Behavior on height {
36 UbuntuNumberAnimation {
37@@ -59,7 +69,8 @@
38
39 delegate: PreviewActionButton {
40 data: modelData
41- width: implicitWidth < root.width ? root.width : implicitWidth
42+ width: root.width
43+ onImplicitWidthChanged: column.calculateImplicitWidth();
44 onClicked: root.triggeredAction(modelData)
45 strokeColor: moreButton.strokeColor
46 }
47
48=== modified file 'qml/Dash/Previews/PreviewActions.qml'
49--- qml/Dash/Previews/PreviewActions.qml 2016-05-27 13:52:27 +0000
50+++ qml/Dash/Previews/PreviewActions.qml 2016-11-02 16:47:23 +0000
51@@ -27,6 +27,7 @@
52
53 implicitHeight: row.height + units.gu(1)
54 readonly property var actions: root.widgetData ? root.widgetData["actions"] : null
55+ readonly property real maxButtonWidth: (width - units.gu(1)) / 2
56
57 Row {
58 id: row
59@@ -40,7 +41,7 @@
60 readonly property bool button: root.actions && root.actions.length == 2
61 readonly property bool combo: root.actions && root.actions.length > 2
62 source: button ? "PreviewActionButton.qml" : (combo ? "PreviewActionCombo.qml" : "")
63- width: (root.width - units.gu(1)) / 2
64+ width: Math.min(root.maxButtonWidth, implicitWidth + units.gu(2))
65 onLoaded: {
66 if (button) {
67 item.data = Qt.binding(function() { return root.actions[1]; });
68@@ -65,7 +66,7 @@
69 data: visible ? root.actions[0] : null
70 visible: root.actions && root.actions.length > 0
71 onTriggeredAction: root.triggered(root.widgetId, actionData.id, actionData)
72- width: (root.width - units.gu(1)) / 2
73+ width: Math.min(root.maxButtonWidth, implicitWidth + units.gu(2))
74 color: root.scopeStyle ? root.scopeStyle.previewButtonColor : theme.palette.normal.positive
75 }
76 }
77
78=== modified file 'tests/qmltests/Dash/Previews/tst_PreviewActions.qml'
79--- tests/qmltests/Dash/Previews/tst_PreviewActions.qml 2016-08-23 12:45:36 +0000
80+++ tests/qmltests/Dash/Previews/tst_PreviewActions.qml 2016-11-02 16:47:23 +0000
81@@ -39,9 +39,27 @@
82 readonly property var actionDataFiveActions: {
83 "actions": [{"label": "Some Label C", "id": "someid3"},
84 {"label": "Some Label D", "id": "someid4"},
85- {"label": "Some Label E", "id": "someid5"},
86- {"label": "Some Label F", "id": "someid6"},
87- {"label": "Some Label G", "id": "someid7"}
88+ {"label": "Some Longer Longer Longer Longer Label E", "id": "someid5"},
89+ {"label": "Some Label F", "id": "someid6"},
90+ {"label": "Some Label G", "id": "someid7"}
91+ ]
92+ }
93+
94+ readonly property var actionDataFiveActions2: {
95+ "actions": [{"label": "Some Label C", "id": "someid3"},
96+ {"label": "Some Label D", "id": "someid4"},
97+ {"label": "Some E", "id": "someid5"},
98+ {"label": "Some Label F", "id": "someid6"},
99+ {"label": "Some Label G", "id": "someid7"}
100+ ]
101+ }
102+
103+ readonly property var actionDataFiveActions3: {
104+ "actions": [{"label": "C", "id": "someid3"},
105+ {"label": "D", "id": "someid4"},
106+ {"label": "E", "id": "someid5"},
107+ {"label": "F", "id": "someid6"},
108+ {"label": "G", "id": "someid7"}
109 ]
110 }
111
112@@ -91,6 +109,18 @@
113 }
114
115 PreviewActions {
116+ id: buttonAndCombo2
117+ widgetData: actionDataFiveActions2
118+ width: units.gu(40)
119+ }
120+
121+ PreviewActions {
122+ id: buttonAndCombo3
123+ widgetData: actionDataFiveActions3
124+ width: units.gu(40)
125+ }
126+
127+ PreviewActions {
128 id: twoActions
129 widgetId: "2buttons"
130 widgetData: actionDataTwoActions

Subscribers

People subscribed via source and target branches