Merge lp:~aacid/unity8/addPaddingBetweenPreviewColumns into lp:unity8
- addPaddingBetweenPreviewColumns
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Andrea Cimitan |
Approved revision: | 2663 |
Merged at revision: | 2679 |
Proposed branch: | lp:~aacid/unity8/addPaddingBetweenPreviewColumns |
Merge into: | lp:unity8 |
Diff against target: |
212 lines (+59/-31) 8 files modified
qml/Dash/Previews/Preview.qml (+19/-7) qml/Dash/Previews/PreviewInlineVideo.qml (+1/-1) qml/Dash/Previews/PreviewVideoPlayback.qml (+1/-1) qml/Dash/Previews/PreviewWidget.qml (+2/-2) qml/Dash/Previews/PreviewWidgetFactory.qml (+2/-2) qml/Dash/Previews/PreviewZoomableImage.qml (+1/-1) tests/mocks/Unity/fake_previewmodel.cpp (+15/-7) tests/mocks/Unity/fake_previewwidgetmodel.cpp (+18/-10) |
To merge this branch: | bzr merge lp:~aacid/unity8/addPaddingBetweenPreviewColumns |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Cimitan (community) | Approve | ||
Unity8 CI Bot | continuous-integration | Approve | |
Review via email: mp+307594@code.launchpad.net |
Commit message
Rework Dash Preview column margins
If there's one column
Preview widgets have 2GU on each side
Unless it's one of the "full screen" widgets, i.e. video/image
This hasn't changed in this patch
If there's two columns
the columns have 4GU on each side and between eachother
This has changed according to design guidelines
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?
It's based on design input.
- 2657. By Albert Astals Cid
-
Default is false (not that it matters but anyway)
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
- 2658. By Albert Astals Cid
-
Put the combo preview at the end, tests want it there
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2658
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Andrea Cimitan (cimi) wrote : | # |
Code is fine, need to double check with design but this is as requested
Andrea Cimitan (cimi) wrote : | # |
I jusr realised, looking at the mockups, that we should have the same 4gu padding also on the top of the columns (so probably 2 in portrait), shall we add these here or a new branch?
Andrea Cimitan (cimi) wrote : | # |
> I jusr realised, looking at the mockups, that we should have the same 4gu
> padding also on the top of the columns (so probably 2 in portrait), shall we
> add these here or a new branch?
if needed lp:~unity-team/unity8/addPaddingBetweenPreviewColumns
Albert Astals Cid (aacid) wrote : | # |
I'm sincerely not convinced http://
I think that doesn't make sense.
- 2659. By Albert Astals Cid
-
Change topMargin based on width
I think it's not a good idea to change the vertical spacing while you do an horizontal resize, but i'm not a designer, so do what Cimi suggested
Albert Astals Cid (aacid) wrote : | # |
Added your changeset anyway.
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2659
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 2660. By Albert Astals Cid
-
top&bottom margin 2gu+clip
- 2661. By Albert Astals Cid
-
No bottom margin
- 2662. By Albert Astals Cid
-
units.gu(2) on the left/right also for the 2 columns scenario
- 2663. By Albert Astals Cid
-
make it just be some margin on the top of the contents, not a fix margin
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2660
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2663
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Andrea Cimitan (cimi) wrote : | # |
* Did you perform an exploratory manual test run of the code change and any related functionality?
yes
* Did CI run pass? If not, please explain why.
it passed
Andrea Cimitan (cimi) wrote : | # |
tests seems to be a bit flaky, can you have a look at it please?
qmltestrunner.
qmltestrunner.
qmltestrunner.
Albert Astals Cid (aacid) wrote : | # |
As discussed last friday the flakyness doesn't seem to be introduced by this branch, right?
Preview Diff
1 | === modified file 'qml/Dash/Previews/Preview.qml' |
2 | --- qml/Dash/Previews/Preview.qml 2016-06-27 18:41:15 +0000 |
3 | +++ qml/Dash/Previews/Preview.qml 2016-10-14 14:58:15 +0000 |
4 | @@ -56,11 +56,12 @@ |
5 | Row { |
6 | id: row |
7 | |
8 | - spacing: units.gu(1) |
9 | - anchors { fill: parent; margins: spacing } |
10 | + spacing: units.gu(4) |
11 | + anchors.fill: parent |
12 | |
13 | - property int columns: width >= units.gu(80) ? 2 : 1 |
14 | - property real columnWidth: width / columns |
15 | + readonly property int columns: width >= units.gu(80) ? 2 : 1 |
16 | + readonly property real columnWidth: (width - (spacing * (columns - 1))) / columns |
17 | + readonly property int singleColumnMargin: units.gu(2) |
18 | |
19 | Repeater { |
20 | model: previewModel |
21 | @@ -72,8 +73,11 @@ |
22 | top: parent.top |
23 | bottom: parent.bottom |
24 | } |
25 | + topMargin: units.gu(2) |
26 | width: row.columnWidth |
27 | - spacing: row.spacing |
28 | + spacing: units.gu(1) |
29 | + |
30 | + readonly property int columnNumber: index |
31 | |
32 | ListViewOSKScroller { |
33 | id: oskScroller |
34 | @@ -96,8 +100,16 @@ |
35 | anchors { |
36 | left: parent.left |
37 | right: parent.right |
38 | - leftMargin: widgetMargins |
39 | - rightMargin: widgetMargins |
40 | + leftMargin: if (row.columns == 1) { |
41 | + return singleColumnMarginless ? 0 : row.singleColumnMargin; |
42 | + } else { |
43 | + return column.columnNumber == 0 ? row.singleColumnMargin : 0; |
44 | + } |
45 | + rightMargin: if (row.columns == 1) { |
46 | + return singleColumnMarginless ? 0 : row.singleColumnMargin; |
47 | + } else { |
48 | + return column.columnNumber == 1 ? row.singleColumnMargin : 0; |
49 | + } |
50 | } |
51 | |
52 | onTriggered: { |
53 | |
54 | === modified file 'qml/Dash/Previews/PreviewInlineVideo.qml' |
55 | --- qml/Dash/Previews/PreviewInlineVideo.qml 2016-07-27 14:25:44 +0000 |
56 | +++ qml/Dash/Previews/PreviewInlineVideo.qml 2016-10-14 14:58:15 +0000 |
57 | @@ -33,7 +33,7 @@ |
58 | implicitWidth: units.gu(35) |
59 | implicitHeight: services.height |
60 | |
61 | - widgetMargins: -units.gu(1) |
62 | + singleColumnMarginless: true |
63 | orientationLock: services.fullscreen |
64 | |
65 | property alias rootItem: services.rootItem |
66 | |
67 | === modified file 'qml/Dash/Previews/PreviewVideoPlayback.qml' |
68 | --- qml/Dash/Previews/PreviewVideoPlayback.qml 2016-05-03 09:45:41 +0000 |
69 | +++ qml/Dash/Previews/PreviewVideoPlayback.qml 2016-10-14 14:58:15 +0000 |
70 | @@ -30,7 +30,7 @@ |
71 | implicitWidth: units.gu(35) |
72 | implicitHeight: childrenRect.height |
73 | |
74 | - widgetMargins: -units.gu(1) |
75 | + singleColumnMarginless: true |
76 | |
77 | LazyImage { |
78 | objectName: "screenshot" |
79 | |
80 | === modified file 'qml/Dash/Previews/PreviewWidget.qml' |
81 | --- qml/Dash/Previews/PreviewWidget.qml 2016-06-01 16:05:12 +0000 |
82 | +++ qml/Dash/Previews/PreviewWidget.qml 2016-10-14 14:58:15 +0000 |
83 | @@ -34,8 +34,8 @@ |
84 | //! Should the orientation be locked |
85 | property bool orientationLock: false |
86 | |
87 | - //! Set margins width. |
88 | - property real widgetMargins: units.gu(1) |
89 | + //! Should it have margins when on a single columns? |
90 | + property bool singleColumnMarginless: false |
91 | |
92 | /// The parent (vertical) flickable this widget is in (if any) |
93 | property var parentFlickable: null |
94 | |
95 | === modified file 'qml/Dash/Previews/PreviewWidgetFactory.qml' |
96 | --- qml/Dash/Previews/PreviewWidgetFactory.qml 2016-06-09 14:45:57 +0000 |
97 | +++ qml/Dash/Previews/PreviewWidgetFactory.qml 2016-10-14 14:58:15 +0000 |
98 | @@ -40,8 +40,8 @@ |
99 | //! Should the orientation be locked |
100 | readonly property bool orientationLock: status === Loader.Ready ? item.orientationLock : false |
101 | |
102 | - //! Set margins width. |
103 | - property real widgetMargins: status === Loader.Ready ? item.widgetMargins : units.gu(1) |
104 | + //! Should it have margins when on a single columns? |
105 | + readonly property bool singleColumnMarginless: status === Loader.Ready ? item.singleColumnMarginless : false |
106 | |
107 | /// The parent (vertical) flickable this widget is in (if any) |
108 | property var parentFlickable: null |
109 | |
110 | === modified file 'qml/Dash/Previews/PreviewZoomableImage.qml' |
111 | --- qml/Dash/Previews/PreviewZoomableImage.qml 2016-06-01 16:05:12 +0000 |
112 | +++ qml/Dash/Previews/PreviewZoomableImage.qml 2016-10-14 14:58:15 +0000 |
113 | @@ -30,7 +30,7 @@ |
114 | implicitWidth: units.gu(35) |
115 | implicitHeight: lazyImage.height |
116 | |
117 | - widgetMargins: -units.gu(1) |
118 | + singleColumnMarginless: true |
119 | orientationLock: overlay.visible |
120 | |
121 | property Item rootItem: QuickUtils.rootItem(root) |
122 | |
123 | === modified file 'tests/mocks/Unity/fake_previewmodel.cpp' |
124 | --- tests/mocks/Unity/fake_previewmodel.cpp 2016-05-26 12:52:24 +0000 |
125 | +++ tests/mocks/Unity/fake_previewmodel.cpp 2016-10-14 14:58:15 +0000 |
126 | @@ -34,22 +34,30 @@ |
127 | , m_loaded(true) |
128 | , m_scope(scope) |
129 | { |
130 | - // we have one column by default |
131 | - PreviewWidgetModel* columnModel = new PreviewWidgetModel(this); |
132 | - m_previewWidgetModels.append(columnModel); |
133 | + setWidgetColumnCount(1); |
134 | connect(this, &PreviewModel::triggered, this, &PreviewModel::triggeredSlot); |
135 | } |
136 | |
137 | void PreviewModel::setWidgetColumnCount(int count) |
138 | { |
139 | - if (count != 1) { |
140 | - qWarning("PreviewModel::setWidgetColumnCount != 1 not implemented"); |
141 | + if (count != widgetColumnCount()) { |
142 | + beginResetModel(); |
143 | + |
144 | + m_previewWidgetModels.clear(); |
145 | + for (int i = 0; i < count; ++i) { |
146 | + PreviewWidgetModel* columnModel = new PreviewWidgetModel(this); |
147 | + m_previewWidgetModels.append(columnModel); |
148 | + } |
149 | + |
150 | + endResetModel(); |
151 | + |
152 | + Q_EMIT widgetColumnCountChanged(); |
153 | } |
154 | } |
155 | |
156 | int PreviewModel::widgetColumnCount() const |
157 | { |
158 | - return 1; |
159 | + return m_previewWidgetModels.size(); |
160 | } |
161 | |
162 | bool PreviewModel::loaded() const |
163 | @@ -64,7 +72,7 @@ |
164 | |
165 | int PreviewModel::rowCount(const QModelIndex&) const |
166 | { |
167 | - return m_previewWidgetModels.size(); |
168 | + return widgetColumnCount(); |
169 | } |
170 | |
171 | QVariant PreviewModel::data(const QModelIndex& index, int role) const |
172 | |
173 | === modified file 'tests/mocks/Unity/fake_previewwidgetmodel.cpp' |
174 | --- tests/mocks/Unity/fake_previewwidgetmodel.cpp 2015-02-11 17:17:20 +0000 |
175 | +++ tests/mocks/Unity/fake_previewwidgetmodel.cpp 2016-10-14 14:58:15 +0000 |
176 | @@ -54,18 +54,26 @@ |
177 | m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data)); |
178 | } |
179 | |
180 | - QVariantMap attributes; |
181 | - QVariantMap buttonData; |
182 | - buttonData["label"] = "Button"; |
183 | - buttonData["id"] = "open_click"; |
184 | - QVariantList buttons; |
185 | - buttons << buttonData << buttonData << buttonData; |
186 | - attributes["actions"] = QVariant::fromValue(buttons); |
187 | - PreviewData* preview_data = new PreviewData(QString("widget-21"), QString("actions"), attributes); |
188 | - m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data)); |
189 | + { |
190 | + QVariantMap attributes; |
191 | + attributes["source"] = QVariant("qrc:///Unity/Application/screenshots/browser@12.png"); |
192 | + PreviewData* preview_data = new PreviewData(QString("widget-22"), QString("image"), attributes); |
193 | + m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data)); |
194 | + } |
195 | + |
196 | + { |
197 | + QVariantMap attributes; |
198 | + QVariantMap buttonData; |
199 | + buttonData["label"] = "Button"; |
200 | + buttonData["id"] = "open_click"; |
201 | + QVariantList buttons; |
202 | + buttons << buttonData << buttonData << buttonData; |
203 | + attributes["actions"] = QVariant::fromValue(buttons); |
204 | + PreviewData* preview_data = new PreviewData(QString("widget-21"), QString("actions"), attributes); |
205 | + m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data)); |
206 | + } |
207 | |
208 | endResetModel(); |
209 | - |
210 | } |
211 | |
212 | int PreviewWidgetModel::rowCount(const QModelIndex&) const |
FAILED: Continuous integration, rev:2657 /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/2312/ /unity8- jenkins. ubuntu. com/job/ build/3046 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= vivid+overlay, testname= qmluitests. sh/1693 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= xenial+ overlay, testname= qmluitests. sh/1693 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= yakkety, testname= qmluitests. sh/1693 /unity8- jenkins. ubuntu. com/job/ build-0- fetch/3074 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 2931 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 2931/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 2931 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 2931/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 2931 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 2931/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 2931 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 2931/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 2931 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 2931/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 2931 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 2931/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 2931 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 2931/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 2931 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 2931/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 2931 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= yakkety/ 2931/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/2312/ rebuild
https:/