Merge lp:~alan-griffiths/miral/encapsulate-mir-PromptSession into lp:miral

Proposed by Alan Griffiths
Status: Merged
Approved by: Gerry Boland
Approved revision: 401
Merged at revision: 400
Proposed branch: lp:~alan-griffiths/miral/encapsulate-mir-PromptSession
Merge into: lp:miral
Diff against target: 558 lines (+131/-69)
16 files modified
miral-qt/src/common/mirqtconversion.h (+1/-1)
miral-qt/src/modules/Unity/Application/application.h (+0/-6)
miral-qt/src/modules/Unity/Application/session.cpp (+14/-14)
miral-qt/src/modules/Unity/Application/session.h (+5/-5)
miral-qt/src/modules/Unity/Application/session_interface.h (+5/-5)
miral-qt/src/modules/Unity/Application/sessionmanager.cpp (+3/-2)
miral-qt/src/modules/Unity/Application/sessionmanager.h (+2/-2)
miral-qt/src/platforms/mirserver/CMakeLists.txt (+1/-1)
miral-qt/src/platforms/mirserver/promptsession.h (+62/-0)
miral-qt/src/platforms/mirserver/promptsessionmanager.cpp (+6/-6)
miral-qt/src/platforms/mirserver/promptsessionmanager.h (+6/-6)
miral-qt/tests/framework/fake_session.cpp (+7/-5)
miral-qt/tests/framework/fake_session.h (+4/-4)
miral-qt/tests/framework/mock_session.h (+5/-4)
miral-qt/tests/modules/SessionManager/session_manager_test.cpp (+5/-4)
miral-qt/tests/modules/SessionManager/session_test.cpp (+5/-4)
To merge this branch: bzr merge lp:~alan-griffiths/miral/encapsulate-mir-PromptSession
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Review via email: mp+307823@code.launchpad.net

Commit message

[miral-qt] Encapsulate mir::scene::PromptSession

Description of the change

[miral-qt] Encapsulate mir::scene::PromptSession

(Almost) there's something with the signal/slot mechanism that still requires the complete type for mir::scene::PromptSession.

But this is another step towards isolating the prompt session requirements so they can be supported my libmiral

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

> (Almost) there's something with the signal/slot mechanism that still
> requires the complete type for mir::scene::PromptSession.

It's not ideal, but Qt refuses to let signal/slot connections work with types that are forward declared. Qt wants to check if the type is registered with the metatype system at compile time. Can't avoid it.

General change looks ok, however I'd prefer if you adopted the Qt style in PromptSession, e.g.
std::shared_ptr<mir::scene::PromptSession> const& promptSession
  -> const std::shared_ptr<mir::scene::PromptSession> &promptSession
and not use the newer C++ style "auto foo() -> bool"

review: Needs Fixing
398. By Alan Griffiths

Adopt local fashion

399. By Alan Griffiths

merge :parent

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> General change looks ok, however I'd prefer if you adopted the Qt style in
> PromptSession, e.g.
> std::shared_ptr<mir::scene::PromptSession> const& promptSession
> -> const std::shared_ptr<mir::scene::PromptSession> &promptSession
> and not use the newer C++ style "auto foo() -> bool"

Done

Revision history for this message
Gerry Boland (gerboland) wrote :

> > General change looks ok, however I'd prefer if you adopted the Qt style in
> > PromptSession, e.g.
> > std::shared_ptr<mir::scene::PromptSession> const& promptSession
> > -> const std::shared_ptr<mir::scene::PromptSession> &promptSession
> > and not use the newer C++ style "auto foo() -> bool"
>
> Done

Not quite, please put the const qualifier before the type, not after. * and & are attached to the variable name too, not the type.

> std::shared_ptr<mir::scene::PromptSession> const& promptSession
> -> const std::shared_ptr<mir::scene::PromptSession> &promptSession

400. By Alan Griffiths

Adopt local fashion

401. By Alan Griffiths

Adopt local fashion

Revision history for this message
Gerry Boland (gerboland) wrote :

Looks good, thank you

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'miral-qt/src/common/mirqtconversion.h'
--- miral-qt/src/common/mirqtconversion.h 2016-10-06 11:27:59 +0000
+++ miral-qt/src/common/mirqtconversion.h 2016-10-10 13:04:19 +0000
@@ -93,8 +93,8 @@
93 return mir_surface_state_restored;93 return mir_surface_state_restored;
9494
95 case Mir::HiddenState: return mir_surface_state_hidden;95 case Mir::HiddenState: return mir_surface_state_hidden;
96 default: Q_UNREACHABLE();
96 }97 }
97 Q_UNREACHABLE();
98}98}
9999
100} // namespace qtmir100} // namespace qtmir
101101
=== modified file 'miral-qt/src/modules/Unity/Application/application.h'
--- miral-qt/src/modules/Unity/Application/application.h 2016-08-16 14:21:14 +0000
+++ miral-qt/src/modules/Unity/Application/application.h 2016-10-10 13:04:19 +0000
@@ -31,12 +31,6 @@
31#include "mirsurfacelistmodel.h"31#include "mirsurfacelistmodel.h"
32#include "session_interface.h"32#include "session_interface.h"
3333
34namespace mir {
35 namespace scene {
36 class Session;
37 }
38}
39
40namespace qtmir34namespace qtmir
41{35{
4236
4337
=== modified file 'miral-qt/src/modules/Unity/Application/session.cpp'
--- miral-qt/src/modules/Unity/Application/session.cpp 2016-10-06 15:36:43 +0000
+++ miral-qt/src/modules/Unity/Application/session.cpp 2016-10-10 13:04:19 +0000
@@ -20,13 +20,13 @@
20#include "session.h"20#include "session.h"
21#include "mirsurfaceinterface.h"21#include "mirsurfaceinterface.h"
22#include "mirsurfaceitem.h"22#include "mirsurfaceitem.h"
23#include "promptsession.h"
2324
24// mirserver25// mirserver
25#include "logging.h"26#include "logging.h"
2627
27// mir28// mir
28#include <mir/scene/session.h>29#include <mir/scene/session.h>
29#include <mir/scene/prompt_session.h>
3030
31// Qt31// Qt
32#include <QPainter>32#include <QPainter>
@@ -294,7 +294,7 @@
294 session()->set_lifecycle_state(mir_lifecycle_state_will_suspend);294 session()->set_lifecycle_state(mir_lifecycle_state_will_suspend);
295 m_suspendTimer->start();295 m_suspendTimer->start();
296296
297 foreachPromptSession([this](const std::shared_ptr<ms::PromptSession>& promptSession) {297 foreachPromptSession([this](const qtmir::PromptSession &promptSession) {
298 m_promptSessionManager->suspendPromptSession(promptSession);298 m_promptSessionManager->suspendPromptSession(promptSession);
299 });299 });
300300
@@ -326,7 +326,7 @@
326326
327 session()->set_lifecycle_state(mir_lifecycle_state_resumed);327 session()->set_lifecycle_state(mir_lifecycle_state_resumed);
328328
329 foreachPromptSession([this](const std::shared_ptr<ms::PromptSession>& promptSession) {329 foreachPromptSession([this](const qtmir::PromptSession &promptSession) {
330 m_promptSessionManager->resumePromptSession(promptSession);330 m_promptSessionManager->resumePromptSession(promptSession);
331 });331 });
332332
@@ -453,16 +453,16 @@
453 return m_children;453 return m_children;
454}454}
455455
456void Session::appendPromptSession(const std::shared_ptr<ms::PromptSession>& promptSession)456void Session::appendPromptSession(const qtmir::PromptSession &promptSession)
457{457{
458 DEBUG_MSG << "(promptSession=" << (promptSession ? promptSession.get() : nullptr) << ")";458 DEBUG_MSG << "(promptSession=" << promptSession.get() << ")";
459459
460 m_promptSessions.append(promptSession);460 m_promptSessions.append(promptSession);
461}461}
462462
463void Session::removePromptSession(const std::shared_ptr<ms::PromptSession>& promptSession)463void Session::removePromptSession(const qtmir::PromptSession &promptSession)
464{464{
465 DEBUG_MSG << "(promptSession=" << (promptSession ? promptSession.get() : nullptr) << ")";465 DEBUG_MSG << "(promptSession=" << promptSession.get() << ")";
466466
467 m_promptSessions.removeAll(promptSession);467 m_promptSessions.removeAll(promptSession);
468}468}
@@ -474,26 +474,26 @@
474 static_cast<Session*>(child)->stopPromptSessions();474 static_cast<Session*>(child)->stopPromptSessions();
475 }475 }
476476
477 QVector<std::shared_ptr<ms::PromptSession>> copy(m_promptSessions);477 QVector<qtmir::PromptSession> copy(m_promptSessions);
478 QVectorIterator<std::shared_ptr<ms::PromptSession>> it(copy);478 QVectorIterator<qtmir::PromptSession> it(copy);
479 for ( it.toBack(); it.hasPrevious(); ) {479 for ( it.toBack(); it.hasPrevious(); ) {
480 std::shared_ptr<ms::PromptSession> promptSession = it.previous();480 qtmir::PromptSession promptSession = it.previous();
481 DEBUG_MSG << " - promptSession=" << promptSession.get();481 DEBUG_MSG << " - promptSession=" << promptSession.get();
482482
483 m_promptSessionManager->stopPromptSession(promptSession);483 m_promptSessionManager->stopPromptSession(promptSession);
484 }484 }
485}485}
486486
487std::shared_ptr<ms::PromptSession> Session::activePromptSession() const487qtmir::PromptSession Session::activePromptSession() const
488{488{
489 if (m_promptSessions.count() > 0)489 if (m_promptSessions.count() > 0)
490 return m_promptSessions.back();490 return m_promptSessions.back();
491 return nullptr;491 return {};
492}492}
493493
494void Session::foreachPromptSession(const std::function<void(const std::shared_ptr<ms::PromptSession>&)>& f) const494void Session::foreachPromptSession(const std::function<void(const qtmir::PromptSession&)>& f) const
495{495{
496 Q_FOREACH (std::shared_ptr<ms::PromptSession> promptSession, m_promptSessions) {496 Q_FOREACH (qtmir::PromptSession promptSession, m_promptSessions) {
497 f(promptSession);497 f(promptSession);
498 }498 }
499}499}
500500
=== modified file 'miral-qt/src/modules/Unity/Application/session.h'
--- miral-qt/src/modules/Unity/Application/session.h 2016-10-05 15:31:59 +0000
+++ miral-qt/src/modules/Unity/Application/session.h 2016-10-10 13:04:19 +0000
@@ -77,15 +77,15 @@
7777
78 std::shared_ptr<mir::scene::Session> session() const override;78 std::shared_ptr<mir::scene::Session> session() const override;
7979
80 std::shared_ptr<mir::scene::PromptSession> activePromptSession() const override;80 PromptSession activePromptSession() const override;
81 void foreachPromptSession(const std::function<void(const std::shared_ptr<mir::scene::PromptSession>&)> &f) const override;81 void foreachPromptSession(const std::function<void(const PromptSession&)> &f) const override;
8282
83 SessionModel* childSessions() const override;83 SessionModel* childSessions() const override;
8484
85 void setFullscreen(bool fullscreen) override;85 void setFullscreen(bool fullscreen) override;
86 void setLive(const bool) override;86 void setLive(const bool) override;
87 void appendPromptSession(const std::shared_ptr<mir::scene::PromptSession>& session) override;87 void appendPromptSession(const PromptSession& session) override;
88 void removePromptSession(const std::shared_ptr<mir::scene::PromptSession>& session) override;88 void removePromptSession(const PromptSession& session) override;
8989
90 // useful for tests90 // useful for tests
91 void setSuspendTimer(AbstractTimer *timer);91 void setSuspendTimer(AbstractTimer *timer);
@@ -118,7 +118,7 @@
118 State m_state;118 State m_state;
119 bool m_live;119 bool m_live;
120 AbstractTimer* m_suspendTimer{nullptr};120 AbstractTimer* m_suspendTimer{nullptr};
121 QVector<std::shared_ptr<mir::scene::PromptSession>> m_promptSessions;121 QVector<PromptSession> m_promptSessions;
122 std::shared_ptr<PromptSessionManager> const m_promptSessionManager;122 std::shared_ptr<PromptSessionManager> const m_promptSessionManager;
123 QList<MirSurfaceInterface*> m_closingSurfaces;123 QList<MirSurfaceInterface*> m_closingSurfaces;
124 bool m_hadSurface{false};124 bool m_hadSurface{false};
125125
=== modified file 'miral-qt/src/modules/Unity/Application/session_interface.h'
--- miral-qt/src/modules/Unity/Application/session_interface.h 2016-09-30 14:04:24 +0000
+++ miral-qt/src/modules/Unity/Application/session_interface.h 2016-10-10 13:04:19 +0000
@@ -33,7 +33,6 @@
33namespace mir {33namespace mir {
34 namespace scene {34 namespace scene {
35 class Session;35 class Session;
36 class PromptSession;
37 }36 }
38}37}
3938
@@ -41,6 +40,7 @@
4140
42class MirSurfaceInterface;41class MirSurfaceInterface;
43class MirSurfaceListModel;42class MirSurfaceListModel;
43class PromptSession;
4444
45class SessionInterface : public QObject {45class SessionInterface : public QObject {
46 Q_OBJECT46 Q_OBJECT
@@ -106,13 +106,13 @@
106 virtual void removeChildSession(SessionInterface* session) = 0;106 virtual void removeChildSession(SessionInterface* session) = 0;
107 virtual void foreachChildSession(const std::function<void(SessionInterface* session)>& f) const = 0;107 virtual void foreachChildSession(const std::function<void(SessionInterface* session)>& f) const = 0;
108108
109 virtual std::shared_ptr<mir::scene::PromptSession> activePromptSession() const = 0;109 virtual PromptSession activePromptSession() const = 0;
110 virtual void foreachPromptSession(const std::function<void(const std::shared_ptr<mir::scene::PromptSession>&)>& f) const = 0;110 virtual void foreachPromptSession(const std::function<void(const PromptSession&)>& f) const = 0;
111111
112 virtual void setFullscreen(bool fullscreen) = 0;112 virtual void setFullscreen(bool fullscreen) = 0;
113 virtual void setLive(const bool) = 0;113 virtual void setLive(const bool) = 0;
114 virtual void appendPromptSession(const std::shared_ptr<mir::scene::PromptSession>& session) = 0;114 virtual void appendPromptSession(const PromptSession& session) = 0;
115 virtual void removePromptSession(const std::shared_ptr<mir::scene::PromptSession>& session) = 0;115 virtual void removePromptSession(const PromptSession& session) = 0;
116116
117Q_SIGNALS:117Q_SIGNALS:
118 void applicationChanged(unity::shell::application::ApplicationInfoInterface* application);118 void applicationChanged(unity::shell::application::ApplicationInfoInterface* application);
119119
=== modified file 'miral-qt/src/modules/Unity/Application/sessionmanager.cpp'
--- miral-qt/src/modules/Unity/Application/sessionmanager.cpp 2016-10-05 16:08:44 +0000
+++ miral-qt/src/modules/Unity/Application/sessionmanager.cpp 2016-10-10 13:04:19 +0000
@@ -27,6 +27,7 @@
27#include "logging.h"27#include "logging.h"
28#include "nativeinterface.h"28#include "nativeinterface.h"
29#include "promptsessionlistener.h"29#include "promptsessionlistener.h"
30#include "promptsession.h"
3031
31// mir32// mir
32#include <mir/scene/prompt_session.h>33#include <mir/scene/prompt_session.h>
@@ -155,7 +156,7 @@
155 Q_EMIT sessionStopping(qmlSession);156 Q_EMIT sessionStopping(qmlSession);
156}157}
157158
158void SessionManager::onPromptSessionStarting(const std::shared_ptr<ms::PromptSession>& promptSession)159void SessionManager::onPromptSessionStarting(const qtmir::PromptSession &promptSession)
159{160{
160 qCDebug(QTMIR_SESSIONS) << "SessionManager::onPromptSessionStarting - promptSession=" << promptSession.get();161 qCDebug(QTMIR_SESSIONS) << "SessionManager::onPromptSessionStarting - promptSession=" << promptSession.get();
161162
@@ -169,7 +170,7 @@
169 }170 }
170}171}
171172
172void SessionManager::onPromptSessionStopping(const std::shared_ptr<ms::PromptSession>& promptSession)173void SessionManager::onPromptSessionStopping(const qtmir::PromptSession &promptSession)
173{174{
174 qCDebug(QTMIR_SESSIONS) << "SessionManager::onPromptSessionStopping - promptSession=" << promptSession.get();175 qCDebug(QTMIR_SESSIONS) << "SessionManager::onPromptSessionStopping - promptSession=" << promptSession.get();
175176
176177
=== modified file 'miral-qt/src/modules/Unity/Application/sessionmanager.h'
--- miral-qt/src/modules/Unity/Application/sessionmanager.h 2016-10-05 15:31:59 +0000
+++ miral-qt/src/modules/Unity/Application/sessionmanager.h 2016-10-10 13:04:19 +0000
@@ -70,8 +70,8 @@
70 void onSessionStarting(const miral::ApplicationInfo &appInfo);70 void onSessionStarting(const miral::ApplicationInfo &appInfo);
71 void onSessionStopping(const miral::ApplicationInfo &appInfo);71 void onSessionStopping(const miral::ApplicationInfo &appInfo);
7272
73 void onPromptSessionStarting(const std::shared_ptr<mir::scene::PromptSession>& promptSession);73 void onPromptSessionStarting(const PromptSession& promptSession);
74 void onPromptSessionStopping(const std::shared_ptr<mir::scene::PromptSession>& promptSession);74 void onPromptSessionStopping(const PromptSession& promptSession);
75 void onPromptProviderAdded(const mir::scene::PromptSession *, const std::shared_ptr<mir::scene::Session> &);75 void onPromptProviderAdded(const mir::scene::PromptSession *, const std::shared_ptr<mir::scene::Session> &);
76 void onPromptProviderRemoved(const mir::scene::PromptSession *, const std::shared_ptr<mir::scene::Session> &);76 void onPromptProviderRemoved(const mir::scene::PromptSession *, const std::shared_ptr<mir::scene::Session> &);
7777
7878
=== modified file 'miral-qt/src/platforms/mirserver/CMakeLists.txt'
--- miral-qt/src/platforms/mirserver/CMakeLists.txt 2016-10-05 16:59:28 +0000
+++ miral-qt/src/platforms/mirserver/CMakeLists.txt 2016-10-10 13:04:19 +0000
@@ -87,7 +87,7 @@
87 tracepoints.c87 tracepoints.c
88 mirserverhooks.cpp mirserverhooks.h88 mirserverhooks.cpp mirserverhooks.h
89 openglcontextfactory.cpp openglcontextfactory.h89 openglcontextfactory.cpp openglcontextfactory.h
90 promptsessionmanager.cpp promptsessionmanager.h90 promptsessionmanager.cpp promptsessionmanager.h promptsession.h
91 setqtcompositor.cpp setqtcompositor.h91 setqtcompositor.cpp setqtcompositor.h
92# We need to run moc on these headers92# We need to run moc on these headers
93 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/Mir.h93 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/Mir.h
9494
=== added file 'miral-qt/src/platforms/mirserver/promptsession.h'
--- miral-qt/src/platforms/mirserver/promptsession.h 1970-01-01 00:00:00 +0000
+++ miral-qt/src/platforms/mirserver/promptsession.h 2016-10-10 13:04:19 +0000
@@ -0,0 +1,62 @@
1/*
2 * Copyright © 2016 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17 */
18
19#ifndef QTMIR_PROMPTSESSION_H
20#define QTMIR_PROMPTSESSION_H
21
22#include <memory>
23
24namespace mir {
25namespace scene {
26class PromptSession;
27}
28}
29
30namespace qtmir {
31class PromptSession
32{
33public:
34 // Intentionally promiscuous converting constructor
35 PromptSession(const std::shared_ptr<mir::scene::PromptSession> &promptSession) :
36 m_promptSession{promptSession} {}
37
38 PromptSession() = default;
39 PromptSession(const PromptSession &that) = default;
40 PromptSession& operator=(const PromptSession &rhs) = default;
41 ~PromptSession() = default;
42
43 mir::scene::PromptSession* get() const { return m_promptSession.get(); }
44
45 friend bool operator==(const PromptSession &lhs, const PromptSession &rhs)
46 { return lhs.m_promptSession == rhs.m_promptSession; }
47
48 friend bool operator==(const PromptSession &lhs, mir::scene::PromptSession *rhs)
49 { return lhs.m_promptSession.get() == rhs; }
50
51 friend bool operator==(mir::scene::PromptSession *lhs, const PromptSession &rhs)
52 { return lhs == rhs.m_promptSession.get(); }
53
54 // Intentionally promiscuous converting operator
55 operator std::shared_ptr<mir::scene::PromptSession> const&() const { return m_promptSession; }
56
57private:
58 std::shared_ptr<mir::scene::PromptSession> m_promptSession;
59};
60}
61
62#endif //QTMIR_PROMPTSESSION_H
063
=== modified file 'miral-qt/src/platforms/mirserver/promptsessionmanager.cpp'
--- miral-qt/src/platforms/mirserver/promptsessionmanager.cpp 2016-10-05 16:08:44 +0000
+++ miral-qt/src/platforms/mirserver/promptsessionmanager.cpp 2016-10-10 13:04:19 +0000
@@ -15,33 +15,33 @@
15 */15 */
1616
17#include "promptsessionmanager.h"17#include "promptsessionmanager.h"
18#include "promptsession.h"
1819
19#include <mir/scene/prompt_session_manager.h>20#include <mir/scene/prompt_session_manager.h>
2021
21qtmir::PromptSessionManager::PromptSessionManager(std::shared_ptr<mir::scene::PromptSessionManager> const& promptSessionManager) :22qtmir::PromptSessionManager::PromptSessionManager(std::shared_ptr<mir::scene::PromptSessionManager> const &promptSessionManager) :
22 m_promptSessionManager{promptSessionManager}23 m_promptSessionManager{promptSessionManager}
23{24{
24}25}
2526
26qtmir::PromptSessionManager::~PromptSessionManager() = default;27qtmir::PromptSessionManager::~PromptSessionManager() = default;
2728
28miral::Application qtmir::PromptSessionManager::applicationFor(29miral::Application qtmir::PromptSessionManager::applicationFor(const PromptSession &promptSession) const
29 std::shared_ptr<mir::scene::PromptSession> const& promptSession) const
30{30{
31 return m_promptSessionManager->application_for(promptSession);31 return m_promptSessionManager->application_for(promptSession);
32}32}
3333
34void qtmir::PromptSessionManager::stopPromptSession(std::shared_ptr<mir::scene::PromptSession> const& promptSession) const34void qtmir::PromptSessionManager::stopPromptSession(const PromptSession &promptSession) const
35{35{
36 m_promptSessionManager->stop_prompt_session(promptSession);36 m_promptSessionManager->stop_prompt_session(promptSession);
37}37}
3838
39void qtmir::PromptSessionManager::suspendPromptSession(std::shared_ptr<mir::scene::PromptSession> const& promptSession) const39void qtmir::PromptSessionManager::suspendPromptSession(const PromptSession &promptSession) const
40{40{
41 m_promptSessionManager->suspend_prompt_session(promptSession);41 m_promptSessionManager->suspend_prompt_session(promptSession);
42}42}
4343
44void qtmir::PromptSessionManager::resumePromptSession(std::shared_ptr<mir::scene::PromptSession> const& promptSession) const44void qtmir::PromptSessionManager::resumePromptSession(const PromptSession &promptSession) const
45{45{
46 m_promptSessionManager->resume_prompt_session(promptSession);46 m_promptSessionManager->resume_prompt_session(promptSession);
47}47}
4848
=== modified file 'miral-qt/src/platforms/mirserver/promptsessionmanager.h'
--- miral-qt/src/platforms/mirserver/promptsessionmanager.h 2016-10-05 16:08:44 +0000
+++ miral-qt/src/platforms/mirserver/promptsessionmanager.h 2016-10-10 13:04:19 +0000
@@ -23,23 +23,23 @@
2323
24namespace mir {24namespace mir {
25namespace scene {25namespace scene {
26class PromptSession;
27class PromptSessionManager;26class PromptSessionManager;
28}27}
29}28}
3029
31namespace qtmir {30namespace qtmir {
31class PromptSession;
32class PromptSessionManager32class PromptSessionManager
33{33{
34public:34public:
35 explicit PromptSessionManager(std::shared_ptr<mir::scene::PromptSessionManager> const& promptSessionManager);35 explicit PromptSessionManager(const std::shared_ptr<mir::scene::PromptSessionManager> &promptSessionManager);
36 virtual ~PromptSessionManager();36 virtual ~PromptSessionManager();
3737
38 miral::Application applicationFor(std::shared_ptr<mir::scene::PromptSession> const& promptSession) const;38 miral::Application applicationFor(qtmir::PromptSession const &promptSession) const;
3939
40 void stopPromptSession(std::shared_ptr<mir::scene::PromptSession> const& promptSession) const;40 void stopPromptSession(qtmir::PromptSession const &promptSession) const;
41 void suspendPromptSession(std::shared_ptr<mir::scene::PromptSession> const& promptSession) const;41 void suspendPromptSession(qtmir::PromptSession const &promptSession) const;
42 void resumePromptSession(std::shared_ptr<mir::scene::PromptSession> const& promptSession) const;42 void resumePromptSession(qtmir::PromptSession const &promptSession) const;
4343
44private:44private:
45 std::shared_ptr<mir::scene::PromptSessionManager> const m_promptSessionManager;45 std::shared_ptr<mir::scene::PromptSessionManager> const m_promptSessionManager;
4646
=== modified file 'miral-qt/tests/framework/fake_session.cpp'
--- miral-qt/tests/framework/fake_session.cpp 2016-08-16 14:15:26 +0000
+++ miral-qt/tests/framework/fake_session.cpp 2016-10-10 13:04:19 +0000
@@ -16,6 +16,8 @@
1616
17#include "fake_session.h"17#include "fake_session.h"
1818
19#include "promptsession.h"
20
19namespace qtmir21namespace qtmir
20{22{
2123
@@ -94,20 +96,20 @@
9496
95void FakeSession::foreachChildSession(const std::function<void (SessionInterface *)> &) const {}97void FakeSession::foreachChildSession(const std::function<void (SessionInterface *)> &) const {}
9698
97std::shared_ptr<mir::scene::PromptSession> FakeSession::activePromptSession() const99qtmir::PromptSession FakeSession::activePromptSession() const
98{100{
99 return std::shared_ptr<mir::scene::PromptSession>();101 return {};
100}102}
101103
102void FakeSession::foreachPromptSession(const std::function<void (const std::shared_ptr<mir::scene::PromptSession> &)> &) const {}104void FakeSession::foreachPromptSession(const std::function<void (const qtmir::PromptSession &)> &) const {}
103105
104void FakeSession::setFullscreen(bool) {}106void FakeSession::setFullscreen(bool) {}
105107
106void FakeSession::setLive(const bool) {}108void FakeSession::setLive(const bool) {}
107109
108void FakeSession::appendPromptSession(const std::shared_ptr<mir::scene::PromptSession> &) {}110void FakeSession::appendPromptSession(const qtmir::PromptSession &) {}
109111
110void FakeSession::removePromptSession(const std::shared_ptr<mir::scene::PromptSession> &) {}112void FakeSession::removePromptSession(const qtmir::PromptSession &) {}
111113
112void FakeSession::setState(SessionInterface::State state)114void FakeSession::setState(SessionInterface::State state)
113{115{
114116
=== modified file 'miral-qt/tests/framework/fake_session.h'
--- miral-qt/tests/framework/fake_session.h 2016-09-30 19:28:12 +0000
+++ miral-qt/tests/framework/fake_session.h 2016-10-10 13:04:19 +0000
@@ -70,13 +70,13 @@
70 void removeChildSession(SessionInterface*) override;70 void removeChildSession(SessionInterface*) override;
71 void foreachChildSession(const std::function<void(SessionInterface* session)> &) const override;71 void foreachChildSession(const std::function<void(SessionInterface* session)> &) const override;
7272
73 std::shared_ptr<mir::scene::PromptSession> activePromptSession() const override;73 PromptSession activePromptSession() const override;
74 void foreachPromptSession(const std::function<void(const std::shared_ptr<mir::scene::PromptSession>&)> &) const override;74 void foreachPromptSession(const std::function<void(const PromptSession&)> &) const override;
7575
76 void setFullscreen(bool) override;76 void setFullscreen(bool) override;
77 void setLive(const bool) override;77 void setLive(const bool) override;
78 void appendPromptSession(const std::shared_ptr<mir::scene::PromptSession>&) override;78 void appendPromptSession(const PromptSession&) override;
79 void removePromptSession(const std::shared_ptr<mir::scene::PromptSession>&) override;79 void removePromptSession(const PromptSession&) override;
8080
81 // For tests81 // For tests
8282
8383
=== modified file 'miral-qt/tests/framework/mock_session.h'
--- miral-qt/tests/framework/mock_session.h 2016-08-16 14:15:26 +0000
+++ miral-qt/tests/framework/mock_session.h 2016-10-10 13:04:19 +0000
@@ -18,6 +18,7 @@
18#define MOCK_QTMIR_SESSION_H18#define MOCK_QTMIR_SESSION_H
1919
20#include <Unity/Application/session_interface.h>20#include <Unity/Application/session_interface.h>
21#include "promptsession.h"
21#include <gmock/gmock.h>22#include <gmock/gmock.h>
2223
23namespace qtmir {24namespace qtmir {
@@ -59,8 +60,8 @@
59 MOCK_METHOD1(removeChildSession, void(SessionInterface* session));60 MOCK_METHOD1(removeChildSession, void(SessionInterface* session));
60 MOCK_CONST_METHOD1(foreachChildSession, void(const std::function<void(SessionInterface* session)> &f));61 MOCK_CONST_METHOD1(foreachChildSession, void(const std::function<void(SessionInterface* session)> &f));
6162
62 MOCK_CONST_METHOD0(activePromptSession, std::shared_ptr<mir::scene::PromptSession>());63 MOCK_CONST_METHOD0(activePromptSession, qtmir::PromptSession());
63 MOCK_CONST_METHOD1(foreachPromptSession, void(const std::function<void(const std::shared_ptr<mir::scene::PromptSession>&)> &f));64 MOCK_CONST_METHOD1(foreachPromptSession, void(const std::function<void(const qtmir::PromptSession&)> &f));
6465
65 void setState(State state);66 void setState(State state);
6667
@@ -72,8 +73,8 @@
72protected:73protected:
73 MOCK_METHOD1(setFullscreen, void(bool fullscreen));74 MOCK_METHOD1(setFullscreen, void(bool fullscreen));
74 MOCK_METHOD1(setLive, void(const bool));75 MOCK_METHOD1(setLive, void(const bool));
75 MOCK_METHOD1(appendPromptSession, void(const std::shared_ptr<mir::scene::PromptSession>& session));76 MOCK_METHOD1(appendPromptSession, void(const qtmir::PromptSession& session));
76 MOCK_METHOD1(removePromptSession, void(const std::shared_ptr<mir::scene::PromptSession>& session));77 MOCK_METHOD1(removePromptSession, void(const qtmir::PromptSession& session));
7778
78private:79private:
79 State m_state;80 State m_state;
8081
=== modified file 'miral-qt/tests/modules/SessionManager/session_manager_test.cpp'
--- miral-qt/tests/modules/SessionManager/session_manager_test.cpp 2016-10-05 15:31:59 +0000
+++ miral-qt/tests/modules/SessionManager/session_manager_test.cpp 2016-10-10 13:04:19 +0000
@@ -18,6 +18,7 @@
18#include <condition_variable>18#include <condition_variable>
19#include <QSignalSpy>19#include <QSignalSpy>
2020
21#include "promptsession.h"
21#include <Unity/Application/session.h>22#include <Unity/Application/session.h>
2223
23#include "qtmir_test.h"24#include "qtmir_test.h"
@@ -33,9 +34,9 @@
33 SessionManagerTests()34 SessionManagerTests()
34 {}35 {}
3536
36 QList<std::shared_ptr<ms::PromptSession>> listPromptSessions(SessionInterface* session) {37 QList<qtmir::PromptSession> listPromptSessions(SessionInterface* session) {
37 QList<std::shared_ptr<ms::PromptSession>> promptSessions;38 QList<qtmir::PromptSession> promptSessions;
38 session->foreachPromptSession([&promptSessions](const std::shared_ptr<ms::PromptSession>& promptSession) {39 session->foreachPromptSession([&promptSessions](const qtmir::PromptSession &promptSession) {
39 promptSessions << promptSession;40 promptSessions << promptSession;
40 });41 });
41 return promptSessions;42 return promptSessions;
@@ -61,7 +62,7 @@
61 SessionInterface* qtmirAppSession = sessionManager.findSession(mirAppSession.get());62 SessionInterface* qtmirAppSession = sessionManager.findSession(mirAppSession.get());
62 EXPECT_TRUE(qtmirAppSession != nullptr);63 EXPECT_TRUE(qtmirAppSession != nullptr);
6364
64 auto promptSession = std::make_shared<ms::MockPromptSession>();65 qtmir::PromptSession promptSession{std::make_shared<ms::MockPromptSession>()};
65 ON_CALL(*stubPromptSessionManager, application_for(_)).WillByDefault(Return(mirAppSession));66 ON_CALL(*stubPromptSessionManager, application_for(_)).WillByDefault(Return(mirAppSession));
6667
67 sessionManager.onPromptSessionStarting(promptSession);68 sessionManager.onPromptSessionStarting(promptSession);
6869
=== modified file 'miral-qt/tests/modules/SessionManager/session_test.cpp'
--- miral-qt/tests/modules/SessionManager/session_test.cpp 2016-10-06 13:57:18 +0000
+++ miral-qt/tests/modules/SessionManager/session_test.cpp 2016-10-10 13:04:19 +0000
@@ -17,6 +17,7 @@
17#include <qtmir_test.h>17#include <qtmir_test.h>
18#include <fake_mirsurface.h>18#include <fake_mirsurface.h>
1919
20#include "promptsession.h"
20#include <Unity/Application/application.h>21#include <Unity/Application/application.h>
21#include <Unity/Application/mirsurfaceitem.h>22#include <Unity/Application/mirsurfaceitem.h>
2223
@@ -226,8 +227,8 @@
226 }227 }
227 EXPECT_EQ(Session::Running, session->state());228 EXPECT_EQ(Session::Running, session->state());
228229
229 auto mirPromptSession = std::make_shared<ms::MockPromptSession>();230 qtmir::PromptSession promptSession{std::make_shared<ms::MockPromptSession>()};
230 session->appendPromptSession(mirPromptSession);231 session->appendPromptSession(promptSession);
231232
232 EXPECT_CALL(*stubPromptSessionManager, suspend_prompt_session(_)).Times(1);233 EXPECT_CALL(*stubPromptSessionManager, suspend_prompt_session(_)).Times(1);
233234
@@ -264,8 +265,8 @@
264 session->doSuspend();265 session->doSuspend();
265 EXPECT_EQ(Session::Suspended, session->state());266 EXPECT_EQ(Session::Suspended, session->state());
266267
267 auto mirPromptSession = std::make_shared<ms::MockPromptSession>();268 qtmir::PromptSession promptSession{std::make_shared<ms::MockPromptSession>()};
268 session->appendPromptSession(mirPromptSession);269 session->appendPromptSession(promptSession);
269270
270 EXPECT_CALL(*stubPromptSessionManager, resume_prompt_session(_)).Times(1);271 EXPECT_CALL(*stubPromptSessionManager, resume_prompt_session(_)).Times(1);
271272

Subscribers

People subscribed via source and target branches