on xenial help sign in
renaming + updates
a5d616eNick Dedekind
qml/Stages/Animations/BaseSessionAnimation.qml+4−2
@@ -37,7 +37,9 @@ import QtQuick 2.0
37 */
37 */
38Item {
38Item {
39 id: base
39 id: base
40− property Item session: null
40+ property var sessionContainer
41+ property var surfaceContainer
42+
41
43
42 // changes applied when state changes to "in"
44 // changes applied when state changes to "in"
43 property list<QtObject> outChanges
45 property list<QtObject> outChanges
@@ -61,7 +63,7 @@ Item {
61 states: [
63 states: [
62 State {
64 State {
63 name: "baseAnimation"
65 name: "baseAnimation"
64− PropertyChanges { target: base.session; anchors.fill: undefined }
66+ PropertyChanges { target: surfaceContainer; anchors.fill: undefined }
65 },
67 },
66
68
67 State {
69 State {
qml/Stages/Animations/SwipeFromBottomAnimation.qml+8−8
@@ -19,20 +19,20 @@ import QtQuick 2.0
19BaseSessionAnimation {
19BaseSessionAnimation {
20 id: animation
20 id: animation
21
21
22− outChanges: [ AnchorChanges { target: animation.session; anchors.top: animation.parent.bottom } ]
22+ outChanges: [ AnchorChanges { target: surfaceContainer; anchors.top: sessionContainer.bottom } ]
23 outAnimations: [
23 outAnimations: [
24 SequentialAnimation {
24 SequentialAnimation {
25− PropertyAction { target: animation.parent; property: "clip"; value: true }
25+ PropertyAction { target: sessionContainer; property: "clip"; value: true }
26 AnchorAnimation { easing.type: Easing.InOutQuad; duration: 400 }
26 AnchorAnimation { easing.type: Easing.InOutQuad; duration: 400 }
27− PropertyAction { target: animation.session; property: "visible"; value: !animation.parent.removing }
27+ PropertyAction { target: surfaceContainer; property: "visible"; value: !sessionContainer.removing }
28− PropertyAction { target: animation.parent; property: "clip"; value: false }
28+ PropertyAction { target: sessionContainer; property: "clip"; value: false }
29− ScriptAction { script: { if (animation.parent.removing) animation.session.release(); } }
29+ ScriptAction { script: { if (sessionContainer.removing) sessionContainer.session.release(); } }
30 }
30 }
31 ]
31 ]
32
32
33 inChanges: [
33 inChanges: [
34 AnchorChanges {
34 AnchorChanges {
35− target: animation.session;
35+ target: surfaceContainer;
36 anchors.top: animation.parent.top
36 anchors.top: animation.parent.top
37 anchors.right: undefined
37 anchors.right: undefined
38 anchors.bottom: undefined
38 anchors.bottom: undefined
@@ -40,9 +40,9 @@ BaseSessionAnimation {
40 } ]
40 } ]
41 inAnimations: [
41 inAnimations: [
42 SequentialAnimation {
42 SequentialAnimation {
43− PropertyAction { target: animation.parent; property: "clip"; value: true }
43+ PropertyAction { target: sessionContainer; property: "clip"; value: true }
44 AnchorAnimation { easing.type: Easing.InOutQuad; duration: 400 }
44 AnchorAnimation { easing.type: Easing.InOutQuad; duration: 400 }
45− PropertyAction { target: animation.parent; property: "clip"; value: false }
45+ PropertyAction { target: sessionContainer; property: "clip"; value: false }
46 }
46 }
47 ]
47 ]
48}
48}
qml/Stages/SessionContainer.qml+7−7
@@ -20,7 +20,7 @@ import "Animations"
20Item {
20Item {
21 id: root
21 id: root
22 objectName: "sessionContainer"
22 objectName: "sessionContainer"
23− property Item session
23+ property QtObject session
24 property var childSessions: session ? session.childSessions : 0
24 property var childSessions: session ? session.childSessions : 0
25 property bool removing: false
25 property bool removing: false
26 property alias surface: _surfaceContainer.surface
26 property alias surface: _surfaceContainer.surface
@@ -32,15 +32,11 @@ Item {
32 session.z = 1;
32 session.z = 1;
33 }
33 }
34 }
34 }
35− Binding {
36− target: session
37− property: "anchors.fill"; value: root
38− }
39
35
40 readonly property alias surfaceContainer: _surfaceContainer
36 readonly property alias surfaceContainer: _surfaceContainer
41 SurfaceContainer {
37 SurfaceContainer {
42 id: _surfaceContainer
38 id: _surfaceContainer
43− anchors.fill: session
39+ anchors.fill: parent
44 z: 2
40 z: 2
45 surface: session ? session.surface : null
41 surface: session ? session.surface : null
46 }
42 }
@@ -92,7 +88,11 @@ Item {
92 }
88 }
93
89
94 function animateIn(animationComponent) {
90 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+ });
96 animation.start();
96 animation.start();
97
97
98 var tmp = d.animations;
98 var tmp = d.animations;
tests/mocks/Unity/Application/ApplicationInfo.cpp+2−2
@@ -15,7 +15,7 @@
15 */
15 */
16
16
17#include "ApplicationInfo.h"
17#include "ApplicationInfo.h"
18−#include "MirSessionItem.h"
18+#include "Session.h"
19#include "SessionManager.h"
19#include "SessionManager.h"
20
20
21#include <paths.h>
21#include <paths.h>
@@ -63,7 +63,7 @@ void ApplicationInfo::createSession()
63 setSession(SessionManager::singleton()->createSession(appId(), screenshotUrl));
63 setSession(SessionManager::singleton()->createSession(appId(), screenshotUrl));
64}
64}
65
65
66−void ApplicationInfo::setSession(MirSessionItem* session)
66+void ApplicationInfo::setSession(Session* session)
67{
67{
68 qDebug() << "Application::setSession - appId=" << appId() << "session=" << session;
68 qDebug() << "Application::setSession - appId=" << appId() << "session=" << session;
69 if (m_session == session)
69 if (m_session == session)
tests/mocks/Unity/Application/ApplicationInfo.h+5−5
@@ -34,7 +34,7 @@ class ApplicationInfo : public ApplicationInfoInterface {
34 Q_OBJECT
34 Q_OBJECT
35
35
36 Q_PROPERTY(bool fullscreen READ fullscreen WRITE setFullscreen NOTIFY fullscreenChanged)
36 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)
38
38
39 // Only exists in this fake implementation
39 // Only exists in this fake implementation
40
40
@@ -76,11 +76,11 @@ public:
76 void setManualSessionCreation(bool value);
76 void setManualSessionCreation(bool value);
77
77
78public:
78public:
79− void setSession(MirSessionItem* session);
79+ void setSession(Session* session);
80− MirSessionItem* session() const { return m_session; }
80+ Session* session() const { return m_session; }
81
81
82Q_SIGNALS:
82Q_SIGNALS:
83− void sessionChanged(MirSessionItem*);
83+ void sessionChanged(Session*);
84 void fullscreenChanged(bool value);
84 void fullscreenChanged(bool value);
85 void manualSessionCreationChanged(bool value);
85 void manualSessionCreationChanged(bool value);
86
86
@@ -101,7 +101,7 @@ private:
101 bool m_fullscreen;
101 bool m_fullscreen;
102
102
103 QQuickItem *m_parentItem;
103 QQuickItem *m_parentItem;
104− MirSessionItem* m_session;
104+ Session* m_session;
105
105
106 bool m_manualSessionCreation;
106 bool m_manualSessionCreation;
107};
107};
tests/mocks/Unity/Application/ApplicationManager.cpp+1−1
@@ -16,7 +16,7 @@
16
16
17#include "ApplicationManager.h"
17#include "ApplicationManager.h"
18#include "ApplicationInfo.h"
18#include "ApplicationInfo.h"
19−#include "MirSessionItem.h"
19+#include "Session.h"
20#include "ApplicationTestInterface.h"
20#include "ApplicationTestInterface.h"
21
21
22#include <paths.h>
22#include <paths.h>
tests/mocks/Unity/Application/ApplicationTestInterface.cpp+4−4
@@ -19,7 +19,7 @@
19#include "ApplicationManager.h"
19#include "ApplicationManager.h"
20#include "SessionManager.h"
20#include "SessionManager.h"
21#include "SurfaceManager.h"
21#include "SurfaceManager.h"
22−#include "MirSessionItem.h"
22+#include "Session.h"
23#include "MirSurfaceItem.h"
23#include "MirSurfaceItem.h"
24
24
25#include <paths.h>
25#include <paths.h>
@@ -44,7 +44,7 @@ quint32 ApplicationTestInterface::addChildSession(const QString& appId, quint32
44 return 0;
44 return 0;
45 }
45 }
46
46
47− MirSessionItem* parentSession = nullptr;
47+ Session* parentSession = nullptr;
48 if (m_childSessions.contains(existingSessionId)) {
48 if (m_childSessions.contains(existingSessionId)) {
49 parentSession = m_childSessions[existingSessionId];
49 parentSession = m_childSessions[existingSessionId];
50 } else if (application->session()) {
50 } else if (application->session()) {
@@ -59,7 +59,7 @@ quint32 ApplicationTestInterface::addChildSession(const QString& appId, quint32
59 .arg(surfaceImage);
59 .arg(surfaceImage);
60
60
61 quint32 sessionId = ++nextId;
61 quint32 sessionId = ++nextId;
62− MirSessionItem* session = SessionManager::singleton()->createSession(
62+ Session* session = SessionManager::singleton()->createSession(
63 QString("%1-Child%2").arg(parentSession->name())
63 QString("%1-Child%2").arg(parentSession->name())
64 .arg(sessionId),
64 .arg(sessionId),
65 screenshotUrl);
65 screenshotUrl);
@@ -78,7 +78,7 @@ void ApplicationTestInterface::removeSession(quint32 sessionId)
78 qDebug() << "ApplicationTestInterface::removeSession - No added session for " << sessionId;
78 qDebug() << "ApplicationTestInterface::removeSession - No added session for " << sessionId;
79 return;
79 return;
80 }
80 }
81− MirSessionItem* session = m_childSessions.take(sessionId);
81+ Session* session = m_childSessions.take(sessionId);
82 Q_EMIT session->removed();
82 Q_EMIT session->removed();
83}
83}
84
84
tests/mocks/Unity/Application/ApplicationTestInterface.h+2−2
@@ -20,7 +20,7 @@
20#include <QtDBus/QtDBus>
20#include <QtDBus/QtDBus>
21
21
22class ApplicationManager;
22class ApplicationManager;
23−class MirSessionItem;
23+class Session;
24class MirSurfaceItem;
24class MirSurfaceItem;
25
25
26class ApplicationTestInterface : public QDBusAbstractAdaptor
26class ApplicationTestInterface : public QDBusAbstractAdaptor
@@ -37,7 +37,7 @@ public Q_SLOTS:
37 Q_INVOKABLE void removeSurface(quint32 surfaceId);
37 Q_INVOKABLE void removeSurface(quint32 surfaceId);
38
38
39private:
39private:
40− QHash<quint32, MirSessionItem*> m_childSessions;
40+ QHash<quint32, Session*> m_childSessions;
41 QHash<quint32, MirSurfaceItem*> m_childSurfaces;
41 QHash<quint32, MirSurfaceItem*> m_childSurfaces;
42};
42};
43
43
tests/mocks/Unity/Application/CMakeLists.txt+3−3
@@ -6,13 +6,13 @@ set(FakeUnityApplicationQml_SOURCES
6 ApplicationManager.cpp
6 ApplicationManager.cpp
7 ApplicationScreenshotProvider.cpp
7 ApplicationScreenshotProvider.cpp
8 ApplicationTestInterface.cpp
8 ApplicationTestInterface.cpp
9− MirSessionItem.cpp
9+ Session.cpp
10 MirSurfaceItem.cpp
10 MirSurfaceItem.cpp
11 SessionManager.cpp
11 SessionManager.cpp
12 SurfaceManager.cpp
12 SurfaceManager.cpp
13− MirItemModel.h
13+ MirObjectModel.h
14 MirSurfaceItemModel.h
14 MirSurfaceItemModel.h
15− MirSessionItemModel.h
15+ SessionModel.h
16 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationInfoInterface.h
16 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationInfoInterface.h
17 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationManagerInterface.h
17 ${APPLICATION_API_INCLUDEDIR}/unity/shell/application/ApplicationManagerInterface.h
18)
18)
tests/mocks/Unity/Application/MirItemModel.h → tests/mocks/Unity/Application/MirObjectModel.hrenamed+5−5
@@ -14,8 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−#ifndef MIRITEMMODEL_H
17+#ifndef MIROBJECTMODEL_H
18−#define MIRITEMMODEL_H
18+#define MIROBJECTMODEL_H
19
19
20// Qt
20// Qt
21#include <QAbstractListModel>
21#include <QAbstractListModel>
@@ -23,10 +23,10 @@
23class MirSurfaceItem;
23class MirSurfaceItem;
24
24
25template<class TYPE>
25template<class TYPE>
26−class MirItemModel : public QAbstractListModel
26+class MirObjectModel : public QAbstractListModel
27{
27{
28public:
28public:
29− MirItemModel(QObject *parent = 0)
29+ MirObjectModel(QObject *parent = 0)
30 : QAbstractListModel(parent)
30 : QAbstractListModel(parent)
31 {}
31 {}
32
32
@@ -105,4 +105,4 @@ protected:
105 QList<TYPE*> m_items;
105 QList<TYPE*> m_items;
106};
106};
107
107
108−#endif // MIRITEMMODEL_H
108+#endif // MIROBJECTMODEL_H
tests/mocks/Unity/Application/MirSurfaceItem.cpp+2−2
@@ -15,7 +15,7 @@
15 */
15 */
16
16
17#include "MirSurfaceItem.h"
17#include "MirSurfaceItem.h"
18−#include "MirSessionItem.h"
18+#include "Session.h"
19
19
20#include <paths.h>
20#include <paths.h>
21
21
@@ -122,7 +122,7 @@ void MirSurfaceItem::release()
122 }
122 }
123}
123}
124
124
125−void MirSurfaceItem::setSession(MirSessionItem* session)
125+void MirSurfaceItem::setSession(Session* session)
126{
126{
127 m_session = session;
127 m_session = session;
128}
128}
tests/mocks/Unity/Application/MirSurfaceItem.h+4−4
@@ -22,7 +22,7 @@
22#include <QQuickItem>
22#include <QQuickItem>
23#include <QUrl>
23#include <QUrl>
24
24
25−class MirSessionItem;
25+class Session;
26
26
27class MirSurfaceItem : public QQuickItem
27class MirSurfaceItem : public QQuickItem
28{
28{
@@ -60,13 +60,13 @@ public:
60 ~MirSurfaceItem();
60 ~MirSurfaceItem();
61
61
62 //getters
62 //getters
63− MirSessionItem* session() const { return m_session; }
63+ Session* session() const { return m_session; }
64 Type type() const { return m_type; }
64 Type type() const { return m_type; }
65 State state() const { return m_state; }
65 State state() const { return m_state; }
66 QString name() const { return m_name; }
66 QString name() const { return m_name; }
67 MirSurfaceItem* parentSurface() const { return m_parentSurface; }
67 MirSurfaceItem* parentSurface() const { return m_parentSurface; }
68
68
69− void setSession(MirSessionItem* item);
69+ void setSession(Session* item);
70 void setScreenshot(const QUrl& screenshot);
70 void setScreenshot(const QUrl& screenshot);
71
71
72 Q_INVOKABLE void setState(State newState);
72 Q_INVOKABLE void setState(State newState);
@@ -107,7 +107,7 @@ private:
107 void createQmlContentItem();
107 void createQmlContentItem();
108 void printComponentErrors();
108 void printComponentErrors();
109
109
110− MirSessionItem* m_session;
110+ Session* m_session;
111 const QString m_name;
111 const QString m_name;
112 const Type m_type;
112 const Type m_type;
113 State m_state;
113 State m_state;
tests/mocks/Unity/Application/MirSurfaceItemModel.h+3−3
@@ -18,14 +18,14 @@
18#define MIRSURFACEITEMMODEL_H
18#define MIRSURFACEITEMMODEL_H
19
19
20// Llocal
20// Llocal
21−#include "MirItemModel.h"
21+#include "MirObjectModel.h"
22
22
23class MirSurfaceItem;
23class MirSurfaceItem;
24−class MirSurfaceItemModel: public MirItemModel<MirSurfaceItem>
24+class MirSurfaceItemModel: public MirObjectModel<MirSurfaceItem>
25{
25{
26 Q_OBJECT
26 Q_OBJECT
27public:
27public:
28− MirSurfaceItemModel(QObject *parent = 0): MirItemModel(parent) {}
28+ MirSurfaceItemModel(QObject *parent = 0): MirObjectModel(parent) {}
29
29
30 Q_INVOKABLE int count() const { return rowCount(); }
30 Q_INVOKABLE int count() const { return rowCount(); }
31};
31};
tests/mocks/Unity/Application/MirSessionItem.cpp → tests/mocks/Unity/Application/Session.cpprenamed+26−26
@@ -14,7 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−#include "MirSessionItem.h"
17+#include "Session.h"
18#include "ApplicationInfo.h"
18#include "ApplicationInfo.h"
19#include "SurfaceManager.h"
19#include "SurfaceManager.h"
20
20
@@ -22,29 +22,29 @@
22#include <QQmlEngine>
22#include <QQmlEngine>
23#include <QTimer>
23#include <QTimer>
24
24
25−MirSessionItem::MirSessionItem(const QString &name,
25+Session::Session(const QString &name,
26− const QUrl& screenshot,
26+ const QUrl& screenshot,
27− QQuickItem *parent)
27+ QObject *parent)
28− : QQuickItem(parent)
28+ : QObject(parent)
29 , m_name(name)
29 , m_name(name)
30 , m_screenshot(screenshot)
30 , m_screenshot(screenshot)
31 , m_application(nullptr)
31 , m_application(nullptr)
32 , m_surface(nullptr)
32 , m_surface(nullptr)
33 , m_parentSession(nullptr)
33 , m_parentSession(nullptr)
34− , m_children(new MirSessionItemModel(this))
34+ , m_children(new SessionModel(this))
35 , m_manualSurfaceCreation(false)
35 , m_manualSurfaceCreation(false)
36{
36{
37− qDebug() << "MirSessionItem::MirSessionItem() " << this->name();
37+ qDebug() << "Session::Session() " << this->name();
38
38
39 QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
39 QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
40}
40}
41
41
42−MirSessionItem::~MirSessionItem()
42+Session::~Session()
43{
43{
44− qDebug() << "MirSessionItem::~MirSessionItem() " << name();
44+ qDebug() << "Session::~Session() " << name();
45
45
46− QList<MirSessionItem*> children(m_children->list());
46+ QList<Session*> children(m_children->list());
47− for (MirSessionItem* child : children) {
47+ for (Session* child : children) {
48 delete child;
48 delete child;
49 }
49 }
50 if (m_parentSession) {
50 if (m_parentSession) {
@@ -57,9 +57,9 @@ MirSessionItem::~MirSessionItem()
57 delete m_children;
57 delete m_children;
58}
58}
59
59
60−void MirSessionItem::release()
60+void Session::release()
61{
61{
62− qDebug() << "MirSessionItem::release " << name();
62+ qDebug() << "Session::release " << name();
63 Q_EMIT aboutToBeDestroyed();
63 Q_EMIT aboutToBeDestroyed();
64
64
65 if (m_parentSession) {
65 if (m_parentSession) {
@@ -73,7 +73,7 @@ void MirSessionItem::release()
73 }
73 }
74}
74}
75
75
76−void MirSessionItem::setApplication(ApplicationInfo* application)
76+void Session::setApplication(ApplicationInfo* application)
77{
77{
78 if (m_application == application)
78 if (m_application == application)
79 return;
79 return;
@@ -96,9 +96,9 @@ void MirSessionItem::setApplication(ApplicationInfo* application)
96 }
96 }
97}
97}
98
98
99−void MirSessionItem::setSurface(MirSurfaceItem* surface)
99+void Session::setSurface(MirSurfaceItem* surface)
100{
100{
101− qDebug() << "MirSessionItem::setSurface - session=" << name() << "surface=" << surface;
101+ qDebug() << "Session::setSurface - session=" << name() << "surface=" << surface;
102 if (m_surface == surface)
102 if (m_surface == surface)
103 return;
103 return;
104
104
@@ -117,7 +117,7 @@ void MirSessionItem::setSurface(MirSurfaceItem* surface)
117 Q_EMIT surfaceChanged(m_surface);
117 Q_EMIT surfaceChanged(m_surface);
118}
118}
119
119
120−void MirSessionItem::setScreenshot(const QUrl& screenshot)
120+void Session::setScreenshot(const QUrl& screenshot)
121{
121{
122 if (screenshot != m_screenshot) {
122 if (screenshot != m_screenshot) {
123 m_screenshot = screenshot;
123 m_screenshot = screenshot;
@@ -127,7 +127,7 @@ void MirSessionItem::setScreenshot(const QUrl& screenshot)
127 }
127 }
128}
128}
129
129
130−void MirSessionItem::setParentSession(MirSessionItem* session)
130+void Session::setParentSession(Session* session)
131{
131{
132 if (m_parentSession == session || session == this)
132 if (m_parentSession == session || session == this)
133 return;
133 return;
@@ -136,7 +136,7 @@ void MirSessionItem::setParentSession(MirSessionItem* session)
136 Q_EMIT parentSessionChanged(session);
136 Q_EMIT parentSessionChanged(session);
137}
137}
138
138
139−void MirSessionItem::createSurface()
139+void Session::createSurface()
140{
140{
141 if (m_surface) return;
141 if (m_surface) return;
142
142
@@ -146,22 +146,22 @@ void MirSessionItem::createSurface()
146 m_screenshot));
146 m_screenshot));
147}
147}
148
148
149−void MirSessionItem::addChildSession(MirSessionItem* session)
149+void Session::addChildSession(Session* session)
150{
150{
151 insertChildSession(m_children->rowCount(), session);
151 insertChildSession(m_children->rowCount(), session);
152}
152}
153
153
154−void MirSessionItem::insertChildSession(uint index, MirSessionItem* session)
154+void Session::insertChildSession(uint index, Session* session)
155{
155{
156− qDebug() << "MirSessionItem::insertChildSession - " << session->name() << " to " << name() << " @ " << index;
156+ qDebug() << "Session::insertChildSession - " << session->name() << " to " << name() << " @ " << index;
157
157
158 session->setParentSession(this);
158 session->setParentSession(this);
159 m_children->insert(index, session);
159 m_children->insert(index, session);
160}
160}
161
161
162−void MirSessionItem::removeChildSession(MirSessionItem* session)
162+void Session::removeChildSession(Session* session)
163{
163{
164− qDebug() << "MirSessionItem::removeChildSession - " << session->name() << " from " << name();
164+ qDebug() << "Session::removeChildSession - " << session->name() << " from " << name();
165
165
166 if (m_children->contains(session)) {
166 if (m_children->contains(session)) {
167 m_children->remove(session);
167 m_children->remove(session);
@@ -169,12 +169,12 @@ void MirSessionItem::removeChildSession(MirSessionItem* session)
169 }
169 }
170}
170}
171
171
172−MirSessionItemModel* MirSessionItem::childSessions() const
172+SessionModel* Session::childSessions() const
173{
173{
174 return m_children;
174 return m_children;
175}
175}
176
176
177−void MirSessionItem::setManualSurfaceCreation(bool value)
177+void Session::setManualSurfaceCreation(bool value)
178{
178{
179 if (value != m_manualSurfaceCreation) {
179 if (value != m_manualSurfaceCreation) {
180 m_manualSurfaceCreation = value;
180 m_manualSurfaceCreation = value;
tests/mocks/Unity/Application/MirSessionItem.h → tests/mocks/Unity/Application/Session.hrenamed+21−21
@@ -14,22 +14,22 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−#ifndef MIRSESSIONITEM_H
17+#ifndef SESSION_H
18−#define MIRSESSIONITEM_H
18+#define SESSION_H
19
19
20−#include "MirSessionItemModel.h"
20+#include "SessionModel.h"
21
21
22#include <QQuickItem>
22#include <QQuickItem>
23
23
24class ApplicationInfo;
24class ApplicationInfo;
25
25
26−class MirSessionItem : public QQuickItem
26+class Session : public QObject
27{
27{
28 Q_OBJECT
28 Q_OBJECT
29 Q_PROPERTY(QString name READ name CONSTANT)
29 Q_PROPERTY(QString name READ name CONSTANT)
30 Q_PROPERTY(MirSurfaceItem* surface READ surface NOTIFY surfaceChanged)
30 Q_PROPERTY(MirSurfaceItem* surface READ surface NOTIFY surfaceChanged)
31− Q_PROPERTY(MirSessionItem* parentSession READ parentSession NOTIFY parentSessionChanged DESIGNABLE false)
31+ Q_PROPERTY(Session* parentSession READ parentSession NOTIFY parentSessionChanged DESIGNABLE false)
32− Q_PROPERTY(MirSessionItemModel* childSessions READ childSessions DESIGNABLE false CONSTANT)
32+ Q_PROPERTY(SessionModel* childSessions READ childSessions DESIGNABLE false CONSTANT)
33
33
34 // Only exists in this fake implementation
34 // Only exists in this fake implementation
35
35
@@ -37,10 +37,10 @@ class MirSessionItem : public QQuickItem
37 Q_PROPERTY(bool manualSurfaceCreation READ manualSurfaceCreation WRITE setManualSurfaceCreation NOTIFY manualSurfaceCreationChanged)
37 Q_PROPERTY(bool manualSurfaceCreation READ manualSurfaceCreation WRITE setManualSurfaceCreation NOTIFY manualSurfaceCreationChanged)
38
38
39public:
39public:
40− explicit MirSessionItem(const QString &name,
40+ explicit Session(const QString &name,
41− const QUrl& screenshot,
41+ const QUrl& screenshot,
42− QQuickItem *parent = 0);
42+ QObject *parent = 0);
43− ~MirSessionItem();
43+ ~Session();
44
44
45 Q_INVOKABLE void release();
45 Q_INVOKABLE void release();
46
46
@@ -48,22 +48,22 @@ public:
48 QString name() const { return m_name; }
48 QString name() const { return m_name; }
49 ApplicationInfo* application() const { return m_application; }
49 ApplicationInfo* application() const { return m_application; }
50 MirSurfaceItem* surface() const { return m_surface; }
50 MirSurfaceItem* surface() const { return m_surface; }
51− MirSessionItem* parentSession() const { return m_parentSession; }
51+ Session* parentSession() const { return m_parentSession; }
52
52
53 void setApplication(ApplicationInfo* item);
53 void setApplication(ApplicationInfo* item);
54 void setSurface(MirSurfaceItem* surface);
54 void setSurface(MirSurfaceItem* surface);
55 void setScreenshot(const QUrl& m_screenshot);
55 void setScreenshot(const QUrl& m_screenshot);
56
56
57− Q_INVOKABLE void addChildSession(MirSessionItem* session);
57+ Q_INVOKABLE void addChildSession(Session* session);
58− void insertChildSession(uint index, MirSessionItem* session);
58+ void insertChildSession(uint index, Session* session);
59− void removeChildSession(MirSessionItem* session);
59+ void removeChildSession(Session* session);
60
60
61 bool manualSurfaceCreation() const { return m_manualSurfaceCreation; }
61 bool manualSurfaceCreation() const { return m_manualSurfaceCreation; }
62 void setManualSurfaceCreation(bool value);
62 void setManualSurfaceCreation(bool value);
63
63
64Q_SIGNALS:
64Q_SIGNALS:
65 void surfaceChanged(MirSurfaceItem*);
65 void surfaceChanged(MirSurfaceItem*);
66− void parentSessionChanged(MirSessionItem*);
66+ void parentSessionChanged(Session*);
67 void removed();
67 void removed();
68 void aboutToBeDestroyed();
68 void aboutToBeDestroyed();
69 void manualSurfaceCreationChanged(bool value);
69 void manualSurfaceCreationChanged(bool value);
@@ -72,19 +72,19 @@ public Q_SLOTS:
72 Q_INVOKABLE void createSurface();
72 Q_INVOKABLE void createSurface();
73
73
74private:
74private:
75− MirSessionItemModel* childSessions() const;
75+ SessionModel* childSessions() const;
76− void setParentSession(MirSessionItem* session);
76+ void setParentSession(Session* session);
77
77
78 QString m_name;
78 QString m_name;
79 QUrl m_screenshot;
79 QUrl m_screenshot;
80 ApplicationInfo* m_application;
80 ApplicationInfo* m_application;
81 MirSurfaceItem* m_surface;
81 MirSurfaceItem* m_surface;
82− MirSessionItem* m_parentSession;
82+ Session* m_parentSession;
83− MirSessionItemModel* m_children;
83+ SessionModel* m_children;
84
84
85 bool m_manualSurfaceCreation;
85 bool m_manualSurfaceCreation;
86};
86};
87
87
88−Q_DECLARE_METATYPE(MirSessionItem*)
88+Q_DECLARE_METATYPE(Session*)
89
89
90−#endif // MIRSESSIONITEM_H
90+#endif // SESSION_H
tests/mocks/Unity/Application/SessionManager.cpp+6−6
@@ -16,7 +16,7 @@
16
16
17#include "SessionManager.h"
17#include "SessionManager.h"
18
18
19−#include "MirSurfaceItem.h"
19+#include "Session.h"
20
20
21SessionManager *SessionManager::the_session_manager = nullptr;
21SessionManager *SessionManager::the_session_manager = nullptr;
22
22
@@ -34,12 +34,12 @@ SessionManager::SessionManager(QObject *parent) :
34}
34}
35
35
36
36
37−MirSessionItem *SessionManager::createSession(const QString& name,
37+Session *SessionManager::createSession(const QString& name,
38− const QUrl& screenshot)
38+ const QUrl& screenshot)
39{
39{
40− MirSessionItem* session = new MirSessionItem(name, screenshot);
40+ Session* session = new Session(name, screenshot);
41− connect(session, &MirSessionItem::aboutToBeDestroyed, this, [&] {
41+ connect(session, &Session::aboutToBeDestroyed, this, [&] {
42− Q_EMIT sessionStopping(qobject_cast<MirSessionItem*>(sender()));
42+ Q_EMIT sessionStopping(qobject_cast<Session*>(sender()));
43 });
43 });
44
44
45 Q_EMIT sessionStarting(session);
45 Q_EMIT sessionStarting(session);
tests/mocks/Unity/Application/SessionManager.h+7−7
@@ -14,12 +14,12 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−#ifndef SESSIONMANAGER_
17+#ifndef SESSIONMANAGER_H
18−#define SESSIONMANAGER_
18+#define SESSIONMANAGER_H
19
19
20#include <QObject>
20#include <QObject>
21
21
22−#include "MirSessionItem.h"
22+class Session;
23
23
24class SessionManager : public QObject
24class SessionManager : public QObject
25{
25{
@@ -29,14 +29,14 @@ public:
29
29
30 static SessionManager *singleton();
30 static SessionManager *singleton();
31
31
32− Q_INVOKABLE MirSessionItem* createSession(const QString& name, const QUrl& screenshot);
32+ Q_INVOKABLE Session* createSession(const QString& name, const QUrl& screenshot);
33
33
34Q_SIGNALS:
34Q_SIGNALS:
35− void sessionStarting(MirSessionItem *session);
35+ void sessionStarting(Session *session);
36− void sessionStopping(MirSessionItem *session);
36+ void sessionStopping(Session *session);
37
37
38private:
38private:
39 static SessionManager *the_session_manager;
39 static SessionManager *the_session_manager;
40};
40};
41
41
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 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−#ifndef MIRSESSIONITEMMODEL_H
17+#ifndef SESSIONMODEL_H
18−#define MIRSESSIONITEMMODEL_H
18+#define SESSIONMODEL_H
19
19
20// Local
20// Local
21−#include "MirItemModel.h"
21+#include "MirObjectModel.h"
22
22
23−class MirSessionItem;
23+class Session;
24−class MirSessionItemModel: public MirItemModel<MirSessionItem>
24+class SessionModel: public MirObjectModel<Session>
25{
25{
26 Q_OBJECT
26 Q_OBJECT
27public:
27public:
28− MirSessionItemModel(QObject *parent = 0): MirItemModel(parent) {}
28+ SessionModel(QObject *parent = 0): MirObjectModel(parent) {}
29
29
30 Q_INVOKABLE int count() const { return rowCount(); }
30 Q_INVOKABLE int count() const { return rowCount(); }
31};
31};
32
32
33−Q_DECLARE_METATYPE(MirSessionItemModel*)
33+Q_DECLARE_METATYPE(SessionModel*)
34
34
35−#endif // MIRSESSIONITEMMODEL_H
35+#endif // SESSIONMODEL_H
tests/mocks/Unity/Application/plugin.cpp+4−4
@@ -18,7 +18,7 @@
18#include "ApplicationInfo.h"
18#include "ApplicationInfo.h"
19#include "ApplicationManager.h"
19#include "ApplicationManager.h"
20#include "ApplicationScreenshotProvider.h"
20#include "ApplicationScreenshotProvider.h"
21−#include "MirSessionItem.h"
21+#include "Session.h"
22#include "MirSurfaceItem.h"
22#include "MirSurfaceItem.h"
23#include "MirSurfaceItemModel.h"
23#include "MirSurfaceItemModel.h"
24#include "SurfaceManager.h"
24#include "SurfaceManager.h"
@@ -59,14 +59,14 @@ static QObject* applicationTestInterface(QQmlEngine* engine, QJSEngine* scriptEn
59
59
60void FakeUnityApplicationQmlPlugin::registerTypes(const char *uri)
60void FakeUnityApplicationQmlPlugin::registerTypes(const char *uri)
61{
61{
62− qRegisterMetaType<MirSessionItem*>("MirSessionItem*");
62+ qRegisterMetaType<Session*>("Session*");
63− qRegisterMetaType<MirSurfaceItemModel*>("MirSessionItemModel*");
63+ qRegisterMetaType<MirSurfaceItemModel*>("SessionModel*");
64 qRegisterMetaType<MirSurfaceItem*>("MirSurfaceItem*");
64 qRegisterMetaType<MirSurfaceItem*>("MirSurfaceItem*");
65 qRegisterMetaType<MirSurfaceItemModel*>("MirSurfaceItemModel*");
65 qRegisterMetaType<MirSurfaceItemModel*>("MirSurfaceItemModel*");
66
66
67 qmlRegisterUncreatableType<unity::shell::application::ApplicationManagerInterface>(uri, 0, 1, "ApplicationManagerInterface", "Abstract interface. Cannot be created in QML");
67 qmlRegisterUncreatableType<unity::shell::application::ApplicationManagerInterface>(uri, 0, 1, "ApplicationManagerInterface", "Abstract interface. Cannot be created in QML");
68 qmlRegisterUncreatableType<unity::shell::application::ApplicationInfoInterface>(uri, 0, 1, "ApplicationInfoInterface", "Abstract interface. Cannot be created in QML");
68 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");
70 qmlRegisterUncreatableType<MirSurfaceItem>(uri, 0, 1, "MirSurfaceItem", "MirSurfaceItem can't be instantiated from QML");
70 qmlRegisterUncreatableType<MirSurfaceItem>(uri, 0, 1, "MirSurfaceItem", "MirSurfaceItem can't be instantiated from QML");
71
71
72 qmlRegisterType<ApplicationInfo>(uri, 0, 1, "ApplicationInfo");
72 qmlRegisterType<ApplicationInfo>(uri, 0, 1, "ApplicationInfo");