on xenial help sign in
renaming + updates
commita5d616e2683082c82062a4c3e9609a1decc83aa8 authorNick Dedekind <nicholas.dedekind@gmail.com> dateWed 27 Aug 2014, 15:07 (12 years ago) parenta3e4cde
19 files changed+122−120
qml/Stages/Animations/BaseSessionAnimation.qml+4−2 qml/Stages/Animations/SwipeFromBottomAnimation.qml+8−8 qml/Stages/SessionContainer.qml+7−7 tests/mocks/Unity/Application/ApplicationInfo.cpp+2−2 tests/mocks/Unity/Application/ApplicationInfo.h+5−5 tests/mocks/Unity/Application/ApplicationManager.cpp+1−1 tests/mocks/Unity/Application/ApplicationTestInterface.cpp+4−4 tests/mocks/Unity/Application/ApplicationTestInterface.h+2−2 tests/mocks/Unity/Application/CMakeLists.txt+3−3 tests/mocks/Unity/Application/MirItemModel.h → tests/mocks/Unity/Application/MirObjectModel.h+5−5 tests/mocks/Unity/Application/MirSurfaceItem.cpp+2−2 tests/mocks/Unity/Application/MirSurfaceItem.h+4−4 tests/mocks/Unity/Application/MirSurfaceItemModel.h+3−3 tests/mocks/Unity/Application/MirSessionItem.cpp → tests/mocks/Unity/Application/Session.cpp+26−26 tests/mocks/Unity/Application/MirSessionItem.h → tests/mocks/Unity/Application/Session.h+21−21 tests/mocks/Unity/Application/SessionManager.cpp+6−6 tests/mocks/Unity/Application/SessionManager.h+7−7 tests/mocks/Unity/Application/MirSessionItemModel.h → tests/mocks/Unity/Application/SessionModel.h+8−8 tests/mocks/Unity/Application/plugin.cpp+4−4
qml/Stages/Animations/BaseSessionAnimation.qml+4−2
@@ -37,7 +37,9 @@ import QtQuick 2.0
3737 */
3838Item {
3939 id: base
40− property Item session: null
40+ property var sessionContainer
41+ property var surfaceContainer
42+
4143
4244 // changes applied when state changes to "in"
4345 property list<QtObject> outChanges
@@ -61,7 +63,7 @@ Item {
6163 states: [
6264 State {
6365 name: "baseAnimation"
64− PropertyChanges { target: base.session; anchors.fill: undefined }
66+ PropertyChanges { target: surfaceContainer; anchors.fill: undefined }
6567 },
6668
6769 State {
qml/Stages/Animations/SwipeFromBottomAnimation.qml+8−8
@@ -19,20 +19,20 @@ import QtQuick 2.0
1919BaseSessionAnimation {
2020 id: animation
2121
22− outChanges: [ AnchorChanges { target: animation.session; anchors.top: animation.parent.bottom } ]
22+ outChanges: [ AnchorChanges { target: surfaceContainer; anchors.top: sessionContainer.bottom } ]
2323 outAnimations: [
2424 SequentialAnimation {
25− PropertyAction { target: animation.parent; property: "clip"; value: true }
25+ PropertyAction { target: sessionContainer; property: "clip"; value: true }
2626 AnchorAnimation { easing.type: Easing.InOutQuad; duration: 400 }
27− PropertyAction { target: animation.session; property: "visible"; value: !animation.parent.removing }
28− PropertyAction { target: animation.parent; property: "clip"; value: false }
29− ScriptAction { script: { if (animation.parent.removing) animation.session.release(); } }
27+ PropertyAction { target: surfaceContainer; property: "visible"; value: !sessionContainer.removing }
28+ PropertyAction { target: sessionContainer; property: "clip"; value: false }
29+ ScriptAction { script: { if (sessionContainer.removing) sessionContainer.session.release(); } }
3030 }
3131 ]
3232
3333 inChanges: [
3434 AnchorChanges {
35− target: animation.session;
35+ target: surfaceContainer;
3636 anchors.top: animation.parent.top
3737 anchors.right: undefined
3838 anchors.bottom: undefined
@@ -40,9 +40,9 @@ BaseSessionAnimation {
4040 } ]
4141 inAnimations: [
4242 SequentialAnimation {
43− PropertyAction { target: animation.parent; property: "clip"; value: true }
43+ PropertyAction { target: sessionContainer; property: "clip"; value: true }
4444 AnchorAnimation { easing.type: Easing.InOutQuad; duration: 400 }
45− PropertyAction { target: animation.parent; property: "clip"; value: false }
45+ PropertyAction { target: sessionContainer; property: "clip"; value: false }
4646 }
4747 ]
4848}
qml/Stages/SessionContainer.qml+7−7
@@ -20,7 +20,7 @@ import "Animations"
2020Item {
2121 id: root
2222 objectName: "sessionContainer"
23− property Item session
23+ property QtObject session
2424 property var childSessions: session ? session.childSessions : 0
2525 property bool removing: false
2626 property alias surface: _surfaceContainer.surface
@@ -32,15 +32,11 @@ Item {
3232 session.z = 1;
3333 }
3434 }
35− Binding {
36− target: session
37− property: "anchors.fill"; value: root
38− }
3935
4036 readonly property alias surfaceContainer: _surfaceContainer
4137 SurfaceContainer {
4238 id: _surfaceContainer
43− anchors.fill: session
39+ anchors.fill: parent
4440 z: 2
4541 surface: session ? session.surface : null
4642 }
@@ -92,7 +88,11 @@ Item {
9288 }
9389
9490 function animateIn(animationComponent) {
95− var animation = animationComponent.createObject(root, { "session": root.session });
91+ var animation = animationComponent.createObject(root,
92+ {
93+ "sessionContainer": root,
94+ "surfaceContainer": surfaceContainer
95+ });
9696 animation.start();
9797
9898 var tmp = d.animations;
tests/mocks/Unity/Application/ApplicationInfo.cpp+2−2
@@ -15,7 +15,7 @@
1515 */
1616
1717#include "ApplicationInfo.h"
18−#include "MirSessionItem.h"
18+#include "Session.h"
1919#include "SessionManager.h"
2020
2121#include <paths.h>
@@ -63,7 +63,7 @@ void ApplicationInfo::createSession()
6363 setSession(SessionManager::singleton()->createSession(appId(), screenshotUrl));
6464}
6565
66−void ApplicationInfo::setSession(MirSessionItem* session)
66+void ApplicationInfo::setSession(Session* session)
6767{
6868 qDebug() << "Application::setSession - appId=" << appId() << "session=" << session;
6969 if (m_session == session)
tests/mocks/Unity/Application/ApplicationInfo.h+5−5
@@ -34,7 +34,7 @@ class ApplicationInfo : public ApplicationInfoInterface {
3434 Q_OBJECT
3535
3636 Q_PROPERTY(bool fullscreen READ fullscreen WRITE setFullscreen NOTIFY fullscreenChanged)
37− Q_PROPERTY(MirSessionItem* session READ session NOTIFY sessionChanged)
37+ Q_PROPERTY(Session* session READ session NOTIFY sessionChanged)
3838
3939 // Only exists in this fake implementation
4040
@@ -76,11 +76,11 @@ public:
7676 void setManualSessionCreation(bool value);
7777
7878public:
79− void setSession(MirSessionItem* session);
80− MirSessionItem* session() const { return m_session; }
79+ void setSession(Session* session);
80+ Session* session() const { return m_session; }
8181
8282Q_SIGNALS:
83− void sessionChanged(MirSessionItem*);
83+ void sessionChanged(Session*);
8484 void fullscreenChanged(bool value);
8585 void manualSessionCreationChanged(bool value);
8686
@@ -101,7 +101,7 @@ private:
101101 bool m_fullscreen;
102102
103103 QQuickItem *m_parentItem;
104− MirSessionItem* m_session;
104+ Session* m_session;
105105
106106 bool m_manualSessionCreation;
107107};
tests/mocks/Unity/Application/ApplicationManager.cpp+1−1
@@ -16,7 +16,7 @@
1616
1717#include "ApplicationManager.h"
1818#include "ApplicationInfo.h"
19−#include "MirSessionItem.h"
19+#include "Session.h"
2020#include "ApplicationTestInterface.h"
2121
2222#include <paths.h>
tests/mocks/Unity/Application/ApplicationTestInterface.cpp+4−4
@@ -19,7 +19,7 @@
1919#include "ApplicationManager.h"
2020#include "SessionManager.h"
2121#include "SurfaceManager.h"
22−#include "MirSessionItem.h"
22+#include "Session.h"
2323#include "MirSurfaceItem.h"
2424
2525#include <paths.h>
@@ -44,7 +44,7 @@ quint32 ApplicationTestInterface::addChildSession(const QString& appId, quint32
4444 return 0;
4545 }
4646
47− MirSessionItem* parentSession = nullptr;
47+ Session* parentSession = nullptr;
4848 if (m_childSessions.contains(existingSessionId)) {
4949 parentSession = m_childSessions[existingSessionId];
5050 } else if (application->session()) {
@@ -59,7 +59,7 @@ quint32 ApplicationTestInterface::addChildSession(const QString& appId, quint32
5959 .arg(surfaceImage);
6060
6161 quint32 sessionId = ++nextId;
62− MirSessionItem* session = SessionManager::singleton()->createSession(
62+ Session* session = SessionManager::singleton()->createSession(
6363 QString("%1-Child%2").arg(parentSession->name())
6464 .arg(sessionId),
6565 screenshotUrl);
@@ -78,7 +78,7 @@ void ApplicationTestInterface::removeSession(quint32 sessionId)
7878 qDebug() << "ApplicationTestInterface::removeSession - No added session for " << sessionId;
7979 return;
8080 }
81− MirSessionItem* session = m_childSessions.take(sessionId);
81+ Session* session = m_childSessions.take(sessionId);
8282 Q_EMIT session->removed();
8383}
8484
tests/mocks/Unity/Application/ApplicationTestInterface.h+2−2
@@ -20,7 +20,7 @@
2020#include <QtDBus/QtDBus>
2121
2222class ApplicationManager;
23−class MirSessionItem;
23+class Session;
2424class MirSurfaceItem;
2525
2626class ApplicationTestInterface : public QDBusAbstractAdaptor
@@ -37,7 +37,7 @@ public Q_SLOTS:
3737 Q_INVOKABLE void removeSurface(quint32 surfaceId);
3838
3939private:
40− QHash<quint32, MirSessionItem*> m_childSessions;
40+ QHash<quint32, Session*> m_childSessions;
4141 QHash<quint32, MirSurfaceItem*> m_childSurfaces;
4242};
4343
tests/mocks/Unity/Application/CMakeLists.txt+3−3
@@ -6,13 +6,13 @@ set(FakeUnityApplicationQml_SOURCES
66 ApplicationManager.cpp
77 ApplicationScreenshotProvider.cpp
88 ApplicationTestInterface.cpp
9− MirSessionItem.cpp
9+ Session.cpp
1010 MirSurfaceItem.cpp
1111 SessionManager.cpp
1212 SurfaceManager.cpp
13− MirItemModel.h
13+ MirObjectModel.h
1414 MirSurfaceItemModel.h
15− MirSessionItemModel.h
15+ SessionModel.h
1616 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationInfoInterface.h
1717 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationManagerInterface.h
1818)
tests/mocks/Unity/Application/MirItemModel.h → tests/mocks/Unity/Application/MirObjectModel.hrenamed+5−5
@@ -14,8 +14,8 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#ifndef MIRITEMMODEL_H
18−#define MIRITEMMODEL_H
17+#ifndef MIROBJECTMODEL_H
18+#define MIROBJECTMODEL_H
1919
2020// Qt
2121#include <QAbstractListModel>
@@ -23,10 +23,10 @@
2323class MirSurfaceItem;
2424
2525template<class TYPE>
26−class MirItemModel : public QAbstractListModel
26+class MirObjectModel : public QAbstractListModel
2727{
2828public:
29− MirItemModel(QObject *parent = 0)
29+ MirObjectModel(QObject *parent = 0)
3030 : QAbstractListModel(parent)
3131 {}
3232
@@ -105,4 +105,4 @@ protected:
105105 QList<TYPE*> m_items;
106106};
107107
108−#endif // MIRITEMMODEL_H
108+#endif // MIROBJECTMODEL_H
tests/mocks/Unity/Application/MirSurfaceItem.cpp+2−2
@@ -15,7 +15,7 @@
1515 */
1616
1717#include "MirSurfaceItem.h"
18−#include "MirSessionItem.h"
18+#include "Session.h"
1919
2020#include <paths.h>
2121
@@ -122,7 +122,7 @@ void MirSurfaceItem::release()
122122 }
123123}
124124
125−void MirSurfaceItem::setSession(MirSessionItem* session)
125+void MirSurfaceItem::setSession(Session* session)
126126{
127127 m_session = session;
128128}
tests/mocks/Unity/Application/MirSurfaceItem.h+4−4
@@ -22,7 +22,7 @@
2222#include <QQuickItem>
2323#include <QUrl>
2424
25−class MirSessionItem;
25+class Session;
2626
2727class MirSurfaceItem : public QQuickItem
2828{
@@ -60,13 +60,13 @@ public:
6060 ~MirSurfaceItem();
6161
6262 //getters
63− MirSessionItem* session() const { return m_session; }
63+ Session* session() const { return m_session; }
6464 Type type() const { return m_type; }
6565 State state() const { return m_state; }
6666 QString name() const { return m_name; }
6767 MirSurfaceItem* parentSurface() const { return m_parentSurface; }
6868
69− void setSession(MirSessionItem* item);
69+ void setSession(Session* item);
7070 void setScreenshot(const QUrl& screenshot);
7171
7272 Q_INVOKABLE void setState(State newState);
@@ -107,7 +107,7 @@ private:
107107 void createQmlContentItem();
108108 void printComponentErrors();
109109
110− MirSessionItem* m_session;
110+ Session* m_session;
111111 const QString m_name;
112112 const Type m_type;
113113 State m_state;
tests/mocks/Unity/Application/MirSurfaceItemModel.h+3−3
@@ -18,14 +18,14 @@
1818#define MIRSURFACEITEMMODEL_H
1919
2020// Llocal
21−#include "MirItemModel.h"
21+#include "MirObjectModel.h"
2222
2323class MirSurfaceItem;
24−class MirSurfaceItemModel: public MirItemModel<MirSurfaceItem>
24+class MirSurfaceItemModel: public MirObjectModel<MirSurfaceItem>
2525{
2626 Q_OBJECT
2727public:
28− MirSurfaceItemModel(QObject *parent = 0): MirItemModel(parent) {}
28+ MirSurfaceItemModel(QObject *parent = 0): MirObjectModel(parent) {}
2929
3030 Q_INVOKABLE int count() const { return rowCount(); }
3131};
tests/mocks/Unity/Application/MirSessionItem.cpp → tests/mocks/Unity/Application/Session.cpprenamed+26−26
@@ -14,7 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#include "MirSessionItem.h"
17+#include "Session.h"
1818#include "ApplicationInfo.h"
1919#include "SurfaceManager.h"
2020
@@ -22,29 +22,29 @@
2222#include <QQmlEngine>
2323#include <QTimer>
2424
25−MirSessionItem::MirSessionItem(const QString &name,
26− const QUrl& screenshot,
27− QQuickItem *parent)
28− : QQuickItem(parent)
25+Session::Session(const QString &name,
26+ const QUrl& screenshot,
27+ QObject *parent)
28+ : QObject(parent)
2929 , m_name(name)
3030 , m_screenshot(screenshot)
3131 , m_application(nullptr)
3232 , m_surface(nullptr)
3333 , m_parentSession(nullptr)
34− , m_children(new MirSessionItemModel(this))
34+ , m_children(new SessionModel(this))
3535 , m_manualSurfaceCreation(false)
3636{
37− qDebug() << "MirSessionItem::MirSessionItem() " << this->name();
37+ qDebug() << "Session::Session() " << this->name();
3838
3939 QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
4040}
4141
42−MirSessionItem::~MirSessionItem()
42+Session::~Session()
4343{
44− qDebug() << "MirSessionItem::~MirSessionItem() " << name();
44+ qDebug() << "Session::~Session() " << name();
4545
46− QList<MirSessionItem*> children(m_children->list());
47− for (MirSessionItem* child : children) {
46+ QList<Session*> children(m_children->list());
47+ for (Session* child : children) {
4848 delete child;
4949 }
5050 if (m_parentSession) {
@@ -57,9 +57,9 @@ MirSessionItem::~MirSessionItem()
5757 delete m_children;
5858}
5959
60−void MirSessionItem::release()
60+void Session::release()
6161{
62− qDebug() << "MirSessionItem::release " << name();
62+ qDebug() << "Session::release " << name();
6363 Q_EMIT aboutToBeDestroyed();
6464
6565 if (m_parentSession) {
@@ -73,7 +73,7 @@ void MirSessionItem::release()
7373 }
7474}
7575
76−void MirSessionItem::setApplication(ApplicationInfo* application)
76+void Session::setApplication(ApplicationInfo* application)
7777{
7878 if (m_application == application)
7979 return;
@@ -96,9 +96,9 @@ void MirSessionItem::setApplication(ApplicationInfo* application)
9696 }
9797}
9898
99−void MirSessionItem::setSurface(MirSurfaceItem* surface)
99+void Session::setSurface(MirSurfaceItem* surface)
100100{
101− qDebug() << "MirSessionItem::setSurface - session=" << name() << "surface=" << surface;
101+ qDebug() << "Session::setSurface - session=" << name() << "surface=" << surface;
102102 if (m_surface == surface)
103103 return;
104104
@@ -117,7 +117,7 @@ void MirSessionItem::setSurface(MirSurfaceItem* surface)
117117 Q_EMIT surfaceChanged(m_surface);
118118}
119119
120−void MirSessionItem::setScreenshot(const QUrl& screenshot)
120+void Session::setScreenshot(const QUrl& screenshot)
121121{
122122 if (screenshot != m_screenshot) {
123123 m_screenshot = screenshot;
@@ -127,7 +127,7 @@ void MirSessionItem::setScreenshot(const QUrl& screenshot)
127127 }
128128}
129129
130−void MirSessionItem::setParentSession(MirSessionItem* session)
130+void Session::setParentSession(Session* session)
131131{
132132 if (m_parentSession == session || session == this)
133133 return;
@@ -136,7 +136,7 @@ void MirSessionItem::setParentSession(MirSessionItem* session)
136136 Q_EMIT parentSessionChanged(session);
137137}
138138
139−void MirSessionItem::createSurface()
139+void Session::createSurface()
140140{
141141 if (m_surface) return;
142142
@@ -146,22 +146,22 @@ void MirSessionItem::createSurface()
146146 m_screenshot));
147147}
148148
149−void MirSessionItem::addChildSession(MirSessionItem* session)
149+void Session::addChildSession(Session* session)
150150{
151151 insertChildSession(m_children->rowCount(), session);
152152}
153153
154−void MirSessionItem::insertChildSession(uint index, MirSessionItem* session)
154+void Session::insertChildSession(uint index, Session* session)
155155{
156− qDebug() << "MirSessionItem::insertChildSession - " << session->name() << " to " << name() << " @ " << index;
156+ qDebug() << "Session::insertChildSession - " << session->name() << " to " << name() << " @ " << index;
157157
158158 session->setParentSession(this);
159159 m_children->insert(index, session);
160160}
161161
162−void MirSessionItem::removeChildSession(MirSessionItem* session)
162+void Session::removeChildSession(Session* session)
163163{
164− qDebug() << "MirSessionItem::removeChildSession - " << session->name() << " from " << name();
164+ qDebug() << "Session::removeChildSession - " << session->name() << " from " << name();
165165
166166 if (m_children->contains(session)) {
167167 m_children->remove(session);
@@ -169,12 +169,12 @@ void MirSessionItem::removeChildSession(MirSessionItem* session)
169169 }
170170}
171171
172−MirSessionItemModel* MirSessionItem::childSessions() const
172+SessionModel* Session::childSessions() const
173173{
174174 return m_children;
175175}
176176
177−void MirSessionItem::setManualSurfaceCreation(bool value)
177+void Session::setManualSurfaceCreation(bool value)
178178{
179179 if (value != m_manualSurfaceCreation) {
180180 m_manualSurfaceCreation = value;
tests/mocks/Unity/Application/MirSessionItem.h → tests/mocks/Unity/Application/Session.hrenamed+21−21
@@ -14,22 +14,22 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#ifndef MIRSESSIONITEM_H
18−#define MIRSESSIONITEM_H
17+#ifndef SESSION_H
18+#define SESSION_H
1919
20−#include "MirSessionItemModel.h"
20+#include "SessionModel.h"
2121
2222#include <QQuickItem>
2323
2424class ApplicationInfo;
2525
26−class MirSessionItem : public QQuickItem
26+class Session : public QObject
2727{
2828 Q_OBJECT
2929 Q_PROPERTY(QString name READ name CONSTANT)
3030 Q_PROPERTY(MirSurfaceItem* surface READ surface NOTIFY surfaceChanged)
31− Q_PROPERTY(MirSessionItem* parentSession READ parentSession NOTIFY parentSessionChanged DESIGNABLE false)
32− Q_PROPERTY(MirSessionItemModel* childSessions READ childSessions DESIGNABLE false CONSTANT)
31+ Q_PROPERTY(Session* parentSession READ parentSession NOTIFY parentSessionChanged DESIGNABLE false)
32+ Q_PROPERTY(SessionModel* childSessions READ childSessions DESIGNABLE false CONSTANT)
3333
3434 // Only exists in this fake implementation
3535
@@ -37,10 +37,10 @@ class MirSessionItem : public QQuickItem
3737 Q_PROPERTY(bool manualSurfaceCreation READ manualSurfaceCreation WRITE setManualSurfaceCreation NOTIFY manualSurfaceCreationChanged)
3838
3939public:
40− explicit MirSessionItem(const QString &name,
41− const QUrl& screenshot,
42− QQuickItem *parent = 0);
43− ~MirSessionItem();
40+ explicit Session(const QString &name,
41+ const QUrl& screenshot,
42+ QObject *parent = 0);
43+ ~Session();
4444
4545 Q_INVOKABLE void release();
4646
@@ -48,22 +48,22 @@ public:
4848 QString name() const { return m_name; }
4949 ApplicationInfo* application() const { return m_application; }
5050 MirSurfaceItem* surface() const { return m_surface; }
51− MirSessionItem* parentSession() const { return m_parentSession; }
51+ Session* parentSession() const { return m_parentSession; }
5252
5353 void setApplication(ApplicationInfo* item);
5454 void setSurface(MirSurfaceItem* surface);
5555 void setScreenshot(const QUrl& m_screenshot);
5656
57− Q_INVOKABLE void addChildSession(MirSessionItem* session);
58− void insertChildSession(uint index, MirSessionItem* session);
59− void removeChildSession(MirSessionItem* session);
57+ Q_INVOKABLE void addChildSession(Session* session);
58+ void insertChildSession(uint index, Session* session);
59+ void removeChildSession(Session* session);
6060
6161 bool manualSurfaceCreation() const { return m_manualSurfaceCreation; }
6262 void setManualSurfaceCreation(bool value);
6363
6464Q_SIGNALS:
6565 void surfaceChanged(MirSurfaceItem*);
66− void parentSessionChanged(MirSessionItem*);
66+ void parentSessionChanged(Session*);
6767 void removed();
6868 void aboutToBeDestroyed();
6969 void manualSurfaceCreationChanged(bool value);
@@ -72,19 +72,19 @@ public Q_SLOTS:
7272 Q_INVOKABLE void createSurface();
7373
7474private:
75− MirSessionItemModel* childSessions() const;
76− void setParentSession(MirSessionItem* session);
75+ SessionModel* childSessions() const;
76+ void setParentSession(Session* session);
7777
7878 QString m_name;
7979 QUrl m_screenshot;
8080 ApplicationInfo* m_application;
8181 MirSurfaceItem* m_surface;
82− MirSessionItem* m_parentSession;
83− MirSessionItemModel* m_children;
82+ Session* m_parentSession;
83+ SessionModel* m_children;
8484
8585 bool m_manualSurfaceCreation;
8686};
8787
88−Q_DECLARE_METATYPE(MirSessionItem*)
88+Q_DECLARE_METATYPE(Session*)
8989
90−#endif // MIRSESSIONITEM_H
90+#endif // SESSION_H
tests/mocks/Unity/Application/SessionManager.cpp+6−6
@@ -16,7 +16,7 @@
1616
1717#include "SessionManager.h"
1818
19−#include "MirSurfaceItem.h"
19+#include "Session.h"
2020
2121SessionManager *SessionManager::the_session_manager = nullptr;
2222
@@ -34,12 +34,12 @@ SessionManager::SessionManager(QObject *parent) :
3434}
3535
3636
37−MirSessionItem *SessionManager::createSession(const QString& name,
38− const QUrl& screenshot)
37+Session *SessionManager::createSession(const QString& name,
38+ const QUrl& screenshot)
3939{
40− MirSessionItem* session = new MirSessionItem(name, screenshot);
41− connect(session, &MirSessionItem::aboutToBeDestroyed, this, [&] {
42− Q_EMIT sessionStopping(qobject_cast<MirSessionItem*>(sender()));
40+ Session* session = new Session(name, screenshot);
41+ connect(session, &Session::aboutToBeDestroyed, this, [&] {
42+ Q_EMIT sessionStopping(qobject_cast<Session*>(sender()));
4343 });
4444
4545 Q_EMIT sessionStarting(session);
tests/mocks/Unity/Application/SessionManager.h+7−7
@@ -14,12 +14,12 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#ifndef SESSIONMANAGER_
18−#define SESSIONMANAGER_
17+#ifndef SESSIONMANAGER_H
18+#define SESSIONMANAGER_H
1919
2020#include <QObject>
2121
22−#include "MirSessionItem.h"
22+class Session;
2323
2424class SessionManager : public QObject
2525{
@@ -29,14 +29,14 @@ public:
2929
3030 static SessionManager *singleton();
3131
32− Q_INVOKABLE MirSessionItem* createSession(const QString& name, const QUrl& screenshot);
32+ Q_INVOKABLE Session* createSession(const QString& name, const QUrl& screenshot);
3333
3434Q_SIGNALS:
35− void sessionStarting(MirSessionItem *session);
36− void sessionStopping(MirSessionItem *session);
35+ void sessionStarting(Session *session);
36+ void sessionStopping(Session *session);
3737
3838private:
3939 static SessionManager *the_session_manager;
4040};
4141
42−#endif // SESSIONMANAGER_
42+#endif // SESSIONMANAGER_H
tests/mocks/Unity/Application/MirSessionItemModel.h → tests/mocks/Unity/Application/SessionModel.hrenamed+8−8
@@ -14,22 +14,22 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#ifndef MIRSESSIONITEMMODEL_H
18−#define MIRSESSIONITEMMODEL_H
17+#ifndef SESSIONMODEL_H
18+#define SESSIONMODEL_H
1919
2020// Local
21−#include "MirItemModel.h"
21+#include "MirObjectModel.h"
2222
23−class MirSessionItem;
24−class MirSessionItemModel: public MirItemModel<MirSessionItem>
23+class Session;
24+class SessionModel: public MirObjectModel<Session>
2525{
2626 Q_OBJECT
2727public:
28− MirSessionItemModel(QObject *parent = 0): MirItemModel(parent) {}
28+ SessionModel(QObject *parent = 0): MirObjectModel(parent) {}
2929
3030 Q_INVOKABLE int count() const { return rowCount(); }
3131};
3232
33−Q_DECLARE_METATYPE(MirSessionItemModel*)
33+Q_DECLARE_METATYPE(SessionModel*)
3434
35−#endif // MIRSESSIONITEMMODEL_H
35+#endif // SESSIONMODEL_H
tests/mocks/Unity/Application/plugin.cpp+4−4
@@ -18,7 +18,7 @@
1818#include "ApplicationInfo.h"
1919#include "ApplicationManager.h"
2020#include "ApplicationScreenshotProvider.h"
21−#include "MirSessionItem.h"
21+#include "Session.h"
2222#include "MirSurfaceItem.h"
2323#include "MirSurfaceItemModel.h"
2424#include "SurfaceManager.h"
@@ -59,14 +59,14 @@ static QObject* applicationTestInterface(QQmlEngine* engine, QJSEngine* scriptEn
5959
6060void FakeUnityApplicationQmlPlugin::registerTypes(const char *uri)
6161{
62− qRegisterMetaType<MirSessionItem*>("MirSessionItem*");
63− qRegisterMetaType<MirSurfaceItemModel*>("MirSessionItemModel*");
62+ qRegisterMetaType<Session*>("Session*");
63+ qRegisterMetaType<MirSurfaceItemModel*>("SessionModel*");
6464 qRegisterMetaType<MirSurfaceItem*>("MirSurfaceItem*");
6565 qRegisterMetaType<MirSurfaceItemModel*>("MirSurfaceItemModel*");
6666
6767 qmlRegisterUncreatableType<unity::shell::application::ApplicationManagerInterface>(uri, 0, 1, "ApplicationManagerInterface", "Abstract interface. Cannot be created in QML");
6868 qmlRegisterUncreatableType<unity::shell::application::ApplicationInfoInterface>(uri, 0, 1, "ApplicationInfoInterface", "Abstract interface. Cannot be created in QML");
69− qmlRegisterUncreatableType<MirSessionItem>(uri, 0, 1, "MirSessionItem", "MirSessionItem can't be instantiated from QML");
69+ qmlRegisterUncreatableType<Session>(uri, 0, 1, "Session", "Session can't be instantiated from QML");
7070 qmlRegisterUncreatableType<MirSurfaceItem>(uri, 0, 1, "MirSurfaceItem", "MirSurfaceItem can't be instantiated from QML");
7171
7272 qmlRegisterType<ApplicationInfo>(uri, 0, 1, "ApplicationInfo");