Merge lp:~gerboland/unity-mir/add-focus-requested-signal into lp:unity-mir

Proposed by Gerry Boland
Status: Merged
Approved by: Michał Sawicz
Approved revision: 117
Merged at revision: 116
Proposed branch: lp:~gerboland/unity-mir/add-focus-requested-signal
Merge into: lp:unity-mir
Diff against target: 124 lines (+10/-22)
4 files modified
src/modules/Unity/Application/application.h (+4/-1)
src/modules/Unity/Application/application_manager.cpp (+4/-1)
src/modules/Unity/Application/application_manager.h (+1/-5)
tests/application/Application.qml (+1/-15)
To merge this branch: bzr merge lp:~gerboland/unity-mir/add-focus-requested-signal
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+190620@code.launchpad.net

Commit message

Add focusRequested signal for all apps, and allow shell to override application stage at any time, so shell can properly deal with apps it did not launch itself.

Description of the change

Add focusRequested signal for all apps, and allow shell to override application stage at any time, so shell can properly deal with apps it did not launch itself.

To post a comment you must log in.
116. By Gerry Boland

Remove debug

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Terry (mterry) wrote :

You now have two focusRequested signals. How does QML handle two signals with the same name? I've never tried, but I wouldn't think well, since you can't specify a signal signature...

We could just drop the older one, it's deprecated and unused.

117. By Gerry Boland

Remove Favourite Application enum and focusRequester

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/Application/application.h'
2--- src/modules/Unity/Application/application.h 2013-09-27 10:20:47 +0000
3+++ src/modules/Unity/Application/application.h 2013-10-11 14:40:09 +0000
4@@ -40,6 +40,7 @@
5 Q_PROPERTY(QString desktopFile READ desktopFile CONSTANT)
6 Q_PROPERTY(QString exec READ exec CONSTANT)
7 Q_PROPERTY(bool fullscreen READ fullscreen NOTIFY fullscreenChanged)
8+ Q_PROPERTY(Stage stage READ stage WRITE setStage NOTIFY stageChanged)
9
10 public:
11 Application(const QString &appId, State state, const QStringList &arguments, QObject *parent = 0);
12@@ -55,6 +56,8 @@
13 State state() const override;
14 bool focused() const override;
15
16+ void setStage(Stage stage);
17+
18 bool isValid() const;
19 QString desktopFile() const;
20 QString exec() const;
21@@ -68,11 +71,11 @@
22
23 Q_SIGNALS:
24 void fullscreenChanged();
25+ void stageChanged(Stage stage);
26
27 private:
28 pid_t pid() const;
29 void setPid(pid_t pid);
30- void setStage(Stage stage);
31 void setState(State state);
32 void setFocused(bool focus);
33 void setFullscreen(bool fullscreen);
34
35=== modified file 'src/modules/Unity/Application/application_manager.cpp'
36--- src/modules/Unity/Application/application_manager.cpp 2013-10-11 13:25:59 +0000
37+++ src/modules/Unity/Application/application_manager.cpp 2013-10-11 14:40:09 +0000
38@@ -238,6 +238,7 @@
39 return;
40 }
41 add(application);
42+ Q_EMIT focusRequested(appId);
43 }
44 }
45
46@@ -314,7 +315,7 @@
47 {
48 DLOG("ApplicationManager::onFocusRequested (this=%p, appId=%s)", this, qPrintable(appId));
49
50- focusApplication(appId);
51+ Q_EMIT focusRequested(appId);
52 }
53
54 void ApplicationManager::onResumeRequested(const QString& appId)
55@@ -533,6 +534,8 @@
56
57 void ApplicationManager::setFocused(Application *application)
58 {
59+ DLOG("ApplicationManager::setFocused (appId=%s)", qPrintable(application->appId()));
60+
61 if (application == m_focusedApplication)
62 return;
63
64
65=== modified file 'src/modules/Unity/Application/application_manager.h'
66--- src/modules/Unity/Application/application_manager.h 2013-10-02 20:58:18 +0000
67+++ src/modules/Unity/Application/application_manager.h 2013-10-11 14:40:09 +0000
68@@ -46,14 +46,10 @@
69 class ApplicationManager : public unity::shell::application::ApplicationManagerInterface
70 {
71 Q_OBJECT
72- Q_ENUMS(FavoriteApplication)
73 Q_FLAGS(ExecFlags)
74
75 public:
76 // Mapping enums to Ubuntu Platform API enums.
77- enum FavoriteApplication {
78- CameraApplication, GalleryApplication, BrowserApplication, ShareApplication
79- };
80 enum Flag {
81 NoFlag = 0x0,
82 ForceMainStage = 0x1,
83@@ -101,7 +97,7 @@
84 void onResumeRequested(const QString& appId);
85
86 Q_SIGNALS:
87- void focusRequested(FavoriteApplication favoriteApplication);
88+ void focusRequested(const QString &appId);
89
90 private:
91 void setFocused(Application *application);
92
93=== modified file 'tests/application/Application.qml'
94--- tests/application/Application.qml 2013-06-17 20:05:34 +0000
95+++ tests/application/Application.qml 2013-10-11 14:40:09 +0000
96@@ -38,9 +38,6 @@
97 // An application can be stopped by using:
98 // ApplicationManager.stopProcess(application)
99 //
100-// In order to focus or start a favorite application, that function can be used:
101-// ApplicationManager.focusFavoriteApplication(ApplicationManager.GalleryApplication);
102-//
103 // A good way to use Application.qml is to launch it using:
104 // qmlscene-ubuntu --fullscreen --session 1 --role 0 Application.qml
105 // and then to launch other applications using:
106@@ -59,18 +56,7 @@
107 Connections {
108 target: ApplicationManager
109 onFocusRequested: {
110- var favoriteApplicationStr = [
111- 'CameraApplication', 'GalleryApplication', 'BrowserApplication', 'ShareApplication'
112- ];
113- print("focus request:", favoriteApplicationStr[favoriteApplication])
114- }
115- }
116-
117- MouseArea {
118- id: touchArea
119- anchors.fill: parent
120- onClicked: {
121- // ApplicationManager.focusFavoriteApplication(ApplicationManager.BrowserApplication);
122+ print("focus request:", appId)
123 }
124 }
125

Subscribers

People subscribed via source and target branches