Merge lp:~gerboland/unity-api/appManVersion2 into lp:unity-api
- appManVersion2
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~gerboland/unity-api/appManVersion2 |
Merge into: | lp:unity-api |
Diff against target: |
527 lines (+187/-103) 9 files modified
debian/changelog (+6/-0) include/unity/shell/application/ApplicationInfoInterface.h (+29/-6) include/unity/shell/application/ApplicationManagerInterface.h (+31/-40) include/unity/shell/application/CMakeLists.txt (+1/-1) test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp (+7/-1) test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h (+15/-13) test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp (+14/-16) test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h (+19/-23) test/qmltest/unity/shell/application/tst_Application.qml (+65/-3) |
To merge this branch: | bzr merge lp:~gerboland/unity-api/appManVersion2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Zanetti (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+219403@code.launchpad.net |
This proposal supersedes a proposal from 2014-05-01.
Commit message
Revised ApplicationManager and ApplicationInfo APIs to ease transition to the QtMirCompositor project
Description of the change
Revised ApplicationManager and ApplicationInfo APIs for QtMirCompositor project
* 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
* Did you make sure that your branch does not contain spurious tags?
Y
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Y
* If you changed the UI, has there been a design review?
N/A - no UI change
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal | # |
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
On 01.05.2014 15:11, Michael Zanetti wrote:
> ====
>
> 20 + Q_PROPERTY(Stages supportedStages READ supportedStages NOTIFY supportedStages
>
> Do we assume that if an app claims support for both stages, all of its surfaces will support them? Probably yes.
When thinking about stages, we're only considering single-surface apps.
So yes.
Gerry Boland (gerboland) wrote : Posted in a previous version of this proposal | # |
> Here's a couple of comments of things we should think of. Not necessarily
> disagreeing with them, just worth a though/discussion imo:
Sure. I'm just making up stuff as I go along
> 20 + Q_PROPERTY(Stages supportedStages READ supportedStages NOTIFY
> supportedStages
> Do we assume that if an app claims support for both stages, all of its
> surfaces will support them? Probably yes.
Yes. This is property of an application. If it claims to support a stage, then its surface can be resized to suit that stage, and it can't stop that. One app can't have surfaces on both stage either. Note also that "stage" is a property shell will have to save when the app is closed, so user preference is retained.
> 31 + * Holds the current application focus state. True if a surface of
> this application is focused, false otherwise.
> Really needed? what would we gain with this information? Wouldn't it make more
> sense to obtain it the other was round? For instance:
I kept this as I thought it would make the job of the launcher easier. I can remove if you don't think it's worth it.
> 78 + Q_INVOKABLE virtual bool suspend() = 0;
> 89 + Q_INVOKABLE virtual bool resume() = 0;
>
> Where would you call this from? I'm not sure if we should expose this to unity
> but rather handle this stuff internally in the applicationmanager. We might
> add something like inhibitSuspension() at a later point if we want to give the
> user control over it.
>
> Also it doesn't really match with the existing API, given that we have
> startApplication() and stopApplication() in ApplicationManager (not
> ApplicationInfo) such things should be at the same place. If we decide to
> expose this to the shell, I'm not opposed to have them in both places
> (ApplicationMan
> ApplicationInfo
Not a bad point. I thought it a good idea to have shell decide when to suspend/resume apps, as only shell really knows what is visible or not, and shell implements the policy (on phone/tablet, all non-visible apps suspended, on desktop can be more flexible, maybe apps can opt-in to being suspended). I've been trying to make AppMan device independent, because I fear having some policy in AppMan, and some in shell, will end up with conflicts.
Another way this could be done by shell setting the surface visible flags, and if all an app's surfaces are hidden, it can be suspended. But then we tie rendering control to lifecycle control, which I don't like.
You're right, the API is not consistent. Will look more.
> ====
>
> 301 void setFocused(bool focused);
>
> What would this do?
That was in the Mock before. I dunno why it's there. I can remove
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal | # |
> > 31 + * Holds the current application focus state. True if a surface of
> > this application is focused, false otherwise.
> > Really needed? what would we gain with this information? Wouldn't it make
> more
> > sense to obtain it the other was round? For instance:
> I kept this as I thought it would make the job of the launcher easier. I can
> remove if you don't think it's worth it.
Right... Works for me. Thanks for caring about the Launcher :)
>
>
>
> > 78 + Q_INVOKABLE virtual bool suspend() = 0;
> > 89 + Q_INVOKABLE virtual bool resume() = 0;
> >
> > Where would you call this from? I'm not sure if we should expose this to
> unity
> > but rather handle this stuff internally in the applicationmanager. We might
> > add something like inhibitSuspension() at a later point if we want to give
> the
> > user control over it.
> >
> > Also it doesn't really match with the existing API, given that we have
> > startApplication() and stopApplication() in ApplicationManager (not
> > ApplicationInfo) such things should be at the same place. If we decide to
> > expose this to the shell, I'm not opposed to have them in both places
> > (ApplicationMan
> > ApplicationInfo
>
> Not a bad point. I thought it a good idea to have shell decide when to
> suspend/resume apps, as only shell really knows what is visible or not, and
> shell implements the policy (on phone/tablet, all non-visible apps suspended,
> on desktop can be more flexible, maybe apps can opt-in to being suspended).
> I've been trying to make AppMan device independent, because I fear having some
> policy in AppMan, and some in shell, will end up with conflicts.
You're right... Makes more sense in the shell. I was still thinking too much like the old approach. But now that focused is something that's only available in QML this obviously doesn't work the old way any more.
>
> Another way this could be done by shell setting the surface visible flags, and
> if all an app's surfaces are hidden, it can be suspended. But then we tie
> rendering control to lifecycle control, which I don't like.
Yeah... doesn't sound much better than the above.
>
> You're right, the API is not consistent. Will look more.
Jup... Again, I'm fine with having them in both. We need to keep startApplication() in AppMan which makes it natural to have stopApplication() there too, and with it suspend/resume. But I can see how it would be convenient to have that as an ApplicationInfo object's property in QML.
So I'd probably go for
ApplicationManager:
startApplication()
stopApplication()
suspendApplicat
resumeApplication()
and ApplicationInfo:
stop()
Q_PROPERTY(
We can even implement and test those in the abstract interface so there's little risk an implementation would get them out of sync.
kevin gunn (kgunn72) wrote : Posted in a previous version of this proposal | # |
> > Here's a couple of comments of things we should think of. Not necessarily
> > disagreeing with them, just worth a though/discussion imo:
> Sure. I'm just making up stuff as I go along
>
>
> > 20 + Q_PROPERTY(Stages supportedStages READ supportedStages NOTIFY
> > supportedStages
> > Do we assume that if an app claims support for both stages, all of its
> > surfaces will support them? Probably yes.
> Yes. This is property of an application. If it claims to support a stage, then
> its surface can be resized to suit that stage, and it can't stop that. One app
> can't have surfaces on both stage either. Note also that "stage" is a property
> shell will have to save when the app is closed, so user preference is
> retained.
>
So my comment/question might be irrelevant. But I could foresee that trusted sessions might create a case where an app could be open on mainstage but invoked for a second surface within the trust session on side stage (or vice versa). Would your assumptions/
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
On 01.05.2014 20:30, kevin gunn wrote:
> So my comment/question might be irrelevant. But I could foresee that trusted sessions might create a case where an app could be open on mainstage but invoked for a second surface within the trust session on side stage (or vice versa). Would your assumptions/
The second surface will not be an app, it will be just a surface, from a
separate process, it will be part of the original "invoking" app.
So no, everything's good here.
Gerry Boland (gerboland) wrote : Posted in a previous version of this proposal | # |
> Jup... Again, I'm fine with having them in both. We need to keep
> startApplication() in AppMan which makes it natural to have stopApplication()
> there too, and with it suspend/resume. But I can see how it would be
> convenient to have that as an ApplicationInfo object's property in QML.
>
> So I'd probably go for
> ApplicationManager:
> startApplication()
> stopApplication()
> suspendApplicat
> resumeApplication()
Ok, I can do those
> and ApplicationInfo:
> Q_PROPERTY(
This one I'm not so sure about. We already use 'state' to get the process state, so adding the "suspended" property duplicates info. I also dislike it as some apps are excluded from lifecycle, so shell setting myApp.suspended
I prefer just using the first part of your proposal - with {suspend,
I don't think shell really needs to know if an app is lifecycle-exempt, but it would care if suspendApplication returns false. Main use-case I can think of is there's no need for shell to save a screenshot to disk for a lifecycle-exempt app's surface, as there's no way that app will be killed.
> stop()
I might leave this out for the time being, just for ease of implementation, if you don't mind.
Also maybe just putting the process control methods (start/
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal | # |
ack. works for me
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal | # |
The stages and State enums are not tested. Can you please add a test that checks for all the values, but also that Stages are flags and can be used as such in QML?
===
Now that Stages are flags, we need to define their values explicitly in the enum definition. Now we have 0 and 1. ORing them loses information about 0.
===
Otherwise I think we're good now in terms of the API itself.
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal | # |
I guess we should bump the package version too
Michael Zanetti (mzanetti) wrote : | # |
the changelog in unity-api changed by now and conflicts.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:144
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 151. By Gerry Boland
-
debian: package version 7.90
Gerry Boland (gerboland) wrote : | # |
I've resumed work on this branch after a long delay
Main changes:
- I restored the "screenshot" taking methods and role in the AppManager model, as they are useful for generating the Dash App's lens application snapshot images
- Bumped debian package version to 7.90
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:150
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:151
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:169
http://
Executed test runs:
None: http://
None: http://
None: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:151
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Unmerged revisions
- 151. By Gerry Boland
-
debian: package version 7.90
- 150. By Gerry Boland
-
Merge trunk
- 149. By Gerry Boland
-
changelog correction
- 148. By Gerry Boland
-
Update changelog
- 147. By Gerry Boland
-
Merge trunk
- 146. By Gerry Boland
-
Restore the Application screenshot API for now
- 145. By Gerry Boland
-
Resolve conflict
- 144. By Gerry Boland
-
Bump debian version
- 143. By Gerry Boland
-
Add test for flags operator |
- 142. By Gerry Boland
-
Add tests to verify state & stage enums
Preview Diff
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2014-06-16 14:45:10 +0000 | |||
3 | +++ debian/changelog 2014-06-24 23:00:14 +0000 | |||
4 | @@ -1,3 +1,9 @@ | |||
5 | 1 | unity-api (7.90) UNRELEASED; urgency=medium | ||
6 | 2 | |||
7 | 3 | * Version 3 of ApplicationManager and ApplicationInfo APIs, in preparation for QtCompositor | ||
8 | 4 | |||
9 | 5 | -- Gerry Boland <gerry.boland@canonical.com> Thu, 19 Jun 2014 12:46:15 +0100 | ||
10 | 6 | |||
11 | 1 | unity-api (7.82+14.10.20140616-0ubuntu1) utopic; urgency=medium | 7 | unity-api (7.82+14.10.20140616-0ubuntu1) utopic; urgency=medium |
12 | 2 | 8 | ||
13 | 3 | [ Albert Astals Cid ] | 9 | [ Albert Astals Cid ] |
14 | 4 | 10 | ||
15 | === modified file 'include/unity/shell/application/ApplicationInfoInterface.h' | |||
16 | --- include/unity/shell/application/ApplicationInfoInterface.h 2013-12-11 11:04:11 +0000 | |||
17 | +++ include/unity/shell/application/ApplicationInfoInterface.h 2014-06-24 23:00:14 +0000 | |||
18 | @@ -45,6 +45,7 @@ | |||
19 | 45 | 45 | ||
20 | 46 | Q_ENUMS(Stage) | 46 | Q_ENUMS(Stage) |
21 | 47 | Q_ENUMS(State) | 47 | Q_ENUMS(State) |
22 | 48 | Q_FLAGS(Stages) | ||
23 | 48 | 49 | ||
24 | 49 | /** | 50 | /** |
25 | 50 | * @brief The appId of the application. | 51 | * @brief The appId of the application. |
26 | @@ -84,6 +85,13 @@ | |||
27 | 84 | Q_PROPERTY(Stage stage READ stage NOTIFY stageChanged) | 85 | Q_PROPERTY(Stage stage READ stage NOTIFY stageChanged) |
28 | 85 | 86 | ||
29 | 86 | /** | 87 | /** |
30 | 88 | * @brief The stages the application supports. | ||
31 | 89 | * | ||
32 | 90 | * OR-combination of Stage enum values denoting the stages this application supports. | ||
33 | 91 | */ | ||
34 | 92 | Q_PROPERTY(Stages supportedStages READ supportedStages NOTIFY supportedStagesChanged) | ||
35 | 93 | |||
36 | 94 | /** | ||
37 | 87 | * @brief The application's state. | 95 | * @brief The application's state. |
38 | 88 | * | 96 | * |
39 | 89 | * Holds the current application state. | 97 | * Holds the current application state. |
40 | @@ -93,7 +101,7 @@ | |||
41 | 93 | /** | 101 | /** |
42 | 94 | * @brief The application's focus state. | 102 | * @brief The application's focus state. |
43 | 95 | * | 103 | * |
45 | 96 | * Holds the current application focus state. True if focused, false otherwise. | 104 | * Holds the current application focus state. True if a surface of this application is focused, false otherwise. |
46 | 97 | */ | 105 | */ |
47 | 98 | Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged) | 106 | Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged) |
48 | 99 | 107 | ||
49 | @@ -104,6 +112,7 @@ | |||
50 | 104 | */ | 112 | */ |
51 | 105 | Q_PROPERTY(QUrl screenshot READ screenshot NOTIFY screenshotChanged) | 113 | Q_PROPERTY(QUrl screenshot READ screenshot NOTIFY screenshotChanged) |
52 | 106 | 114 | ||
53 | 115 | |||
54 | 107 | protected: | 116 | protected: |
55 | 108 | /// @cond | 117 | /// @cond |
56 | 109 | ApplicationInfoInterface(const QString &appId, QObject* parent = 0): QObject(parent) { Q_UNUSED(appId) } | 118 | ApplicationInfoInterface(const QString &appId, QObject* parent = 0): QObject(parent) { Q_UNUSED(appId) } |
57 | @@ -119,9 +128,10 @@ | |||
58 | 119 | * applications. | 128 | * applications. |
59 | 120 | */ | 129 | */ |
60 | 121 | enum Stage { | 130 | enum Stage { |
63 | 122 | MainStage, | 131 | MainStage = 0x01, |
64 | 123 | SideStage | 132 | SideStage = 0x02, |
65 | 124 | }; | 133 | }; |
66 | 134 | Q_DECLARE_FLAGS(Stages, Stage) | ||
67 | 125 | 135 | ||
68 | 126 | /** | 136 | /** |
69 | 127 | * @brief An application's state. | 137 | * @brief An application's state. |
70 | @@ -150,19 +160,30 @@ | |||
71 | 150 | virtual QString comment() const = 0; | 160 | virtual QString comment() const = 0; |
72 | 151 | virtual QUrl icon() const = 0; | 161 | virtual QUrl icon() const = 0; |
73 | 152 | virtual Stage stage() const = 0; | 162 | virtual Stage stage() const = 0; |
74 | 163 | virtual Stages supportedStages() const = 0; | ||
75 | 153 | virtual State state() const = 0; | 164 | virtual State state() const = 0; |
76 | 154 | virtual bool focused() const = 0; | 165 | virtual bool focused() const = 0; |
77 | 155 | virtual QUrl screenshot() const = 0; | 166 | virtual QUrl screenshot() const = 0; |
78 | 156 | /// @endcond | 167 | /// @endcond |
79 | 157 | 168 | ||
80 | 169 | /** | ||
81 | 170 | * @brief Set stage | ||
82 | 171 | * | ||
83 | 172 | * Applications may not support all stages, so this method only returns true if the stage is supported. | ||
84 | 173 | * @returns true if stage supported so value set, false if not supported. | ||
85 | 174 | */ | ||
86 | 175 | Q_INVOKABLE virtual bool setStage(const Stage) = 0; | ||
87 | 176 | |||
88 | 177 | |||
89 | 158 | Q_SIGNALS: | 178 | Q_SIGNALS: |
90 | 159 | /// @cond | 179 | /// @cond |
91 | 160 | void nameChanged(const QString &name); | 180 | void nameChanged(const QString &name); |
92 | 161 | void commentChanged(const QString &comment); | 181 | void commentChanged(const QString &comment); |
93 | 162 | void iconChanged(const QUrl &icon); | 182 | void iconChanged(const QUrl &icon); |
97 | 163 | void stageChanged(Stage stage); | 183 | void stageChanged(const Stage stage); |
98 | 164 | void stateChanged(State state); | 184 | void supportedStagesChanged(const Stages stages); |
99 | 165 | void focusedChanged(bool focused); | 185 | void stateChanged(const State state); |
100 | 186 | void focusedChanged(const bool focused); | ||
101 | 166 | void screenshotChanged(const QUrl &screenshot); | 187 | void screenshotChanged(const QUrl &screenshot); |
102 | 167 | /// @endcond | 188 | /// @endcond |
103 | 168 | }; | 189 | }; |
104 | @@ -171,4 +192,6 @@ | |||
105 | 171 | } // namespace shell | 192 | } // namespace shell |
106 | 172 | } // namespace unity | 193 | } // namespace unity |
107 | 173 | 194 | ||
108 | 195 | Q_DECLARE_OPERATORS_FOR_FLAGS(unity::shell::application::ApplicationInfoInterface::Stages) | ||
109 | 196 | |||
110 | 174 | #endif // UNITY_SHELL_APPLICATIONMANAGER_APPLICATIONINFOINTERFACE_H | 197 | #endif // UNITY_SHELL_APPLICATIONMANAGER_APPLICATIONINFOINTERFACE_H |
111 | 175 | 198 | ||
112 | === modified file 'include/unity/shell/application/ApplicationManagerInterface.h' | |||
113 | --- include/unity/shell/application/ApplicationManagerInterface.h 2014-03-10 12:40:25 +0000 | |||
114 | +++ include/unity/shell/application/ApplicationManagerInterface.h 2014-06-24 23:00:14 +0000 | |||
115 | @@ -53,9 +53,7 @@ | |||
116 | 53 | Q_PROPERTY(int count READ count NOTIFY countChanged) | 53 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
117 | 54 | 54 | ||
118 | 55 | /** | 55 | /** |
122 | 56 | * @brief The currently focused application. | 56 | * @brief The app ID of the currently focused application. |
120 | 57 | * | ||
121 | 58 | * Use focusApplication() and unfocusCurrentApplication() to modify this. | ||
123 | 59 | */ | 57 | */ |
124 | 60 | Q_PROPERTY(QString focusedApplicationId READ focusedApplicationId NOTIFY focusedApplicationIdChanged) | 58 | Q_PROPERTY(QString focusedApplicationId READ focusedApplicationId NOTIFY focusedApplicationIdChanged) |
125 | 61 | 59 | ||
126 | @@ -75,6 +73,7 @@ | |||
127 | 75 | m_roleNames.insert(RoleComment, "comment"); | 73 | m_roleNames.insert(RoleComment, "comment"); |
128 | 76 | m_roleNames.insert(RoleIcon, "icon"); | 74 | m_roleNames.insert(RoleIcon, "icon"); |
129 | 77 | m_roleNames.insert(RoleStage, "stage"); | 75 | m_roleNames.insert(RoleStage, "stage"); |
130 | 76 | m_roleNames.insert(RoleSupportedStages, "supportedStages"); | ||
131 | 78 | m_roleNames.insert(RoleState, "state"); | 77 | m_roleNames.insert(RoleState, "state"); |
132 | 79 | m_roleNames.insert(RoleFocused, "focused"); | 78 | m_roleNames.insert(RoleFocused, "focused"); |
133 | 80 | m_roleNames.insert(RoleScreenshot, "screenshot"); | 79 | m_roleNames.insert(RoleScreenshot, "screenshot"); |
134 | @@ -98,6 +97,7 @@ | |||
135 | 98 | RoleComment, | 97 | RoleComment, |
136 | 99 | RoleIcon, | 98 | RoleIcon, |
137 | 100 | RoleStage, | 99 | RoleStage, |
138 | 100 | RoleSupportedStages, | ||
139 | 101 | RoleState, | 101 | RoleState, |
140 | 102 | RoleFocused, | 102 | RoleFocused, |
141 | 103 | RoleScreenshot, | 103 | RoleScreenshot, |
142 | @@ -142,40 +142,14 @@ | |||
143 | 142 | Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const = 0; | 142 | Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const = 0; |
144 | 143 | 143 | ||
145 | 144 | /** | 144 | /** |
146 | 145 | * @brief Request to focus a given application | ||
147 | 146 | * | ||
148 | 147 | * This will request the shell to focus the given application. | ||
149 | 148 | * | ||
150 | 149 | * @param appId The appId of the app to be focused. | ||
151 | 150 | * @returns True if the request will processed, false if it was discarded (i.e. the given appid could not be found) | ||
152 | 151 | */ | ||
153 | 152 | Q_INVOKABLE virtual bool requestFocusApplication(const QString &appId) = 0; | ||
154 | 153 | |||
155 | 154 | /** | ||
156 | 155 | * @brief Focus the given application. | ||
157 | 156 | * | ||
158 | 157 | * This will immediately focus the given application. Usually you should not use this | ||
159 | 158 | * but instead call requestFocusApplication() in order to allow the shell to prepare | ||
160 | 159 | * for the upcoming animation or even block the focus request (e.g. focus stealing prevention) | ||
161 | 160 | * | ||
162 | 161 | * @param appId The application to be focused. | ||
163 | 162 | * @returns True if appId found and application focused, else false. | ||
164 | 163 | */ | ||
165 | 164 | Q_INVOKABLE virtual bool focusApplication(const QString &appId) = 0; | ||
166 | 165 | |||
167 | 166 | /** | ||
168 | 167 | * @brief Unfocus the currently focused application. | ||
169 | 168 | */ | ||
170 | 169 | Q_INVOKABLE virtual void unfocusCurrentApplication() = 0; | ||
171 | 170 | |||
172 | 171 | /** | ||
173 | 172 | * @brief Start an application. | 145 | * @brief Start an application. |
174 | 173 | * | 146 | * |
175 | 174 | * @param appId The appId for the application to be spawned. | 147 | * @param appId The appId for the application to be spawned. |
176 | 175 | * @param arguments Any arguments to be passed to the process. | 148 | * @param arguments Any arguments to be passed to the process. |
177 | 176 | * @returns The created application item if start successful, else null. | 149 | * @returns The created application item if start successful, else null. |
178 | 177 | */ | 150 | */ |
180 | 178 | Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments) = 0; | 151 | Q_INVOKABLE virtual unity::shell::application::ApplicationInfoInterface |
181 | 152 | *startApplication(const QString &appId, const QStringList &arguments) = 0; | ||
182 | 179 | 153 | ||
183 | 180 | /** | 154 | /** |
184 | 181 | * @brief Stops an application. | 155 | * @brief Stops an application. |
185 | @@ -193,24 +167,41 @@ | |||
186 | 193 | * you can request the ApplicationManager to update it now. | 167 | * you can request the ApplicationManager to update it now. |
187 | 194 | * | 168 | * |
188 | 195 | * @param appId The application for which the screenshot should be updated. | 169 | * @param appId The application for which the screenshot should be updated. |
190 | 196 | * @returns True if the screenshot update operation was scheduled successfully, false otherwise (i.e. the given appId could not be found) | 170 | * @returns True if the screenshot update operation was scheduled successfully, false otherwise (i.e. the given |
191 | 171 | * appId could not be found) | ||
192 | 197 | */ | 172 | */ |
193 | 198 | Q_INVOKABLE virtual bool updateScreenshot(const QString &appId) = 0; | 173 | Q_INVOKABLE virtual bool updateScreenshot(const QString &appId) = 0; |
194 | 199 | 174 | ||
195 | 175 | /** | ||
196 | 176 | * @brief Request the application suspends | ||
197 | 177 | * | ||
198 | 178 | * If application supports lifecycling and is in a running state, calling this method notifies the | ||
199 | 179 | * app of pending suspension and a few seconds later suspends the app, updating the "state" property | ||
200 | 180 | * to "Suspended". Method is non-blocking. | ||
201 | 181 | * @param appId The application to be stopped. | ||
202 | 182 | * @returns True if app is running and supports lifecycle suspension, false otherwise. | ||
203 | 183 | */ | ||
204 | 184 | Q_INVOKABLE virtual bool suspendApplication(const QString &appId) = 0; | ||
205 | 185 | |||
206 | 186 | /** | ||
207 | 187 | * @brief Request the application resumes from suspends | ||
208 | 188 | * | ||
209 | 189 | * If application supports lifecycling and is in a suspended state, calling this method resumes it | ||
210 | 190 | * updating the "state" property to "Running". If application was stopped, it will be relaunched and | ||
211 | 191 | * will restore its internal state - the state property set to "Running" only when app ready. Method | ||
212 | 192 | * is non-blocking. | ||
213 | 193 | * @param appId The application to be stopped. | ||
214 | 194 | * @returns true if app is lifecycle suspended, false otherwise. | ||
215 | 195 | */ | ||
216 | 196 | Q_INVOKABLE virtual bool resumeApplication(const QString &appId) = 0; | ||
217 | 197 | |||
218 | 198 | |||
219 | 200 | Q_SIGNALS: | 199 | Q_SIGNALS: |
220 | 201 | /// @cond | 200 | /// @cond |
221 | 202 | void countChanged(); | 201 | void countChanged(); |
222 | 203 | /// @endcond | 202 | /// @endcond |
223 | 204 | 203 | ||
224 | 205 | /** | 204 | /** |
225 | 206 | * @brief Will be emitted right before the focused application changes. | ||
226 | 207 | * | ||
227 | 208 | * This can be used to prepare for an upcoming focus change. For example starting | ||
228 | 209 | * an animation. | ||
229 | 210 | */ | ||
230 | 211 | void focusRequested(const QString &appId); | ||
231 | 212 | |||
232 | 213 | /** | ||
233 | 214 | * @brief Will be emitted whenever the focused application changes. | 205 | * @brief Will be emitted whenever the focused application changes. |
234 | 215 | */ | 206 | */ |
235 | 216 | void focusedApplicationIdChanged(); | 207 | void focusedApplicationIdChanged(); |
236 | 217 | 208 | ||
237 | === modified file 'include/unity/shell/application/CMakeLists.txt' | |||
238 | --- include/unity/shell/application/CMakeLists.txt 2014-03-04 10:50:44 +0000 | |||
239 | +++ include/unity/shell/application/CMakeLists.txt 2014-06-24 23:00:14 +0000 | |||
240 | @@ -7,7 +7,7 @@ | |||
241 | 7 | 7 | ||
242 | 8 | set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) | 8 | set(UNITY_API_LIB_HDRS ${UNITY_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) |
243 | 9 | 9 | ||
245 | 10 | set(VERSION 2) | 10 | set(VERSION 3) |
246 | 11 | set(PKGCONFIG_NAME "unity-shell-appliction") | 11 | set(PKGCONFIG_NAME "unity-shell-appliction") |
247 | 12 | set(PKGCONFIG_DESCRIPTION "Unity shell Application APIs") | 12 | set(PKGCONFIG_DESCRIPTION "Unity shell Application APIs") |
248 | 13 | set(PKGCONFIG_REQUIRES "Qt5Core") | 13 | set(PKGCONFIG_REQUIRES "Qt5Core") |
249 | 14 | 14 | ||
250 | === modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp' | |||
251 | --- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2013-12-11 11:28:22 +0000 | |||
252 | +++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.cpp 2014-06-24 23:00:14 +0000 | |||
253 | @@ -64,13 +64,19 @@ | |||
254 | 64 | return m_stage; | 64 | return m_stage; |
255 | 65 | } | 65 | } |
256 | 66 | 66 | ||
258 | 67 | void MockApplicationInfo::setStage(ApplicationInfoInterface::Stage stage) | 67 | bool MockApplicationInfo::setStage(ApplicationInfoInterface::Stage stage) |
259 | 68 | { | 68 | { |
260 | 69 | if (m_stage != stage) | 69 | if (m_stage != stage) |
261 | 70 | { | 70 | { |
262 | 71 | m_stage = stage; | 71 | m_stage = stage; |
263 | 72 | Q_EMIT stageChanged(m_stage); | 72 | Q_EMIT stageChanged(m_stage); |
264 | 73 | } | 73 | } |
265 | 74 | return true; | ||
266 | 75 | } | ||
267 | 76 | |||
268 | 77 | ApplicationInfoInterface::Stages MockApplicationInfo::supportedStages() const | ||
269 | 78 | { | ||
270 | 79 | return ApplicationInfoInterface::MainStage | ApplicationInfoInterface::SideStage; | ||
271 | 74 | } | 80 | } |
272 | 75 | 81 | ||
273 | 76 | ApplicationInfoInterface::State MockApplicationInfo::state() const | 82 | ApplicationInfoInterface::State MockApplicationInfo::state() const |
274 | 77 | 83 | ||
275 | === modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h' | |||
276 | --- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2013-12-11 11:28:22 +0000 | |||
277 | +++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationInfo.h 2014-06-24 23:00:14 +0000 | |||
278 | @@ -32,19 +32,21 @@ | |||
279 | 32 | public: | 32 | public: |
280 | 33 | MockApplicationInfo(const QString &appId, const QString& name, const QString& comment, const QUrl& icon, QObject* parent = 0); | 33 | MockApplicationInfo(const QString &appId, const QString& name, const QString& comment, const QUrl& icon, QObject* parent = 0); |
281 | 34 | 34 | ||
295 | 35 | QString appId() const; | 35 | QString appId() const override; |
296 | 36 | QString name() const; | 36 | QString name() const override; |
297 | 37 | QString comment() const; | 37 | QString comment() const override; |
298 | 38 | QUrl icon() const; | 38 | QUrl icon() const override; |
299 | 39 | QUrl screenshot() const; | 39 | QUrl screenshot() const override; |
300 | 40 | 40 | ||
301 | 41 | ApplicationInfoInterface::Stage stage() const; | 41 | ApplicationInfoInterface::Stage stage() const override; |
302 | 42 | void setStage(ApplicationInfoInterface::Stage stage); | 42 | bool setStage(const ApplicationInfoInterface::Stage stage) override; |
303 | 43 | 43 | ||
304 | 44 | ApplicationInfoInterface::State state() const; | 44 | ApplicationInfoInterface::Stages supportedStages() const override; |
305 | 45 | void setState(ApplicationInfoInterface::State state); | 45 | |
306 | 46 | 46 | ApplicationInfoInterface::State state() const override; | |
307 | 47 | bool focused() const; | 47 | void setState(const ApplicationInfoInterface::State state); |
308 | 48 | |||
309 | 49 | bool focused() const override; | ||
310 | 48 | void setFocused(bool focused); | 50 | void setFocused(bool focused); |
311 | 49 | 51 | ||
312 | 50 | private: | 52 | private: |
313 | 51 | 53 | ||
314 | === modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp' | |||
315 | --- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2014-05-23 08:35:43 +0000 | |||
316 | +++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.cpp 2014-06-24 23:00:14 +0000 | |||
317 | @@ -62,6 +62,8 @@ | |||
318 | 62 | return item->icon(); | 62 | return item->icon(); |
319 | 63 | case RoleStage: | 63 | case RoleStage: |
320 | 64 | return item->stage(); | 64 | return item->stage(); |
321 | 65 | case RoleSupportedStages: | ||
322 | 66 | return static_cast<int>(item->supportedStages()); | ||
323 | 65 | case RoleState: | 67 | case RoleState: |
324 | 66 | return item->state(); | 68 | return item->state(); |
325 | 67 | case RoleFocused: | 69 | case RoleFocused: |
326 | @@ -110,22 +112,6 @@ | |||
327 | 110 | Q_UNUSED(suspended) | 112 | Q_UNUSED(suspended) |
328 | 111 | } | 113 | } |
329 | 112 | 114 | ||
330 | 113 | bool MockApplicationManager::requestFocusApplication(const QString &appId) | ||
331 | 114 | { | ||
332 | 115 | Q_UNUSED(appId) | ||
333 | 116 | return true; | ||
334 | 117 | } | ||
335 | 118 | |||
336 | 119 | bool MockApplicationManager::focusApplication(const QString &appId) | ||
337 | 120 | { | ||
338 | 121 | Q_UNUSED(appId) | ||
339 | 122 | return true; | ||
340 | 123 | } | ||
341 | 124 | |||
342 | 125 | void MockApplicationManager::unfocusCurrentApplication() | ||
343 | 126 | { | ||
344 | 127 | } | ||
345 | 128 | |||
346 | 129 | unity::shell::application::ApplicationInfoInterface *MockApplicationManager::startApplication(const QString &appId, const QStringList &arguments) | 115 | unity::shell::application::ApplicationInfoInterface *MockApplicationManager::startApplication(const QString &appId, const QStringList &arguments) |
347 | 130 | { | 116 | { |
348 | 131 | Q_UNUSED(arguments) | 117 | Q_UNUSED(arguments) |
349 | @@ -144,3 +130,15 @@ | |||
350 | 144 | Q_UNUSED(appId) | 130 | Q_UNUSED(appId) |
351 | 145 | return true; | 131 | return true; |
352 | 146 | } | 132 | } |
353 | 133 | |||
354 | 134 | bool MockApplicationManager::suspendApplication(const QString &appId) | ||
355 | 135 | { | ||
356 | 136 | Q_UNUSED(appId) | ||
357 | 137 | return true; | ||
358 | 138 | } | ||
359 | 139 | |||
360 | 140 | bool MockApplicationManager::resumeApplication(const QString &appId) | ||
361 | 141 | { | ||
362 | 142 | Q_UNUSED(appId) | ||
363 | 143 | return true; | ||
364 | 144 | } | ||
365 | 147 | 145 | ||
366 | === modified file 'test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h' | |||
367 | --- test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2014-03-10 12:34:16 +0000 | |||
368 | +++ test/qmltest/mocks/plugins/Unity/Application/Mocks/MockApplicationManager.h 2014-06-24 23:00:14 +0000 | |||
369 | @@ -34,31 +34,27 @@ | |||
370 | 34 | MockApplicationManager(QObject* parent = 0); | 34 | MockApplicationManager(QObject* parent = 0); |
371 | 35 | ~MockApplicationManager(); | 35 | ~MockApplicationManager(); |
372 | 36 | 36 | ||
395 | 37 | int rowCount(const QModelIndex& parent) const; | 37 | int rowCount(const QModelIndex& parent) const override; |
396 | 38 | 38 | ||
397 | 39 | QVariant data(const QModelIndex& index, int role) const; | 39 | QVariant data(const QModelIndex& index, int role) const override; |
398 | 40 | 40 | ||
399 | 41 | QString focusedApplicationId() const; | 41 | QString focusedApplicationId() const override; |
400 | 42 | 42 | ||
401 | 43 | bool suspended() const; | 43 | bool suspended() const override; |
402 | 44 | void setSuspended(bool suspended); | 44 | void setSuspended(bool suspended) override; |
403 | 45 | 45 | ||
404 | 46 | Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *get(const int index) const; | 46 | Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *get(const int index) const override; |
405 | 47 | 47 | ||
406 | 48 | Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const; | 48 | Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const override; |
407 | 49 | 49 | ||
408 | 50 | Q_INVOKABLE bool requestFocusApplication(const QString &appId); | 50 | Q_INVOKABLE unity::shell::application::ApplicationInfoInterface |
409 | 51 | 51 | *startApplication(const QString &appId, const QStringList &arguments) override; | |
410 | 52 | Q_INVOKABLE bool focusApplication(const QString &appId); | 52 | |
411 | 53 | 53 | Q_INVOKABLE bool stopApplication(const QString &appId) override; | |
412 | 54 | Q_INVOKABLE void unfocusCurrentApplication(); | 54 | Q_INVOKABLE bool suspendApplication(const QString &appId) override; |
413 | 55 | 55 | Q_INVOKABLE bool resumeApplication(const QString &appId) override; | |
392 | 56 | Q_INVOKABLE unity::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments); | ||
393 | 57 | |||
394 | 58 | Q_INVOKABLE bool stopApplication(const QString &appId); | ||
414 | 59 | 56 | ||
415 | 60 | Q_INVOKABLE bool updateScreenshot(const QString &appId); | 57 | Q_INVOKABLE bool updateScreenshot(const QString &appId); |
416 | 61 | |||
417 | 62 | private: | 58 | private: |
418 | 63 | QList<MockApplicationInfo*> m_list; | 59 | QList<MockApplicationInfo*> m_list; |
419 | 64 | }; | 60 | }; |
420 | 65 | 61 | ||
421 | === modified file 'test/qmltest/unity/shell/application/tst_Application.qml' | |||
422 | --- test/qmltest/unity/shell/application/tst_Application.qml 2014-03-10 12:34:16 +0000 | |||
423 | +++ test/qmltest/unity/shell/application/tst_Application.qml 2014-06-24 23:00:14 +0000 | |||
424 | @@ -67,6 +67,7 @@ | |||
425 | 67 | { enum: "RoleComment" }, | 67 | { enum: "RoleComment" }, |
426 | 68 | { enum: "RoleIcon" }, | 68 | { enum: "RoleIcon" }, |
427 | 69 | { enum: "RoleStage" }, | 69 | { enum: "RoleStage" }, |
428 | 70 | { enum: "RoleSupportedStages"}, | ||
429 | 70 | { enum: "RoleState" }, | 71 | { enum: "RoleState" }, |
430 | 71 | { enum: "RoleFocused" }, | 72 | { enum: "RoleFocused" }, |
431 | 72 | { enum: "RoleScreenshot" }, | 73 | { enum: "RoleScreenshot" }, |
432 | @@ -87,6 +88,7 @@ | |||
433 | 87 | { tag: "ApplicationManager.roles[comment]", role: "comment", type: "string" }, | 88 | { tag: "ApplicationManager.roles[comment]", role: "comment", type: "string" }, |
434 | 88 | { tag: "ApplicationManager.roles[icon]", role: "icon", type: "object" }, | 89 | { tag: "ApplicationManager.roles[icon]", role: "icon", type: "object" }, |
435 | 89 | { tag: "ApplicationManager.roles[stage]", role: "stage", type: "number" }, | 90 | { tag: "ApplicationManager.roles[stage]", role: "stage", type: "number" }, |
436 | 91 | { tag: "ApplicationManager.roles[supportedStages]", role: "supportedStages", type: "number" }, | ||
437 | 90 | { tag: "ApplicationManager.roles[state]", role: "state", type: "number" }, | 92 | { tag: "ApplicationManager.roles[state]", role: "state", type: "number" }, |
438 | 91 | { tag: "ApplicationManager.roles[focused]", role: "focused", type: "boolean" }, | 93 | { tag: "ApplicationManager.roles[focused]", role: "focused", type: "boolean" }, |
439 | 92 | { tag: "ApplicationManager.roles[screenshot]", role: "screenshot", type: "object" }, | 94 | { tag: "ApplicationManager.roles[screenshot]", role: "screenshot", type: "object" }, |
440 | @@ -108,11 +110,10 @@ | |||
441 | 108 | return [ | 110 | return [ |
442 | 109 | { tag: "ApplicationManager.methods[get]", method: "get" }, | 111 | { tag: "ApplicationManager.methods[get]", method: "get" }, |
443 | 110 | { tag: "ApplicationManager.methods[findApplication]", method: "findApplication" }, | 112 | { tag: "ApplicationManager.methods[findApplication]", method: "findApplication" }, |
444 | 111 | { tag: "ApplicationManager.methods[requestFocusApplication]", method: "requestFocusApplication" }, | ||
445 | 112 | { tag: "ApplicationManager.methods[focusApplication]", method: "focusApplication" }, | ||
446 | 113 | { tag: "ApplicationManager.methods[unfocusCurrentApplication]", method: "unfocusCurrentApplication" }, | ||
447 | 114 | { tag: "ApplicationManager.methods[startApplication]", method: "startApplication" }, | 113 | { tag: "ApplicationManager.methods[startApplication]", method: "startApplication" }, |
448 | 115 | { tag: "ApplicationManager.methods[stopApplication]", method: "stopApplication" }, | 114 | { tag: "ApplicationManager.methods[stopApplication]", method: "stopApplication" }, |
449 | 115 | { tag: "ApplicationManager.methods[suspendApplication]", method: "suspendApplication" }, | ||
450 | 116 | { tag: "ApplicationManager.methods[resumeApplication]", method: "resumeApplication" }, | ||
451 | 116 | { tag: "ApplicationManager.methods[updateScreenshot]", method: "updateScreenshot" }, | 117 | { tag: "ApplicationManager.methods[updateScreenshot]", method: "updateScreenshot" }, |
452 | 117 | ]; | 118 | ]; |
453 | 118 | } | 119 | } |
454 | @@ -144,6 +145,7 @@ | |||
455 | 144 | { tag: "ApplicationInfo.properties[comment]", property: "comment", type: "string" }, | 145 | { tag: "ApplicationInfo.properties[comment]", property: "comment", type: "string" }, |
456 | 145 | { tag: "ApplicationInfo.properties[icon]", property: "icon", type: "object" }, | 146 | { tag: "ApplicationInfo.properties[icon]", property: "icon", type: "object" }, |
457 | 146 | { tag: "ApplicationInfo.properties[stage]", property: "stage", type: "number" }, | 147 | { tag: "ApplicationInfo.properties[stage]", property: "stage", type: "number" }, |
458 | 148 | { tag: "ApplicationInfo.properties[supportedStages]", property: "supportedStages", type: "number" }, | ||
459 | 147 | { tag: "ApplicationInfo.properties[state]", property: "state", type: "number" }, | 149 | { tag: "ApplicationInfo.properties[state]", property: "state", type: "number" }, |
460 | 148 | { tag: "ApplicationInfo.properties[focused]", property: "focused", type: "boolean" }, | 150 | { tag: "ApplicationInfo.properties[focused]", property: "focused", type: "boolean" }, |
461 | 149 | { tag: "ApplicationInfo.properties[screenshot]", property: "screenshot", type: "object" }, | 151 | { tag: "ApplicationInfo.properties[screenshot]", property: "screenshot", type: "object" }, |
462 | @@ -161,5 +163,65 @@ | |||
463 | 161 | 163 | ||
464 | 162 | verifyData(data) | 164 | verifyData(data) |
465 | 163 | } | 165 | } |
466 | 166 | |||
467 | 167 | function test_item_methods_data() { | ||
468 | 168 | return [ | ||
469 | 169 | { tag: "ApplicationInfo.methods[setStage]", method: "setStage" }, | ||
470 | 170 | ]; | ||
471 | 171 | } | ||
472 | 172 | |||
473 | 173 | function test_item_methods(data) { | ||
474 | 174 | name = "ApplicationInfo"; | ||
475 | 175 | try { | ||
476 | 176 | object = ApplicationManager.get(0) | ||
477 | 177 | } catch(err) { | ||
478 | 178 | object = undefined; | ||
479 | 179 | print(err) | ||
480 | 180 | } | ||
481 | 181 | verifyData(data); | ||
482 | 182 | } | ||
483 | 183 | |||
484 | 184 | function test_item_stage_flags_data() { | ||
485 | 185 | return [ | ||
486 | 186 | { enum: "MainStage" }, | ||
487 | 187 | { enum: "SideStage" }, | ||
488 | 188 | ]; | ||
489 | 189 | } | ||
490 | 190 | |||
491 | 191 | function test_item_stage_flags(data) { | ||
492 | 192 | name = "Application"; | ||
493 | 193 | try { | ||
494 | 194 | object = ApplicationInfo | ||
495 | 195 | } catch(err) { | ||
496 | 196 | object = undefined; | ||
497 | 197 | print(err) | ||
498 | 198 | } | ||
499 | 199 | verifyData(data); | ||
500 | 200 | } | ||
501 | 201 | |||
502 | 202 | function test_item_stage_flags_operator() { | ||
503 | 203 | // check that flags operator functional | ||
504 | 204 | verify(ApplicationInfo.MainStage | ApplicationInfo.SideStage, 0x003) | ||
505 | 205 | } | ||
506 | 206 | |||
507 | 207 | function test_item_state_enum_data() { | ||
508 | 208 | return [ | ||
509 | 209 | { enum: "Starting" }, | ||
510 | 210 | { enum: "Running" }, | ||
511 | 211 | { enum: "Suspended" }, | ||
512 | 212 | { enum: "Stopped" }, | ||
513 | 213 | ]; | ||
514 | 214 | } | ||
515 | 215 | |||
516 | 216 | function test_item_state_enum(data) { | ||
517 | 217 | name = "Application"; | ||
518 | 218 | try { | ||
519 | 219 | object = ApplicationInfo | ||
520 | 220 | } catch(err) { | ||
521 | 221 | object = undefined; | ||
522 | 222 | print(err) | ||
523 | 223 | } | ||
524 | 224 | verifyData(data); | ||
525 | 225 | } | ||
526 | 164 | } | 226 | } |
527 | 165 | } | 227 | } |
Here's a couple of comments of things we should think of. Not necessarily disagreeing with them, just worth a though/discussion imo:
====
20 + Q_PROPERTY(Stages supportedStages READ supportedStages NOTIFY supportedStages Changed)
Do we assume that if an app claims support for both stages, all of its surfaces will support them? Probably yes.
====
31 + * Holds the current application focus state. True if a surface of this application is focused, false otherwise.
Really needed? what would we gain with this information? Wouldn't it make more sense to obtain it the other was round? For instance:
var focusedApp = SurfaceManager. appId(SurfaceMa nager.focusedSu rfaceId)
====
78 + Q_INVOKABLE virtual bool suspend() = 0;
89 + Q_INVOKABLE virtual bool resume() = 0;
Where would you call this from? I'm not sure if we should expose this to unity but rather handle this stuff internally in the applicationmanager. We might add something like inhibitSuspension() at a later point if we want to give the user control over it.
Also it doesn't really match with the existing API, given that we have startApplication() and stopApplication() in ApplicationManager (not ApplicationInfo) such things should be at the same place. If we decide to expose this to the shell, I'm not opposed to have them in both places (ApplicationMan ager::suspendAp plication( appId) and ApplicationInfo ::suspend( )).
====
301 void setFocused(bool focused);
What would this do?