Merge lp:~aacid/unity8/roundedCorners into lp:unity8
- roundedCorners
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~aacid/unity8/roundedCorners |
Merge into: | lp:unity8 |
Diff against target: |
617 lines (+305/-78) 15 files modified
plugins/Utils/CMakeLists.txt (+1/-0) plugins/Utils/itemculler.cpp (+57/-0) plugins/Utils/itemculler.h (+46/-0) plugins/Utils/plugin.cpp (+2/-0) qml/Stages/ApplicationWindow.qml (+2/-0) qml/Stages/BottomCornerRounder.qml (+58/-0) qml/Stages/DecoratedWindow.qml (+1/-0) qml/Stages/DesktopStage.qml (+1/-0) qml/Stages/Splash.qml (+87/-76) qml/Stages/SurfaceContainer.qml (+14/-0) tests/mocks/Unity/Application/CMakeLists.txt (+4/-0) tests/mocks/Unity/Application/MirSurfaceItem.cpp (+23/-0) tests/mocks/Unity/Application/MirSurfaceItem.h (+6/-2) tests/mocks/Utils/CMakeLists.txt (+1/-0) tests/mocks/Utils/plugin.cpp (+2/-0) |
To merge this branch: | bzr merge lp:~aacid/unity8/roundedCorners |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity8 CI Bot | continuous-integration | Approve | |
Lukáš Tinkl (community) | Needs Fixing | ||
Review via email: mp+290290@code.launchpad.net |
Commit message
Introduce bottom rounded corners
Description of the change
* Are there any related MPs required for this MP to build/function as expected?
Yes
https:/
https:/
https:/
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
* Did you make sure that your branch does not contain spurious tags?
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
- 2314. By Albert Astals Cid
-
no rounded corners for fullscreen either
- 2315. By Albert Astals Cid
-
Make the Splash also respect rounded corners
Creates an extra temporary texture to draw the Splash but should not be very problematic (hopefully)
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2313
https:/
Executed test runs:
UNSTABLE: https:/
UNSTABLE: https:/
FAILURE: 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:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2315
https:/
Executed test runs:
UNSTABLE: https:/
UNSTABLE: https:/
FAILURE: 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:/
Click here to trigger a rebuild:
https:/
Daniel d'Andrada (dandrader) wrote : | # |
In qml/Stages/
"""
+ * Authors: Michael Zanetti <email address hidden>
"""
- 2316. By Albert Astals Cid
-
No need for Authors:
You can check the bzr log
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2316
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 2317. By Albert Astals Cid
-
Cull the MirSurfaceItem instead of setting it to not visible
We achieve the effect of not rendering it without messing with the visible property that tests and other parts of the chain use (coming occlusion branches)
- 2318. By Albert Astals Cid
-
a bit more of docu
- 2319. By Albert Astals Cid
-
log--
- 2320. By Albert Astals Cid
-
Move to the old code, no need to modify this
- 2321. By Albert Astals Cid
-
eof
- 2322. By Albert Astals Cid
-
Move down the layering from Splash so that it doesn't include the spinner
- 2323. By Albert Astals Cid
-
eof
- 2324. By Albert Astals Cid
-
typos-=2
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2317
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
FAILURE: 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:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2324
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
- 2325. By Albert Astals Cid
-
Merge
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2325
https:/
Executed test runs:
UNSTABLE: https:/
UNSTABLE: https:/
UNSTABLE: 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:/
Click here to trigger a rebuild:
https:/
- 2326. By Albert Astals Cid
-
Merge (still broken, needs work)
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2326
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 2327. By Albert Astals Cid
-
Fix m_shaderEffectS
ource sizing
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2327
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2327
https:/
Executed test runs:
SUCCESS: https:/
FAILURE: https:/
FAILURE: 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:/
Click here to trigger a rebuild:
https:/
- 2328. By Albert Astals Cid
-
Merge
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2328
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
FAILURE: 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:/
Click here to trigger a rebuild:
https:/
- 2329. By Albert Astals Cid
-
better math to get a corner with the radius we asked for
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2329
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:/
Click here to trigger a rebuild:
https:/
- 2330. By Albert Astals Cid
-
Merge
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2330
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:/
Click here to trigger a rebuild:
https:/
Albert Astals Cid (aacid) wrote : | # |
It looks a bit weird as of now when moving the windows, i think it has to do with the windows not being pixel aligned, i'll wait for lp:~dandrader/unity8/pixelAlignedWindow to land to give it another try.
- 2331. By Albert Astals Cid
-
Merge
- 2332. By Albert Astals Cid
-
Merge
Unmerged revisions
- 2332. By Albert Astals Cid
-
Merge
- 2331. By Albert Astals Cid
-
Merge
- 2330. By Albert Astals Cid
-
Merge
- 2329. By Albert Astals Cid
-
better math to get a corner with the radius we asked for
- 2328. By Albert Astals Cid
-
Merge
- 2327. By Albert Astals Cid
-
Fix m_shaderEffectS
ource sizing - 2326. By Albert Astals Cid
-
Merge (still broken, needs work)
- 2325. By Albert Astals Cid
-
Merge
- 2324. By Albert Astals Cid
-
typos-=2
- 2323. By Albert Astals Cid
-
eof
Preview Diff
1 | === modified file 'plugins/Utils/CMakeLists.txt' |
2 | --- plugins/Utils/CMakeLists.txt 2016-06-27 18:45:27 +0000 |
3 | +++ plugins/Utils/CMakeLists.txt 2016-06-29 11:39:03 +0000 |
4 | @@ -28,6 +28,7 @@ |
5 | timezoneFormatter.cpp |
6 | inputeventgenerator.cpp |
7 | deviceconfigparser.cpp |
8 | + itemculler.cpp |
9 | globalfunctions.cpp |
10 | plugin.cpp |
11 | ) |
12 | |
13 | === added file 'plugins/Utils/itemculler.cpp' |
14 | --- plugins/Utils/itemculler.cpp 1970-01-01 00:00:00 +0000 |
15 | +++ plugins/Utils/itemculler.cpp 2016-06-29 11:39:03 +0000 |
16 | @@ -0,0 +1,57 @@ |
17 | +/* |
18 | + * Copyright (C) 2016 Canonical, Ltd. |
19 | + * |
20 | + * This program is free software; you can redistribute it and/or modify |
21 | + * it under the terms of the GNU General Public License as published by |
22 | + * the Free Software Foundation; version 3. |
23 | + * |
24 | + * This program is distributed in the hope that it will be useful, |
25 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
26 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
27 | + * GNU General Public License for more details. |
28 | + * |
29 | + * You should have received a copy of the GNU General Public License |
30 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
31 | + */ |
32 | + |
33 | +#include "itemculler.h" |
34 | + |
35 | +#pragma GCC diagnostic push |
36 | +#pragma GCC diagnostic ignored "-pedantic" |
37 | +#include <private/qquickitem_p.h> |
38 | +#pragma GCC diagnostic pop |
39 | + |
40 | +ItemCuller::ItemCuller(QObject *parent) |
41 | + : QObject(parent) |
42 | +{ |
43 | +} |
44 | + |
45 | +ItemCuller::~ItemCuller() |
46 | +{ |
47 | + if (m_target) { |
48 | + QQuickItemPrivate::get(m_target)->setCulled(false); |
49 | + } |
50 | +} |
51 | + |
52 | +QQuickItem *ItemCuller::target() const |
53 | +{ |
54 | + return m_target; |
55 | +} |
56 | + |
57 | +void ItemCuller::setTarget(QQuickItem *value) |
58 | +{ |
59 | + if (m_target == value) { |
60 | + return; |
61 | + } |
62 | + |
63 | + if (m_target) { |
64 | + QQuickItemPrivate::get(m_target)->setCulled(false); |
65 | + } |
66 | + |
67 | + m_target = value; |
68 | + if (m_target) { |
69 | + QQuickItemPrivate::get(m_target)->setCulled(true); |
70 | + } |
71 | + |
72 | + Q_EMIT targetChanged(value); |
73 | +} |
74 | |
75 | === added file 'plugins/Utils/itemculler.h' |
76 | --- plugins/Utils/itemculler.h 1970-01-01 00:00:00 +0000 |
77 | +++ plugins/Utils/itemculler.h 2016-06-29 11:39:03 +0000 |
78 | @@ -0,0 +1,46 @@ |
79 | +/* |
80 | + * Copyright (C) 2016 Canonical, Ltd. |
81 | + * |
82 | + * This program is free software; you can redistribute it and/or modify |
83 | + * it under the terms of the GNU General Public License as published by |
84 | + * the Free Software Foundation; version 3. |
85 | + * |
86 | + * This program is distributed in the hope that it will be useful, |
87 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
88 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
89 | + * GNU General Public License for more details. |
90 | + * |
91 | + * You should have received a copy of the GNU General Public License |
92 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
93 | + */ |
94 | + |
95 | +#ifndef ITEMCULLER_H |
96 | +#define ITEMCULLER_H |
97 | + |
98 | +#include <QObject> |
99 | +#include <QPointer> |
100 | + |
101 | +class QQuickItem; |
102 | + |
103 | +// Culls an item, i.e. excludes it from the rendering process |
104 | +// without changing the visible property |
105 | +class ItemCuller : public QObject |
106 | +{ |
107 | + Q_OBJECT |
108 | + Q_PROPERTY(QQuickItem* target READ target WRITE setTarget NOTIFY targetChanged) |
109 | + |
110 | +public: |
111 | + ItemCuller(QObject *parent = nullptr); |
112 | + ~ItemCuller(); |
113 | + |
114 | + QQuickItem *target() const; |
115 | + void setTarget(QQuickItem *value); |
116 | + |
117 | +Q_SIGNALS: |
118 | + void targetChanged(QQuickItem *value); |
119 | + |
120 | +private: |
121 | + QPointer<QQuickItem> m_target; |
122 | +}; |
123 | + |
124 | +#endif |
125 | |
126 | === modified file 'plugins/Utils/plugin.cpp' |
127 | --- plugins/Utils/plugin.cpp 2016-04-29 20:07:03 +0000 |
128 | +++ plugins/Utils/plugin.cpp 2016-06-29 11:39:03 +0000 |
129 | @@ -37,6 +37,7 @@ |
130 | #include "applicationsfiltermodel.h" |
131 | #include "inputeventgenerator.h" |
132 | #include "deviceconfigparser.h" |
133 | +#include "itemculler.h" |
134 | #include "globalfunctions.h" |
135 | |
136 | static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine) |
137 | @@ -79,5 +80,6 @@ |
138 | qmlRegisterType<ApplicationsFilterModel>(uri, 0, 1, "ApplicationsFilterModel"); |
139 | qmlRegisterType<InputEventGenerator>(uri, 0, 1, "InputEventGenerator"); |
140 | qmlRegisterType<DeviceConfigParser>(uri, 0, 1, "DeviceConfigParser"); |
141 | + qmlRegisterType<ItemCuller>(uri, 0, 1, "ItemCuller"); |
142 | qmlRegisterSingletonType<GlobalFunctions>(uri, 0, 1, "Functions", createGlobalFunctions); |
143 | } |
144 | |
145 | === modified file 'qml/Stages/ApplicationWindow.qml' |
146 | --- qml/Stages/ApplicationWindow.qml 2016-06-02 12:02:35 +0000 |
147 | +++ qml/Stages/ApplicationWindow.qml 2016-06-29 11:39:03 +0000 |
148 | @@ -46,6 +46,7 @@ |
149 | property alias resizeSurface: surfaceContainer.resizeSurface |
150 | property int requestedWidth: -1 |
151 | property int requestedHeight: -1 |
152 | + property alias roundedBottomCorners: surfaceContainer.roundedBottomCorners |
153 | |
154 | readonly property int minimumWidth: surface ? surface.minimumWidth : 0 |
155 | readonly property int minimumHeight: surface ? surface.minimumHeight : 0 |
156 | @@ -184,6 +185,7 @@ |
157 | backgroundColor: d.splashColor |
158 | headerColor: d.splashColorHeader |
159 | footerColor: d.splashColorFooter |
160 | + roundedBottomCorners: root.roundedBottomCorners |
161 | } |
162 | } |
163 | } |
164 | |
165 | === added file 'qml/Stages/BottomCornerRounder.qml' |
166 | --- qml/Stages/BottomCornerRounder.qml 1970-01-01 00:00:00 +0000 |
167 | +++ qml/Stages/BottomCornerRounder.qml 2016-06-29 11:39:03 +0000 |
168 | @@ -0,0 +1,58 @@ |
169 | +/* |
170 | + * Copyright (C) 2016 Canonical, Ltd. |
171 | + * |
172 | + * This program is free software; you can redistribute it and/or modify |
173 | + * it under the terms of the GNU General Public License as published by |
174 | + * the Free Software Foundation; version 3. |
175 | + * |
176 | + * This program is distributed in the hope that it will be useful, |
177 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
178 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
179 | + * GNU General Public License for more details. |
180 | + * |
181 | + * You should have received a copy of the GNU General Public License |
182 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
183 | + * |
184 | + */ |
185 | + |
186 | +import QtQuick 2.4 |
187 | +import Utils 0.1 |
188 | + |
189 | +ShaderEffect { |
190 | + blending: false |
191 | + |
192 | + property variant textureItem: undefined |
193 | + property variant radius: units.gu(0.5) |
194 | + |
195 | + fragmentShader: " |
196 | + uniform sampler2D textureItem; |
197 | + uniform highp float width; |
198 | + uniform highp float height; |
199 | + uniform highp float radius; |
200 | + varying highp vec2 qt_TexCoord0; |
201 | + |
202 | + void main() |
203 | + { |
204 | + highp vec2 point = vec2(qt_TexCoord0.x * width, qt_TexCoord0.y * height); |
205 | + |
206 | + highp vec2 bottomLeftCircleCenter = vec2(radius, height - radius); |
207 | + if ((point.x < bottomLeftCircleCenter.x) && (point.y >= bottomLeftCircleCenter.y)) { |
208 | + highp float dist = distance(point, bottomLeftCircleCenter); |
209 | + if (dist >= radius - 1.0) { |
210 | + discard; |
211 | + } |
212 | + } else { |
213 | + highp vec2 bottomRightCircleCenter = vec2(width - radius, height - radius); |
214 | + if ((point.x > bottomRightCircleCenter.x) && (point.y >= bottomRightCircleCenter.y)) { |
215 | + highp float dist = distance(point, bottomRightCircleCenter); |
216 | + if (dist >= radius - 1.0) { |
217 | + discard; |
218 | + } |
219 | + } |
220 | + } |
221 | + |
222 | + highp vec4 c = texture2D(textureItem, qt_TexCoord0); |
223 | + gl_FragColor = c; |
224 | + } |
225 | + " |
226 | +} |
227 | |
228 | === modified file 'qml/Stages/DecoratedWindow.qml' |
229 | --- qml/Stages/DecoratedWindow.qml 2016-06-20 10:31:44 +0000 |
230 | +++ qml/Stages/DecoratedWindow.qml 2016-06-29 11:39:03 +0000 |
231 | @@ -51,6 +51,7 @@ |
232 | readonly property int heightIncrement: !counterRotate ? applicationWindow.heightIncrement : applicationWindow.widthIncrement |
233 | |
234 | property alias overlayShown: decoration.overlayShown |
235 | + property alias roundedBottomCorners: applicationWindow.roundedBottomCorners |
236 | |
237 | signal closeClicked() |
238 | signal maximizeClicked() |
239 | |
240 | === modified file 'qml/Stages/DesktopStage.qml' |
241 | --- qml/Stages/DesktopStage.qml 2016-06-27 18:44:07 +0000 |
242 | +++ qml/Stages/DesktopStage.qml 2016-06-29 11:39:03 +0000 |
243 | @@ -669,6 +669,7 @@ |
244 | surface: model.surface |
245 | active: appDelegate.focus |
246 | focus: true |
247 | + roundedBottomCorners: !appDelegate.maximized && !appDelegate.fullscreen |
248 | maximizeButtonShown: (maximumWidth == 0 || maximumWidth >= appContainer.width) && |
249 | (maximumHeight == 0 || maximumHeight >= appContainer.height) |
250 | overlayShown: touchControls.overlayShown |
251 | |
252 | === modified file 'qml/Stages/Splash.qml' |
253 | --- qml/Stages/Splash.qml 2016-05-19 15:22:34 +0000 |
254 | +++ qml/Stages/Splash.qml 2016-06-29 11:39:03 +0000 |
255 | @@ -31,6 +31,7 @@ |
256 | property url icon |
257 | property alias title: header.title |
258 | property alias showHeader: header.visible |
259 | + property bool roundedBottomCorners: false |
260 | |
261 | Ambiance.Palette { |
262 | id: ambiancePalette |
263 | @@ -49,84 +50,94 @@ |
264 | readonly property bool showIcon: overlaidImage.status == Image.Null && !root.showHeader |
265 | } |
266 | |
267 | - StyledItem { |
268 | - id: styledItem |
269 | + Item { |
270 | + id: staticContentItem |
271 | anchors.fill: parent |
272 | |
273 | - // mimic API of toolkit's MainView component required by MainViewStyle |
274 | - property color backgroundColor: Qt.colorEqual(root.backgroundColor, d.undefinedColor) ? d.defaultBackgroundColor |
275 | - : root.backgroundColor |
276 | - property color headerColor: Qt.colorEqual(root.headerColor, d.undefinedColor) ? styledItem.backgroundColor |
277 | - : root.headerColor |
278 | - property color footerColor: Qt.colorEqual(root.footerColor, d.undefinedColor) ? styledItem.backgroundColor |
279 | - : root.footerColor |
280 | - |
281 | - // FIXME: fake a Theme object as to expose the Palette corresponding to the backgroundColor (see MainViewStyle.qml) |
282 | - readonly property var fakeTheme: QtObject { |
283 | - property string name |
284 | - property Palette palette: Qt.createQmlObject("import QtQuick 2.4;\ |
285 | - import Ubuntu.Components.Themes.%1 1.3;\ |
286 | - Palette {}".arg(styledItem.fakeTheme.name), |
287 | - styledItem, "dynamicPalette"); |
288 | - } |
289 | - |
290 | - // FIXME: should instead use future toolkit API: |
291 | - // style: theme.createStyleComponent("MainViewStyle.qml", styledItem) |
292 | - style: Component { MainViewStyle {theme: styledItem.fakeTheme} } |
293 | - } |
294 | - |
295 | - PageHeader { |
296 | - id: header |
297 | - anchors { left: parent.left; right: parent.right } |
298 | - StyleHints { |
299 | - foregroundColor: styledItem.fakeTheme.palette.normal.backgroundText |
300 | - backgroundColor: "transparent" |
301 | - dividerColor: styledItem.fakeTheme.palette.normal.base |
302 | - } |
303 | - } |
304 | - |
305 | - Image { |
306 | - id: overlaidImage |
307 | - anchors.centerIn: parent |
308 | - anchors.verticalCenterOffset: header.visible ? header.height / 2 : 0 |
309 | - sourceSize { |
310 | - width: root.width |
311 | - height: root.height |
312 | - } |
313 | - asynchronous: true |
314 | - cache: false |
315 | - } |
316 | - |
317 | - UbuntuShape { |
318 | - id: iconShape |
319 | - anchors.horizontalCenter: parent.horizontalCenter |
320 | - anchors.verticalCenter: parent.verticalCenter |
321 | - anchors.verticalCenterOffset: -units.gu(4) |
322 | - width: units.gu(8) |
323 | - height: units.gu(7.5) |
324 | - |
325 | - visible: d.showIcon |
326 | - |
327 | - radius: "medium" |
328 | - aspect: UbuntuShape.Flat |
329 | - sourceFillMode: Image.PreserveAspectCrop |
330 | - source: Image { |
331 | - id: iconImage |
332 | - sourceSize.width: iconShape.width |
333 | - sourceSize.height: iconShape.height |
334 | - source: d.showIcon ? root.icon : "" |
335 | - } |
336 | - } |
337 | - |
338 | - Label { |
339 | - text: root.title |
340 | - anchors.horizontalCenter: parent.horizontalCenter |
341 | - anchors.top: iconShape.bottom |
342 | - anchors.topMargin: units.gu(2) |
343 | - fontSize: "large" |
344 | - |
345 | - color: styledItem.fakeTheme.palette.normal.backgroundText |
346 | - visible: d.showIcon |
347 | + StyledItem { |
348 | + id: styledItem |
349 | + anchors.fill: parent |
350 | + |
351 | + // mimic API of toolkit's MainView component required by MainViewStyle |
352 | + property color backgroundColor: Qt.colorEqual(root.backgroundColor, d.undefinedColor) ? d.defaultBackgroundColor |
353 | + : root.backgroundColor |
354 | + property color headerColor: Qt.colorEqual(root.headerColor, d.undefinedColor) ? styledItem.backgroundColor |
355 | + : root.headerColor |
356 | + property color footerColor: Qt.colorEqual(root.footerColor, d.undefinedColor) ? styledItem.backgroundColor |
357 | + : root.footerColor |
358 | + |
359 | + // FIXME: fake a Theme object as to expose the Palette corresponding to the backgroundColor (see MainViewStyle.qml) |
360 | + readonly property var fakeTheme: QtObject { |
361 | + property string name |
362 | + property Palette palette: Qt.createQmlObject("import QtQuick 2.4;\ |
363 | + import Ubuntu.Components.Themes.%1 1.3;\ |
364 | + Palette {}".arg(styledItem.fakeTheme.name), |
365 | + styledItem, "dynamicPalette"); |
366 | + } |
367 | + |
368 | + // FIXME: should instead use future toolkit API: |
369 | + // style: theme.createStyleComponent("MainViewStyle.qml", styledItem) |
370 | + style: Component { MainViewStyle {theme: styledItem.fakeTheme} } |
371 | + } |
372 | + |
373 | + PageHeader { |
374 | + id: header |
375 | + anchors { left: parent.left; right: parent.right } |
376 | + StyleHints { |
377 | + foregroundColor: styledItem.fakeTheme.palette.normal.backgroundText |
378 | + backgroundColor: "transparent" |
379 | + dividerColor: styledItem.fakeTheme.palette.normal.base |
380 | + } |
381 | + } |
382 | + |
383 | + Image { |
384 | + id: overlaidImage |
385 | + anchors.centerIn: parent |
386 | + anchors.verticalCenterOffset: header.visible ? header.height / 2 : 0 |
387 | + sourceSize { |
388 | + width: root.width |
389 | + height: root.height |
390 | + } |
391 | + asynchronous: true |
392 | + cache: false |
393 | + } |
394 | + |
395 | + UbuntuShape { |
396 | + id: iconShape |
397 | + anchors.horizontalCenter: parent.horizontalCenter |
398 | + anchors.verticalCenter: parent.verticalCenter |
399 | + anchors.verticalCenterOffset: -units.gu(4) |
400 | + width: units.gu(8) |
401 | + height: units.gu(7.5) |
402 | + |
403 | + visible: d.showIcon |
404 | + |
405 | + radius: "medium" |
406 | + aspect: UbuntuShape.Flat |
407 | + sourceFillMode: Image.PreserveAspectCrop |
408 | + source: Image { |
409 | + id: iconImage |
410 | + sourceSize.width: iconShape.width |
411 | + sourceSize.height: iconShape.height |
412 | + source: d.showIcon ? root.icon : "" |
413 | + } |
414 | + } |
415 | + |
416 | + Label { |
417 | + text: root.title |
418 | + anchors.horizontalCenter: parent.horizontalCenter |
419 | + anchors.top: iconShape.bottom |
420 | + anchors.topMargin: units.gu(2) |
421 | + fontSize: "large" |
422 | + |
423 | + color: styledItem.fakeTheme.palette.normal.backgroundText |
424 | + visible: d.showIcon |
425 | + } |
426 | + |
427 | + layer.enabled: root.roundedBottomCorners |
428 | + layer.effect: BottomCornerRounder { |
429 | + textureItem: staticContentItem |
430 | + } |
431 | } |
432 | |
433 | Timer { |
434 | |
435 | === modified file 'qml/Stages/SurfaceContainer.qml' |
436 | --- qml/Stages/SurfaceContainer.qml 2016-05-18 21:58:39 +0000 |
437 | +++ qml/Stages/SurfaceContainer.qml 2016-06-29 11:39:03 +0000 |
438 | @@ -37,6 +37,7 @@ |
439 | // FIME - dont export, use interactive property. Need to fix qtmir to handle consumesInputChanged |
440 | // to update surface activeFocus. See mock MirSurfaceItem. |
441 | property alias consumesInput: surfaceItem.consumesInput |
442 | + property bool roundedBottomCorners: false |
443 | |
444 | onSurfaceChanged: { |
445 | // Not a binding because animations might remove the surface from the surfaceItem |
446 | @@ -93,6 +94,19 @@ |
447 | orientationAngle: root.surfaceOrientationAngle |
448 | } |
449 | |
450 | + Loader { |
451 | + anchors.fill: surfaceItem |
452 | + active: root.roundedBottomCorners && surfaceItem.visible |
453 | + |
454 | + sourceComponent: BottomCornerRounder { |
455 | + textureItem: surfaceItem |
456 | + |
457 | + ItemCuller { |
458 | + target: surfaceItem |
459 | + } |
460 | + } |
461 | + } |
462 | + |
463 | TouchGate { |
464 | targetItem: surfaceItem |
465 | anchors.fill: root |
466 | |
467 | === modified file 'tests/mocks/Unity/Application/CMakeLists.txt' |
468 | --- tests/mocks/Unity/Application/CMakeLists.txt 2016-04-04 13:37:49 +0000 |
469 | +++ tests/mocks/Unity/Application/CMakeLists.txt 2016-06-29 11:39:03 +0000 |
470 | @@ -1,3 +1,7 @@ |
471 | +include_directories( |
472 | + ${Qt5Quick_PRIVATE_INCLUDE_DIRS} |
473 | +) |
474 | + |
475 | set(FakeUnityApplicationQml_SOURCES |
476 | plugin.cpp |
477 | ApplicationInfo.cpp |
478 | |
479 | === modified file 'tests/mocks/Unity/Application/MirSurfaceItem.cpp' |
480 | --- tests/mocks/Unity/Application/MirSurfaceItem.cpp 2016-05-26 13:15:35 +0000 |
481 | +++ tests/mocks/Unity/Application/MirSurfaceItem.cpp 2016-06-29 11:39:03 +0000 |
482 | @@ -42,6 +42,7 @@ |
483 | , m_qmlSurface(nullptr) |
484 | , m_qmlContentComponent(nullptr) |
485 | , m_qmlItem(nullptr) |
486 | + , m_shaderEffectSource(this) |
487 | , m_consumesInput(false) |
488 | , m_surfaceWidth(0) |
489 | , m_surfaceHeight(0) |
490 | @@ -62,6 +63,8 @@ |
491 | connect(this, &MirSurfaceItem::consumesInputChanged, this, [this]() { |
492 | updateMirSurfaceActiveFocus(hasActiveFocus()); |
493 | }); |
494 | + |
495 | + m_shaderEffectSource.setHideSource(true); |
496 | } |
497 | |
498 | MirSurfaceItem::~MirSurfaceItem() |
499 | @@ -168,6 +171,8 @@ |
500 | m_qmlItem = qobject_cast<QQuickItem*>(m_qmlContentComponent->create()); |
501 | m_qmlItem->setParentItem(this); |
502 | |
503 | + m_shaderEffectSource.setSourceItem(m_qmlItem); |
504 | + |
505 | setImplicitWidth(m_qmlItem->implicitWidth()); |
506 | setImplicitHeight(m_qmlItem->implicitHeight()); |
507 | |
508 | @@ -233,6 +238,8 @@ |
509 | } |
510 | |
511 | if (m_qmlSurface) { |
512 | + m_shaderEffectSource.setSourceItem(nullptr); |
513 | + |
514 | delete m_qmlItem; |
515 | m_qmlItem = nullptr; |
516 | |
517 | @@ -301,6 +308,15 @@ |
518 | } |
519 | } |
520 | |
521 | +void MirSurfaceItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) |
522 | +{ |
523 | + unity::shell::application::MirSurfaceItemInterface::geometryChanged(newGeometry, oldGeometry); |
524 | + if (newGeometry != oldGeometry) { |
525 | + m_shaderEffectSource.setWidth(newGeometry.width()); |
526 | + m_shaderEffectSource.setHeight(newGeometry.height()); |
527 | + } |
528 | +} |
529 | + |
530 | void MirSurfaceItem::updateMirSurfaceVisibility() |
531 | { |
532 | if (!m_qmlSurface) return; |
533 | @@ -358,3 +374,10 @@ |
534 | Q_EMIT fillModeChanged(m_fillMode); |
535 | } |
536 | } |
537 | + |
538 | +QSGTextureProvider *MirSurfaceItem::textureProvider() const |
539 | +{ |
540 | + // This is so that the fake MirSurfaceItem is a texture provider |
541 | + // the real qtmir is already one without the need for extra layering |
542 | + return m_shaderEffectSource.textureProvider(); |
543 | +} |
544 | |
545 | === modified file 'tests/mocks/Unity/Application/MirSurfaceItem.h' |
546 | --- tests/mocks/Unity/Application/MirSurfaceItem.h 2016-05-09 08:54:11 +0000 |
547 | +++ tests/mocks/Unity/Application/MirSurfaceItem.h 2016-06-29 11:39:03 +0000 |
548 | @@ -25,6 +25,8 @@ |
549 | // unity-api |
550 | #include <unity/shell/application/MirSurfaceItemInterface.h> |
551 | |
552 | +#include <private/qquickshadereffectsource_p.h> |
553 | + |
554 | class MirSurfaceItem : public unity::shell::application::MirSurfaceItemInterface |
555 | { |
556 | Q_OBJECT |
557 | @@ -70,11 +72,11 @@ |
558 | FillMode fillMode() const override { return m_fillMode; } |
559 | void setFillMode(FillMode value) override; |
560 | |
561 | + QSGTextureProvider *textureProvider() const override; |
562 | + |
563 | ///// |
564 | // For use in qml tests |
565 | |
566 | - void setLive(bool live); |
567 | - |
568 | int touchPressCount() const { return m_touchPressCount; } |
569 | void setTouchPressCount(int count) { m_touchPressCount = count; Q_EMIT touchPressCountChanged(count); } |
570 | |
571 | @@ -98,6 +100,7 @@ |
572 | void mousePressEvent(QMouseEvent * event) override; |
573 | void mouseMoveEvent(QMouseEvent * event) override; |
574 | void mouseReleaseEvent(QMouseEvent * event) override; |
575 | + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; |
576 | |
577 | private Q_SLOTS: |
578 | void onComponentStatusChanged(QQmlComponent::Status status); |
579 | @@ -114,6 +117,7 @@ |
580 | |
581 | QQmlComponent *m_qmlContentComponent; |
582 | QQuickItem *m_qmlItem; |
583 | + QQuickShaderEffectSource m_shaderEffectSource; |
584 | |
585 | bool m_consumesInput; |
586 | |
587 | |
588 | === modified file 'tests/mocks/Utils/CMakeLists.txt' |
589 | --- tests/mocks/Utils/CMakeLists.txt 2016-06-02 09:32:33 +0000 |
590 | +++ tests/mocks/Utils/CMakeLists.txt 2016-06-29 11:39:03 +0000 |
591 | @@ -24,6 +24,7 @@ |
592 | ${CMAKE_SOURCE_DIR}/plugins/Utils/inputeventgenerator.cpp |
593 | ${CMAKE_SOURCE_DIR}/plugins/Utils/deviceconfigparser.cpp |
594 | ${CMAKE_SOURCE_DIR}/plugins/Utils/globalfunctions.cpp |
595 | + ${CMAKE_SOURCE_DIR}/plugins/Utils/itemculler.cpp |
596 | ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationManagerInterface.h |
597 | ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationInfoInterface.h |
598 | ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/MirSurfaceInterface.h |
599 | |
600 | === modified file 'tests/mocks/Utils/plugin.cpp' |
601 | --- tests/mocks/Utils/plugin.cpp 2016-04-29 20:07:03 +0000 |
602 | +++ tests/mocks/Utils/plugin.cpp 2016-06-29 11:39:03 +0000 |
603 | @@ -38,6 +38,7 @@ |
604 | #include <applicationsfiltermodel.h> |
605 | #include <inputeventgenerator.h> |
606 | #include <deviceconfigparser.h> |
607 | +#include <itemculler.h> |
608 | #include <globalfunctions.h> |
609 | |
610 | static QObject *createWindowStateStorage(QQmlEngine *engine, QJSEngine *scriptEngine) |
611 | @@ -79,5 +80,6 @@ |
612 | qmlRegisterType<ApplicationsFilterModel>(uri, 0, 1, "ApplicationsFilterModel"); |
613 | qmlRegisterType<InputEventGenerator>(uri, 0, 1, "InputEventGenerator"); |
614 | qmlRegisterType<DeviceConfigParser>(uri, 0, 1, "DeviceConfigParser"); |
615 | + qmlRegisterType<ItemCuller>(uri, 0, 1, "ItemCuller"); |
616 | qmlRegisterSingletonType<GlobalFunctions>(uri, 0, 1, "Functions", createGlobalFunctions); |
617 | } |
Generally works and looks well, except one minor glitch:
the corners are not initially rounded at startup, only slightly later when the window gains the inner surface