Merge lp:~gerboland/unity-api/surfaceSizerCallback into lp:unity-api
- surfaceSizerCallback
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~gerboland/unity-api/surfaceSizerCallback |
Merge into: | lp:unity-api |
Diff against target: |
365 lines (+73/-49) 12 files modified
CMakeLists.txt (+1/-1) debian/changelog (+7/-0) include/unity/shell/application/ApplicationInfoInterface.h (+0/-9) include/unity/shell/application/ApplicationManagerInterface.h (+35/-14) include/unity/shell/application/CMakeLists.txt (+3/-3) test/qmltest/mocks/plugins/Unity/Application/CMakeLists.txt (+1/-1) test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp (+0/-5) test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h (+0/-2) test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp (+15/-7) test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h (+4/-2) test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt (+1/-1) test/qmltest/unity/shell/application/tst_Application.qml (+6/-4) |
To merge this branch: | bzr merge lp:~gerboland/unity-api/surfaceSizerCallback |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michał Sawicz | Needs Fixing | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+230270@code.launchpad.net |
This proposal has been superseded by a proposal from 2014-08-21.
Commit message
AppMan: add surfaceAboutToB
Description of the change
AppMan: add surfaceAboutToB
* Are there any related MPs required for this MP to build/function as expected? Please list.
https:/
https:/
* Did you perform an exploratory manual test run of your code change and any related functionality?
Y
- 157. By Gerry Boland
-
Do not increment lib version, but header version
Gerry Boland (gerboland) wrote : | # |
Michał Sawicz (saviq) : | # |
Michał Sawicz (saviq) wrote : | # |
Oh and document the signature of the callable please. Will it get info about fullscreen, for example?
I wonder if instead we should just pass availableGeometry, with Mir being responsible for policy, should we involve the shell like this?
- 158. By Gerry Boland
-
keep dch quiet
- 159. By Gerry Boland
-
Newer nicer API using properties (just one test failing)
- 160. By Gerry Boland
-
Implement a better mock and set a sensible default - fixes the test
Gerry Boland (gerboland) wrote : | # |
> Oh and document the signature of the callable please. Will it get info about
> fullscreen, for example?
Sadly not, I need to add a feature request for Mir for that. IMO the surface type and other info that we get from a standard Mir surface would be good info to have, opposed to this limited subset.
> I wonder if instead we should just pass availableGeometry, with Mir being
> responsible for policy, should we involve the shell like this?
I dislike this idea, as effectively we'd need to educate Mir about the entire QML scene: which areas are off-limits for a non-fullscreen surfaces, what to do for surfaces of different types, stages, etc. Defining a vocabulary for that would be a nightmare IMO. And if Mir makes a decision that shell doesn't like, shell will immediately impose its will anyway - so where's the gain?
Policy I hope to define in Mir relate more to clients expectations, I want to ensure that client surfaces behave in a consistent way across mir server implementations. Shells should treat client surfaces in ways that they expect, that parent/child relationship is obeyed, focus handing is correct, input is delivered to the correct surface, siblings can attach to eachother/their parent and stay there, things like that.
- 161. By Gerry Boland
-
debump
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:161
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 162. By Gerry Boland
-
Update Changelog to exhibit new api
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:162
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michał Sawicz (saviq) wrote : | # |
> > I wonder if instead we should just pass availableGeometry, with Mir being
> > responsible for policy, should we involve the shell like this?
> I dislike this idea, as effectively we'd need to educate Mir about the entire
> QML scene: which areas are off-limits for a non-fullscreen surfaces, what to
> do for surfaces of different types, stages, etc. Defining a vocabulary for
> that would be a nightmare IMO. And if Mir makes a decision that shell doesn't
> like, shell will immediately impose its will anyway - so where's the gain?
I'm thinking about, for example, initial placement based on previous runs and such. Maybe Mir could (optionally?) give up a preferred position and the shell would come back with the same or changed if not possible in current setup or something. Anyway, later. The gain? More logic shared between Mir shells.
> Policy I hope to define in Mir relate more to clients expectations, I want to
> ensure that client surfaces behave in a consistent way across mir server
> implementations. Shells should treat client surfaces in ways that they expect,
> that parent/child relationship is obeyed, focus handing is correct, input is
> delivered to the correct surface, siblings can attach to eachother/their
> parent and stay there, things like that.
What you said above applies here just as well - shell, if not well behaved - can impose its own will.
- 163. By Gerry Boland
-
[debian] change to UNRELEASED series, to please CI train
Michał Sawicz (saviq) : | # |
Gerry Boland (gerboland) wrote : | # |
> I'm thinking about, for example, initial placement based on previous runs and
> such. Maybe Mir could (optionally?) give up a preferred position and the shell
> would come back with the same or changed if not possible in current setup or
> something. Anyway, later. The gain? More logic shared between Mir shells.
Yeah definitely, that's something Mir can give us, including saving the positions on close so it can inform us where it should re-open.
> > Policy I hope to define in Mir relate more to clients expectations, I want
> to
> > ensure that client surfaces behave in a consistent way across mir server
> > implementations. Shells should treat client surfaces in ways that they
> expect,
> > that parent/child relationship is obeyed, focus handing is correct, input is
> > delivered to the correct surface, siblings can attach to eachother/their
> > parent and stay there, things like that.
>
> What you said above applies here just as well - shell, if not well behaved -
> can impose its own will.
Sure. It's a line we have to walk carefully, but I think it's more important to try guarantee behaviour for clients. Mir can define that policy, and look after surface position/size save/restore, but I don't want to go down the road of trying to educate Mir of everything happening in the QML scene.
Gerry Boland (gerboland) : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:163
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Gerry Boland (gerboland) : | # |
Michał Sawicz (saviq) wrote : | # |
> I tried:
>
> Binding {
> target: ApplicationManager
> property: "surfaceAboutTo
> value: function surfaceSizer(
> surface.width = 400;
> if (surface.appId && surface.appId == "dialer-app") {
> surface.height = 300;
> }
> return surface;
> }
> }
>
> and got this error:
> file://
Hah! Interesting. Can't say I understand. If Binding.value is of type
other than var, how can it be flexible enough? Otherwise if
ApplicationMana
your original approach to assign instead of bind work in any case?
I'd say that's worth a QTBUG.
Gerry Boland (gerboland) wrote : | # |
> > I tried:
> >
> > Binding {
> > target: ApplicationManager
> > property: "surfaceAboutTo
> > value: function surfaceSizer(
> > surface.width = 400;
> > if (surface.appId && surface.appId == "dialer-app") {
> > surface.height = 300;
> > }
> > return surface;
> > }
> > }
> >
> > and got this error:
> > file://
> function to a property of any type other than var.
>
> Hah! Interesting. Can't say I understand. If Binding.value is of type
> other than var, how can it be flexible enough? Otherwise if
> ApplicationMana
> your original approach to assign instead of bind work in any case?
>
> I'd say that's worth a QTBUG.
My guess is that Binding does some naive type checking, and QJSValue is indeed not a QVariant. qtdeclarative5:
I don't create a binding with my original approach, it's a simple assignment. I would guess the only way around this error is to replace QJSValue with a QVariant. What say you?
Michał Sawicz (saviq) wrote : | # |
> My guess is that Binding does some naive type checking, and QJSValue is indeed not a QVariant. qtdeclarative5:
Yeah.
> I don't create a binding with my original approach, it's a simple assignment. I would guess the only way around this error is to replace QJSValue with a QVariant. What say you?
Doesn't sound like that would help, since you'd still need to go through
a Binding and that would complain that function is not a var.
So it looks like assignment is the only way indeed. Worth a QTBUG IMO.
If you can assign something to a property, you should be able to bind to.
Michał Sawicz (saviq) wrote : | # |
Please rebase on lp:~dandrader/unity-api/lifecycle, no need to bump versions over that one then.
- 164. By Gerry Boland
-
Undo application API version bump
- 165. By Gerry Boland
-
Merge lp:dandrader/unity-api/lifecycle and combine changelog entries to one
- 166. By Gerry Boland
-
Remove my changelog tweaks, train will do them
- 167. By Gerry Boland
-
Merge trunk
- 168. By Gerry Boland
-
Merge trunk
- 169. By Gerry Boland
-
Merge trunk
- 170. By Gerry Boland
-
Merge trunk & update changelog
- 171. By Gerry Boland
-
Merge trunk
- 172. By Gerry Boland
-
Add unity::
shell:: application: :Globals - 173. By Gerry Boland
-
Merge trunk
- 174. By Gerry Boland
-
Merge app-focus-state branch as prereq
- 175. By Gerry Boland
-
Document the Global class
- 176. By Gerry Boland
-
Revert 175
- 177. By Gerry Boland
-
Remove old Globals idea
- 178. By Gerry Boland
-
Merge trunk
- 179. By Gerry Boland
-
Merge trunk
- 180. By Gerry Boland
-
Remove bad merge atrifacts
Unmerged revisions
- 180. By Gerry Boland
-
Remove bad merge atrifacts
- 179. By Gerry Boland
-
Merge trunk
- 178. By Gerry Boland
-
Merge trunk
- 177. By Gerry Boland
-
Remove old Globals idea
- 176. By Gerry Boland
-
Revert 175
- 175. By Gerry Boland
-
Document the Global class
- 174. By Gerry Boland
-
Merge app-focus-state branch as prereq
- 173. By Gerry Boland
-
Merge trunk
- 172. By Gerry Boland
-
Add unity::
shell:: application: :Globals - 171. By Gerry Boland
-
Merge trunk
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2014-07-18 15:46:22 +0000 |
3 | +++ CMakeLists.txt 2014-08-21 10:07:55 +0000 |
4 | @@ -133,7 +133,7 @@ |
5 | # API version |
6 | set(UNITY_API_MAJOR 0) |
7 | set(UNITY_API_MINOR 1) |
8 | -set(UNITY_API_MICRO 4) |
9 | +set(UNITY_API_MICRO 5) |
10 | set(UNITY_API_VERSION "${UNITY_API_MAJOR}.${UNITY_API_MINOR}.${UNITY_API_MICRO}") |
11 | |
12 | # API library |
13 | |
14 | === modified file 'debian/changelog' |
15 | --- debian/changelog 2014-08-06 19:32:56 +0000 |
16 | +++ debian/changelog 2014-08-21 10:07:55 +0000 |
17 | @@ -1,3 +1,10 @@ |
18 | +unity-api (7.89-0ubuntu1) UNRELEASED; urgency=medium |
19 | + |
20 | + * AppMan: add surfaceAboutToBeCreatedCallback property to AppMan - allows QML shell override surface creation geometry |
21 | + * ApplicationInfo - add updateScreenshot() and discardScreenshot() |
22 | + |
23 | + -- Daniel d'Andrada <daniel.dandrada@canonical.com> Fri, 08 Aug 2014 06:05:53 -0300 |
24 | + |
25 | unity-api (7.88+14.10.20140806-0ubuntu1) utopic; urgency=medium |
26 | |
27 | [ Michal Hruby ] |
28 | |
29 | === modified file 'include/unity/shell/application/ApplicationInfoInterface.h' |
30 | --- include/unity/shell/application/ApplicationInfoInterface.h 2013-12-11 11:04:11 +0000 |
31 | +++ include/unity/shell/application/ApplicationInfoInterface.h 2014-08-21 10:07:55 +0000 |
32 | @@ -97,13 +97,6 @@ |
33 | */ |
34 | Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged) |
35 | |
36 | - /** |
37 | - * @brief The URL of the app's screenshot to be used with the image provider. |
38 | - * |
39 | - * Holds the URL for the app's screenshot. This URL will change whenever the screenshot updates. |
40 | - */ |
41 | - Q_PROPERTY(QUrl screenshot READ screenshot NOTIFY screenshotChanged) |
42 | - |
43 | protected: |
44 | /// @cond |
45 | ApplicationInfoInterface(const QString &appId, QObject* parent = 0): QObject(parent) { Q_UNUSED(appId) } |
46 | @@ -152,7 +145,6 @@ |
47 | virtual Stage stage() const = 0; |
48 | virtual State state() const = 0; |
49 | virtual bool focused() const = 0; |
50 | - virtual QUrl screenshot() const = 0; |
51 | /// @endcond |
52 | |
53 | Q_SIGNALS: |
54 | @@ -163,7 +155,6 @@ |
55 | void stageChanged(Stage stage); |
56 | void stateChanged(State state); |
57 | void focusedChanged(bool focused); |
58 | - void screenshotChanged(const QUrl &screenshot); |
59 | /// @endcond |
60 | }; |
61 | |
62 | |
63 | === modified file 'include/unity/shell/application/ApplicationManagerInterface.h' |
64 | --- include/unity/shell/application/ApplicationManagerInterface.h 2014-03-10 12:40:25 +0000 |
65 | +++ include/unity/shell/application/ApplicationManagerInterface.h 2014-08-21 10:07:55 +0000 |
66 | @@ -24,6 +24,7 @@ |
67 | |
68 | #include <QtCore/QObject> |
69 | #include <QtCore/QAbstractListModel> |
70 | +#include <QtQml/QJSValue> |
71 | |
72 | namespace unity |
73 | { |
74 | @@ -66,6 +67,36 @@ |
75 | */ |
76 | Q_PROPERTY(bool suspended READ suspended WRITE setSuspended NOTIFY suspendedChanged) |
77 | |
78 | + /** |
79 | + * @brief Register a Javascript function as a callback for when an application is asking to create a new surface |
80 | + * |
81 | + * Registers a Javascript callback function which ApplicationManager will call when an application is asking |
82 | + * Mir to create a new surface. The function is passed a 'surface' object with properties width, height and |
83 | + * appId. The shell can implement this function to return different width & height to override the geometry |
84 | + * requested by the client. |
85 | + * |
86 | + * Example QML: |
87 | + * |
88 | + * function surfaceSizer(surface) { |
89 | + * surface.width = 400; |
90 | + * if (surface.appId && surface.appId == "dialer-app") { |
91 | + * surface.height = 300; |
92 | + * } |
93 | + * return surface; |
94 | + * } |
95 | + * |
96 | + * Component.onCompleted { |
97 | + * ApplicationManager.surfaceAboutToBeCreatedCallback = surfaceSizer; |
98 | + * } |
99 | + * Component.onDestruction { |
100 | + * ApplicationManager.surfaceAboutToBeCreatedCallback = null; |
101 | + * } |
102 | + * |
103 | + * Warning: the function must live in the QML context thread! |
104 | + */ |
105 | + Q_PROPERTY(QJSValue surfaceAboutToBeCreatedCallback READ surfaceAboutToBeCreatedCallback |
106 | + WRITE setSurfaceAboutToBeCreatedCallback NOTIFY surfaceAboutToBeCreatedCallbackChanged) |
107 | + |
108 | protected: |
109 | /// @cond |
110 | ApplicationManagerInterface(QObject* parent = 0): QAbstractListModel(parent) |
111 | @@ -77,7 +108,6 @@ |
112 | m_roleNames.insert(RoleStage, "stage"); |
113 | m_roleNames.insert(RoleState, "state"); |
114 | m_roleNames.insert(RoleFocused, "focused"); |
115 | - m_roleNames.insert(RoleScreenshot, "screenshot"); |
116 | |
117 | connect(this, SIGNAL(rowsInserted(QModelIndex, int, int)), SIGNAL(countChanged())); |
118 | connect(this, SIGNAL(rowsRemoved(QModelIndex, int, int)), SIGNAL(countChanged())); |
119 | @@ -100,7 +130,6 @@ |
120 | RoleStage, |
121 | RoleState, |
122 | RoleFocused, |
123 | - RoleScreenshot, |
124 | }; |
125 | |
126 | /// @cond |
127 | @@ -119,6 +148,9 @@ |
128 | |
129 | virtual bool suspended() const = 0; |
130 | virtual void setSuspended(bool suspended) = 0; |
131 | + |
132 | + virtual QJSValue surfaceAboutToBeCreatedCallback() const = 0; |
133 | + virtual void setSurfaceAboutToBeCreatedCallback(const QJSValue &callback) = 0; |
134 | /// @endcond |
135 | |
136 | /** |
137 | @@ -185,21 +217,10 @@ |
138 | */ |
139 | Q_INVOKABLE virtual bool stopApplication(const QString &appId) = 0; |
140 | |
141 | - /** |
142 | - * @brief Update the screenshot for an application. |
143 | - * |
144 | - * NOTE: Normally the ApplicationManager will update screenshots unfocusing or focusing apps, |
145 | - * However, in cases where you need to show the screenshot while the application is still focused, |
146 | - * you can request the ApplicationManager to update it now. |
147 | - * |
148 | - * @param appId The application for which the screenshot should be updated. |
149 | - * @returns True if the screenshot update operation was scheduled successfully, false otherwise (i.e. the given appId could not be found) |
150 | - */ |
151 | - Q_INVOKABLE virtual bool updateScreenshot(const QString &appId) = 0; |
152 | - |
153 | Q_SIGNALS: |
154 | /// @cond |
155 | void countChanged(); |
156 | + void surfaceAboutToBeCreatedCallbackChanged(); |
157 | /// @endcond |
158 | |
159 | /** |
160 | |
161 | === modified file 'include/unity/shell/application/CMakeLists.txt' |
162 | --- include/unity/shell/application/CMakeLists.txt 2014-03-04 10:50:44 +0000 |
163 | +++ include/unity/shell/application/CMakeLists.txt 2014-08-21 10:07:55 +0000 |
164 | @@ -7,10 +7,10 @@ |
165 | |
166 | set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) |
167 | |
168 | -set(VERSION 2) |
169 | -set(PKGCONFIG_NAME "unity-shell-appliction") |
170 | +set(VERSION 3) |
171 | +set(PKGCONFIG_NAME "unity-shell-application") |
172 | set(PKGCONFIG_DESCRIPTION "Unity shell Application APIs") |
173 | -set(PKGCONFIG_REQUIRES "Qt5Core") |
174 | +set(PKGCONFIG_REQUIRES "Qt5Core Qt5Qml") |
175 | set(PKGCONFIG_FILE unity-shell-application.pc) |
176 | |
177 | configure_file(${CMAKE_SOURCE_DIR}/data/unity-shell-api.pc.in |
178 | |
179 | === modified file 'test/qmltest/mocks/plugins/Unity/Application/CMakeLists.txt' |
180 | --- test/qmltest/mocks/plugins/Unity/Application/CMakeLists.txt 2013-08-29 12:54:56 +0000 |
181 | +++ test/qmltest/mocks/plugins/Unity/Application/CMakeLists.txt 2014-08-21 10:07:55 +0000 |
182 | @@ -19,7 +19,7 @@ |
183 | |
184 | add_library(ApplicationMocks SHARED ${ApplicationMocks_SOURCES}) |
185 | |
186 | -qt5_use_modules(ApplicationMocks Core) |
187 | +qt5_use_modules(ApplicationMocks Core Qml) |
188 | |
189 | set(TestApplicationPlugin_SOURCES |
190 | TestApplicationPlugin.cpp |
191 | |
192 | === modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp' |
193 | --- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2013-12-11 11:28:22 +0000 |
194 | +++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2014-08-21 10:07:55 +0000 |
195 | @@ -54,11 +54,6 @@ |
196 | return m_icon; |
197 | } |
198 | |
199 | -QUrl MockApplicationInfo::screenshot() const |
200 | -{ |
201 | - return m_screenshot; |
202 | -} |
203 | - |
204 | ApplicationInfoInterface::Stage MockApplicationInfo::stage() const |
205 | { |
206 | return m_stage; |
207 | |
208 | === modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h' |
209 | --- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2013-12-11 11:28:22 +0000 |
210 | +++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2014-08-21 10:07:55 +0000 |
211 | @@ -36,7 +36,6 @@ |
212 | QString name() const; |
213 | QString comment() const; |
214 | QUrl icon() const; |
215 | - QUrl screenshot() const; |
216 | |
217 | ApplicationInfoInterface::Stage stage() const; |
218 | void setStage(ApplicationInfoInterface::Stage stage); |
219 | @@ -52,7 +51,6 @@ |
220 | QString m_name; |
221 | QString m_comment; |
222 | QUrl m_icon; |
223 | - QUrl m_screenshot; |
224 | ApplicationInfoInterface::Stage m_stage; |
225 | ApplicationInfoInterface::State m_state; |
226 | bool m_focused; |
227 | |
228 | === modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp' |
229 | --- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2014-05-23 08:35:43 +0000 |
230 | +++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2014-08-21 10:07:55 +0000 |
231 | @@ -22,7 +22,9 @@ |
232 | |
233 | using namespace unity::shell::application; |
234 | |
235 | -MockApplicationManager::MockApplicationManager(QObject* parent): ApplicationManagerInterface(parent) |
236 | +MockApplicationManager::MockApplicationManager(QObject* parent) |
237 | + : ApplicationManagerInterface(parent) |
238 | + , m_surfaceAboutToBeCreatedCallback(QJSValue::UndefinedValue) |
239 | { |
240 | MockApplicationInfo *item = new MockApplicationInfo("phone-app", "Phone App", "Telephony application", QUrl("/usr/share/pixmaps/some/icon.png"), this); |
241 | m_list.append(item); |
242 | @@ -66,8 +68,6 @@ |
243 | return item->state(); |
244 | case RoleFocused: |
245 | return item->focused(); |
246 | - case RoleScreenshot: |
247 | - return item->screenshot(); |
248 | } |
249 | |
250 | return QVariant(); |
251 | @@ -139,8 +139,16 @@ |
252 | return true; |
253 | } |
254 | |
255 | -bool MockApplicationManager::updateScreenshot(const QString &appId) |
256 | -{ |
257 | - Q_UNUSED(appId) |
258 | - return true; |
259 | +QJSValue MockApplicationManager::surfaceAboutToBeCreatedCallback() const |
260 | +{ |
261 | + return m_surfaceAboutToBeCreatedCallback; |
262 | +} |
263 | + |
264 | +void MockApplicationManager::setSurfaceAboutToBeCreatedCallback(const QJSValue &callback) |
265 | +{ |
266 | + if (m_surfaceAboutToBeCreatedCallback.equals(callback)) |
267 | + return; |
268 | + |
269 | + m_surfaceAboutToBeCreatedCallback = callback; |
270 | + Q_EMIT surfaceAboutToBeCreatedCallbackChanged(); |
271 | } |
272 | |
273 | === modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h' |
274 | --- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2014-03-10 12:34:16 +0000 |
275 | +++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2014-08-21 10:07:55 +0000 |
276 | @@ -43,6 +43,9 @@ |
277 | bool suspended() const; |
278 | void setSuspended(bool suspended); |
279 | |
280 | + QJSValue surfaceAboutToBeCreatedCallback() const; |
281 | + void setSurfaceAboutToBeCreatedCallback(const QJSValue &callback); |
282 | + |
283 | Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *get(const int index) const; |
284 | |
285 | Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const; |
286 | @@ -57,10 +60,9 @@ |
287 | |
288 | Q_INVOKABLE bool stopApplication(const QString &appId); |
289 | |
290 | - Q_INVOKABLE bool updateScreenshot(const QString &appId); |
291 | - |
292 | private: |
293 | QList<MockApplicationInfo*> m_list; |
294 | + QJSValue m_surfaceAboutToBeCreatedCallback; |
295 | }; |
296 | |
297 | #endif // MOCKAPPLICATIONMANAGER_H |
298 | |
299 | === modified file 'test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt' |
300 | --- test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt 2013-09-11 15:28:22 +0000 |
301 | +++ test/qmltest/mocks/plugins/Unity/Launcher/CMakeLists.txt 2014-08-21 10:07:55 +0000 |
302 | @@ -27,7 +27,7 @@ |
303 | |
304 | add_library(LauncherMocks SHARED ${LauncherMocks_SOURCES}) |
305 | |
306 | -qt5_use_modules(LauncherMocks Core) |
307 | +qt5_use_modules(LauncherMocks Core Qml) |
308 | |
309 | set(TestLauncherPlugin_SOURCES |
310 | TestLauncherPlugin.cpp |
311 | |
312 | === modified file 'test/qmltest/unity/shell/application/tst_Application.qml' |
313 | --- test/qmltest/unity/shell/application/tst_Application.qml 2014-03-10 12:34:16 +0000 |
314 | +++ test/qmltest/unity/shell/application/tst_Application.qml 2014-08-21 10:07:55 +0000 |
315 | @@ -59,6 +59,11 @@ |
316 | } |
317 | } |
318 | |
319 | + function initTestCase() { |
320 | + function surfaceSizer(surface) { return surface; } |
321 | + ApplicationManager.surfaceAboutToBeCreatedCallback = surfaceSizer; |
322 | + } |
323 | + |
324 | /* make sure all the required roles are exposed on ApplicationManager */ |
325 | function test_model_roles_enum_data() { |
326 | return [ |
327 | @@ -69,7 +74,6 @@ |
328 | { enum: "RoleStage" }, |
329 | { enum: "RoleState" }, |
330 | { enum: "RoleFocused" }, |
331 | - { enum: "RoleScreenshot" }, |
332 | ]; |
333 | } |
334 | |
335 | @@ -89,7 +93,6 @@ |
336 | { tag: "ApplicationManager.roles[stage]", role: "stage", type: "number" }, |
337 | { tag: "ApplicationManager.roles[state]", role: "state", type: "number" }, |
338 | { tag: "ApplicationManager.roles[focused]", role: "focused", type: "boolean" }, |
339 | - { tag: "ApplicationManager.roles[screenshot]", role: "screenshot", type: "object" }, |
340 | ]; |
341 | } |
342 | |
343 | @@ -113,7 +116,6 @@ |
344 | { tag: "ApplicationManager.methods[unfocusCurrentApplication]", method: "unfocusCurrentApplication" }, |
345 | { tag: "ApplicationManager.methods[startApplication]", method: "startApplication" }, |
346 | { tag: "ApplicationManager.methods[stopApplication]", method: "stopApplication" }, |
347 | - { tag: "ApplicationManager.methods[updateScreenshot]", method: "updateScreenshot" }, |
348 | ]; |
349 | } |
350 | |
351 | @@ -128,6 +130,7 @@ |
352 | { tag: "ApplicationManager.count", property: "count", type: "number" }, |
353 | { tag: "ApplicationManager.focusedApplicationId", property: "focusedApplicationId", type: "string" }, |
354 | { tag: "ApplicationManager.suspended", property: "suspended", type: "boolean" }, |
355 | + { tag: "ApplicationManager.surfaceAboutToBeCreatedCallback", property: "surfaceAboutToBeCreatedCallback", type: "function" }, |
356 | ]; |
357 | } |
358 | |
359 | @@ -146,7 +149,6 @@ |
360 | { tag: "ApplicationInfo.properties[stage]", property: "stage", type: "number" }, |
361 | { tag: "ApplicationInfo.properties[state]", property: "state", type: "number" }, |
362 | { tag: "ApplicationInfo.properties[focused]", property: "focused", type: "boolean" }, |
363 | - { tag: "ApplicationInfo.properties[screenshot]", property: "screenshot", type: "object" }, |
364 | ]; |
365 | } |
366 |
<Saviq> greyback, wonder, could this not ba Q_PROPERTY?
Maybe it could, in which case the API would be prettier. I'll see if it works