on xenial help sign in
merge prereq
7283c79Michael Zanetti
plugins/Unity/CMakeLists.txt−1
@@ -1,6 +1,5 @@
1add_subdirectory(ApplicationMenu)
1add_subdirectory(ApplicationMenu)
2add_subdirectory(Connectivity)
2add_subdirectory(Connectivity)
3−add_subdirectory(Debug)
4add_subdirectory(Indicators)
3add_subdirectory(Indicators)
5add_subdirectory(Launcher)
4add_subdirectory(Launcher)
6add_subdirectory(Session)
5add_subdirectory(Session)
plugins/Unity/Debug/CMakeLists.txtdeleted−30
@@ -1,30 +0,0 @@
1−include_directories(
2− ${CMAKE_CURRENT_SOURCE_DIR}
3− ${CMAKE_CURRENT_BINARY_DIR}
4−)
5−
6−include_directories(
7− SYSTEM
8− ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
9− ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
10− ${GIO_INCLUDE_DIRS}
11−)
12−
13−set(QMLPLUGIN_SRC
14− consolelog.cpp
15− plugin.cpp
16− )
17−
18−add_library(Debug-qml SHARED
19− ${QMLPLUGIN_SRC}
20− )
21−
22−# Because this is an internal support library, we want
23−# to expose all symbols in it. Consider changing this
24−# either to a static library or just using the
25−# files directly in targets.
26−set_target_properties(Debug-qml PROPERTIES COMPILE_FLAGS -fvisibility=default)
27−
28−qt5_use_modules(Debug-qml Qml Quick Concurrent)
29−
30−add_unity8_plugin(Unity.Debug 0.1 Unity/Debug TARGETS Debug-qml)
plugins/Unity/Debug/consolelog.cppdeleted−221
@@ -1,221 +0,0 @@
1−/*
2− * Copyright 2016 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
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 Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15−*/
16−
17−#include "consolelog.h"
18−
19−#include <unistd.h>
20−#include <stdio.h>
21−#include <thread>
22−#include <iostream>
23−#include <sys/ioctl.h>
24−
25−#include <functional>
26−
27−namespace
28−{
29−
30−int wait_fd(std::function<int(void)> fn)
31−{
32− int ret = -1;
33− bool fd_blocked = false;
34− do
35− {
36− ret = fn();
37− fd_blocked = (errno == EINTR || errno == EBUSY);
38− if (fd_blocked)
39− QThread::msleep(10);
40− }
41− while (ret < 0);
42− return ret;
43−}
44−
45−#define PIPE_WAIT(val) wait_fd(std::bind(pipe, val))
46−#define DUP_WAIT(fd) wait_fd(std::bind(dup, fd))
47−#define DUP2_WAIT(fd1, fd2) wait_fd(std::bind(dup2, fd1, fd2))
48−#define CLOSE_WAIT(fd) wait_fd(std::bind(close, fd))
49−
50−}
51−
52−LogRedirector::LogRedirector()
53− : m_ref(0)
54− , m_stop(false)
55−{
56− setObjectName("ConsoleLog");
57−
58− // make stdout & stderr streams unbuffered
59− // so that we don't need to flush the streams
60− // before capture and after capture
61− // (fflush can cause a deadlock if the stream is currently being used)
62− setvbuf(stdout,NULL,_IONBF,0);
63− setvbuf(stderr,NULL,_IONBF,0);
64−}
65−
66−void LogRedirector::run()
67−{
68− PIPE_WAIT(m_pipe);
69−
70− int oldStdOut = DUP_WAIT(fileno(stdout));
71− int oldStdErr = DUP_WAIT(fileno(stderr));
72−
73− DUP2_WAIT(m_pipe[WRITE], fileno(stdout));
74− DUP2_WAIT(m_pipe[WRITE], fileno(stderr));
75− CLOSE_WAIT(m_pipe[WRITE]);
76−
77− while(true) {
78− {
79− QMutexLocker lock(&m_mutex);
80− if (m_stop) break;
81− }
82− checkLog();
83− QThread::msleep(50);
84− }
85−
86− DUP2_WAIT(oldStdOut, fileno(stdout));
87− DUP2_WAIT(oldStdErr, fileno(stderr));
88−
89− CLOSE_WAIT(oldStdOut);
90− CLOSE_WAIT(oldStdErr);
91− CLOSE_WAIT(m_pipe[READ]);
92−}
93−
94−
95−void LogRedirector::checkLog()
96−{
97− // Do not allow read to block with no data.
98− // If we stop the thread while waiting a read,
99− // it will block the main thread waiting for this thread to stop.
100− int count = 0;
101− ioctl(m_pipe[READ], FIONREAD, &count);
102− if (count <= 0) return;
103−
104− std::string captured;
105− std::string buf;
106− const int bufSize = 1024;
107− buf.resize(bufSize);
108− int bytesRead = 0;
109− bytesRead = read(m_pipe[READ], &(*buf.begin()), bufSize);
110− while(bytesRead == bufSize)
111− {
112− captured += buf;
113− bytesRead = 0;
114− bytesRead = read(m_pipe[READ], &(*buf.begin()), bufSize);
115− }
116− if (bytesRead > 0)
117− {
118− buf.resize(bytesRead);
119− captured += buf;
120− }
121−
122− if (!captured.empty()) {
123− Q_EMIT log(QString::fromStdString(captured));
124− }
125−}
126−
127−LogRedirector *LogRedirector::instance()
128−{
129− static LogRedirector* log = nullptr;
130− if (!log) {
131− log = new LogRedirector();
132− }
133− return log;
134−}
135−
136−void LogRedirector::add(ConsoleLog* logger)
137−{
138− QMutexLocker lock(&m_mutex);
139− connect(this, &LogRedirector::log, logger, &ConsoleLog::logged, Qt::UniqueConnection);
140−
141− m_ref++;
142− if (!LogRedirector::instance()->isRunning()) {
143− m_stop = false;
144− LogRedirector::instance()->start();
145− }
146−}
147−
148−void LogRedirector::remove(ConsoleLog* logger)
149−{
150− QMutexLocker lock(&m_mutex);
151− disconnect(this, &LogRedirector::log, logger, &ConsoleLog::logged);
152−
153− m_ref = qMax(m_ref-1, 0);
154− if (m_ref == 0 && LogRedirector::instance()->isRunning()) {
155− m_stop = true;
156− lock.unlock();
157− LogRedirector::instance()->wait();
158− }
159−}
160−
161−ConsoleLog::ConsoleLog(QObject *parent)
162− : QObject(parent)
163− , m_enabled(false)
164− , m_maxLines(60)
165−{
166− auto updateEnabled = [this]() {
167− if (m_enabled) {
168− LogRedirector::instance()->add(this);
169− } else {
170− LogRedirector::instance()->remove(this);
171− }
172− };
173− connect(this, &ConsoleLog::enabledChanged, this, updateEnabled);
174−}
175−
176−ConsoleLog::~ConsoleLog()
177−{
178− if (m_enabled) {
179− LogRedirector::instance()->remove(this);
180− }
181−}
182−
183−void ConsoleLog::setEnabled(bool enabled)
184−{
185− if (m_enabled == enabled) {
186− return;
187− }
188−
189− m_enabled = enabled;
190− Q_EMIT enabledChanged();
191−}
192−
193−QString ConsoleLog::out() const
194−{
195− return m_out.join("\n");
196−}
197−
198−void ConsoleLog::setMaxLines(int maxLines)
199−{
200− if (m_maxLines == maxLines) {
201− return;
202− }
203−
204− m_maxLines = maxLines;
205− while (m_out.count() > m_maxLines) {
206− m_out.removeLast();
207− }
208− Q_EMIT outChanged();
209− Q_EMIT maxLinesChanged();
210−}
211−
212−void ConsoleLog::logged(QString captured)
213−{
214− QStringList li = captured.split("\n", QString::SkipEmptyParts);
215− li << m_out;
216− m_out = li;
217− while (m_out.count() > m_maxLines) {
218− m_out.removeLast();
219− }
220− Q_EMIT outChanged();
221−}
plugins/Unity/Debug/consolelog.hdeleted−87
@@ -1,87 +0,0 @@
1−/*
2− * Copyright 2016 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
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 Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15−*/
16−
17−#ifndef CONSOLELOG_H
18−#define CONSOLELOG_H
19−
20−#include <QThread>
21−#include <QMutex>
22−#include <QSet>
23−
24−class ConsoleLog;
25−
26−class LogRedirector : public QThread
27−{
28− Q_OBJECT
29−public:
30− static LogRedirector *instance();
31−
32− void add(ConsoleLog* logger);
33− void remove(ConsoleLog* logger);
34−
35−private Q_SLOTS:
36− void checkLog();
37−
38−Q_SIGNALS:
39− void log(QString log);
40−
41−private:
42− LogRedirector();
43− void run() Q_DECL_OVERRIDE;
44−
45− QMutex m_mutex;
46− int m_pipe[2];
47− int m_ref;
48− bool m_stop;
49−
50− enum PIPES { READ, WRITE };
51−};
52−
53−class ConsoleLog : public QObject
54−{
55− Q_OBJECT
56− Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
57− Q_PROPERTY(QString out READ out NOTIFY outChanged)
58− Q_PROPERTY(int maxLines READ maxLines WRITE setMaxLines NOTIFY maxLinesChanged)
59−public:
60− explicit ConsoleLog(QObject *parent = 0);
61− ~ConsoleLog();
62−
63− bool isEnabled() const { return m_enabled; }
64− void setEnabled(bool enabled);
65−
66− QString out() const;
67−
68− int maxLines() const { return m_maxLines; }
69− void setMaxLines(int maxLines);
70−
71−public Q_SLOTS:
72− void logged(QString captured);
73−
74−Q_SIGNALS:
75− void enabledChanged();
76− void outChanged();
77− void maxLinesChanged();
78−
79−private:
80− void updateEnabled();
81−
82− QStringList m_out;
83− bool m_enabled;
84− int m_maxLines;
85−};
86−
87−#endif // CONSOLELOG_H
plugins/Unity/Debug/plugin.cppdeleted−31
@@ -1,31 +0,0 @@
1−/*
2− * Copyright (C) 2016 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
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−
17−// Qt
18−#include <QtQml/qqml.h>
19−
20−// self
21−#include "plugin.h"
22−
23−// local
24−#include "consolelog.h"
25−
26−void UnityDebugPlugin::registerTypes(const char *uri)
27−{
28− Q_ASSERT(uri == QLatin1String("Unity.Debug"));
29−
30− qmlRegisterType<ConsoleLog>(uri, 0, 1, "ConsoleLog");
31−}
plugins/Unity/Debug/plugin.hdeleted−32
@@ -1,32 +0,0 @@
1−/*
2− * Copyright (C) 2016 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
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−
17−#ifndef UNITYDEBUG_PLUGIN_H
18−#define UNITYDEBUG_PLUGIN_H
19−
20−#include <QtQml/QQmlEngine>
21−#include <QtQml/QQmlExtensionPlugin>
22−
23−class UnityDebugPlugin : public QQmlExtensionPlugin
24−{
25− Q_OBJECT
26− Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
27−
28−public:
29− void registerTypes(const char *uri) override;
30−};
31−
32−#endif
plugins/Unity/Debug/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module Unity.Debug
2−plugin Debug-qml
3−typeinfo Debug.qmltypes
plugins/WindowManager/Screen.cpp+8−7
@@ -185,11 +185,6 @@ QString Screen::outputTypeName() const
185 return QString();
185 return QString();
186}
186}
187
187
188−void Screen::setSyncing(bool syncing)
189−{
190− workspaces()->setSyncing(syncing);
191−}
192−
193void Screen::sync(Screen *proxy)
188void Screen::sync(Screen *proxy)
194{
189{
195 if (!proxy) return;
190 if (!proxy) return;
@@ -258,9 +253,10 @@ void ConcreteScreen::setCurrentWorkspace(Workspace *workspace)
258 }
253 }
259}
254}
260
255
261−ProxyScreen::ProxyScreen(Screen *const screen)
256+ProxyScreen::ProxyScreen(Screen *const screen, ProxyScreens* screens)
262− : m_workspaces(new ProxyWorkspaceModel(screen->workspaces()))
257+ : m_workspaces(new ProxyWorkspaceModel(screen->workspaces(), this))
263 , m_original(screen)
258 , m_original(screen)
259+ , m_screens(screens)
264{
260{
265 connectToScreen(screen);
261 connectToScreen(screen);
266
262
@@ -296,3 +292,8 @@ void ProxyScreen::setCurrentWorkspace(Workspace *workspace)
296 m_original->setCurrentWorkspace(p->proxyObject());
292 m_original->setCurrentWorkspace(p->proxyObject());
297 }
293 }
298}
294}
295+
296+bool ProxyScreen::isSyncing() const
297+{
298+ return m_screens->isSyncing();
299+}
plugins/WindowManager/Screen.h+5−5
@@ -8,7 +8,7 @@
8#include "WorkspaceModel.h"
8#include "WorkspaceModel.h"
9
9
10class ProxyScreen;
10class ProxyScreen;
11−class ScreenAttached;
11+class ProxyScreens;
12
12
13class Screen: public QObject
13class Screen: public QObject
14{
14{
@@ -55,7 +55,6 @@ public:
55 virtual Workspace *currentWorkspace() const = 0;
55 virtual Workspace *currentWorkspace() const = 0;
56 virtual void setCurrentWorkspace(Workspace* workspace) = 0;
56 virtual void setCurrentWorkspace(Workspace* workspace) = 0;
57
57
58− void setSyncing(bool);
59 void sync(Screen* proxy);
58 void sync(Screen* proxy);
60
59
61 qtmir::Screen* wrapped() const { return m_wrapped; }
60 qtmir::Screen* wrapped() const { return m_wrapped; }
@@ -101,8 +100,6 @@ public:
101 Workspace *currentWorkspace() const override;
100 Workspace *currentWorkspace() const override;
102 void setCurrentWorkspace(Workspace* workspace) override;
101 void setCurrentWorkspace(Workspace* workspace) override;
103
102
104− static ScreenAttached *qmlAttachedProperties(QObject *owner);
105−
106protected:
103protected:
107 void resetCurrentWorkspace();
104 void resetCurrentWorkspace();
108
105
@@ -114,7 +111,7 @@ class ProxyScreen : public Screen
114{
111{
115 Q_OBJECT
112 Q_OBJECT
116public:
113public:
117− explicit ProxyScreen(Screen*const screen);
114+ explicit ProxyScreen(Screen*const screen, ProxyScreens* screens);
118
115
119 // From qtmir::Screen
116 // From qtmir::Screen
120 WorkspaceModel* workspaces() const override;
117 WorkspaceModel* workspaces() const override;
@@ -123,9 +120,12 @@ public:
123
120
124 Screen* proxyObject() const { return m_original.data(); }
121 Screen* proxyObject() const { return m_original.data(); }
125
122
123+ bool isSyncing() const;
124+
126private:
125private:
127 const QScopedPointer<WorkspaceModel> m_workspaces;
126 const QScopedPointer<WorkspaceModel> m_workspaces;
128 const QPointer<Screen> m_original;
127 const QPointer<Screen> m_original;
128+ const ProxyScreens* m_screens;
129 QPointer<Workspace> m_currentWorspace;
129 QPointer<Workspace> m_currentWorspace;
130};
130};
131
131
plugins/WindowManager/Screens.cpp+12−11
@@ -137,22 +137,17 @@ ProxyScreens *ConcreteScreens::createProxy()
137 return new ProxyScreens(this);
137 return new ProxyScreens(this);
138}
138}
139
139
140−void ConcreteScreens::sync(Screens *proxy)
140+void ConcreteScreens::sync(ProxyScreens *proxy)
141{
141{
142 if (!proxy) return;
142 if (!proxy) return;
143−
144− for (auto screen : m_screens) {
145− screen->setSyncing(true);
143+ proxy->setSyncing(true);
146− }
147
144
148 const auto& proxyList = proxy->list();
145 const auto& proxyList = proxy->list();
149 for (int i = 0; i < m_screens.count() && i < proxyList.count(); ++i) {
146 for (int i = 0; i < m_screens.count() && i < proxyList.count(); ++i) {
150 m_screens[i]->sync(proxyList[i]);
147 m_screens[i]->sync(proxyList[i]);
151 }
148 }
152
149
153− for (auto screen : m_screens) {
154− screen->setSyncing(false);
150+ proxy->setSyncing(true);
155− }
156}
151}
157
152
158void ConcreteScreens::onScreenAdded(qtmir::Screen *added)
153void ConcreteScreens::onScreenAdded(qtmir::Screen *added)
@@ -199,6 +194,7 @@ void ConcreteScreens::onScreenRemoved(qtmir::Screen *removed)
199ProxyScreens::ProxyScreens(Screens * const screens)
194ProxyScreens::ProxyScreens(Screens * const screens)
200 : Screens(screens->m_wrapped)
195 : Screens(screens->m_wrapped)
201 , m_original(screens)
196 , m_original(screens)
197+ , m_syncing(false)
202{
198{
203 connect(screens, &Screens::screenAdded, this, [this](Screen *added) {
199 connect(screens, &Screens::screenAdded, this, [this](Screen *added) {
204 Q_FOREACH(auto screen, m_screens) {
200 Q_FOREACH(auto screen, m_screens) {
@@ -207,7 +203,7 @@ ProxyScreens::ProxyScreens(Screens * const screens)
207 }
203 }
208
204
209 beginInsertRows(QModelIndex(), count(), count());
205 beginInsertRows(QModelIndex(), count(), count());
210− auto screenWrapper(new ProxyScreen(added));
206+ auto screenWrapper(new ProxyScreen(added, this));
211 QQmlEngine::setObjectOwnership(screenWrapper, QQmlEngine::CppOwnership);
207 QQmlEngine::setObjectOwnership(screenWrapper, QQmlEngine::CppOwnership);
212 m_screens.push_back(screenWrapper);
208 m_screens.push_back(screenWrapper);
213 endInsertRows();
209 endInsertRows();
@@ -237,8 +233,13 @@ ProxyScreens::ProxyScreens(Screens * const screens)
237 });
233 });
238
234
239 Q_FOREACH(Screen* screen, screens->list()) {
235 Q_FOREACH(Screen* screen, screens->list()) {
240− auto screenWrapper(new ProxyScreen(screen));
236+ auto screenWrapper(new ProxyScreen(screen, this));
241 QQmlEngine::setObjectOwnership(screenWrapper, QQmlEngine::CppOwnership);
237 QQmlEngine::setObjectOwnership(screenWrapper, QQmlEngine::CppOwnership);
242− m_screens.push_back(new ProxyScreen(screen));
238+ m_screens.push_back(screenWrapper);
243 }
239 }
244}
240}
241+
242+void ProxyScreens::setSyncing(bool syncing)
243+{
244+ m_syncing = syncing;
245+}
plugins/WindowManager/Screens.h+5−4
@@ -55,8 +55,6 @@ public:
55 int count() const;
55 int count() const;
56 QVariant activeScreen() const;
56 QVariant activeScreen() const;
57
57
58− bool isSyncing() const { return m_syncing; }
59−
60 const QVector<Screen*>& list() const { return m_screens; }
58 const QVector<Screen*>& list() const { return m_screens; }
61
59
62public Q_SLOTS:
60public Q_SLOTS:
@@ -74,7 +72,6 @@ protected:
74
72
75 QVector<Screen*> m_screens;
73 QVector<Screen*> m_screens;
76 const QSharedPointer<qtmir::Screens> m_wrapped;
74 const QSharedPointer<qtmir::Screens> m_wrapped;
77− bool m_syncing;
78
75
79 friend class ProxyScreens;
76 friend class ProxyScreens;
80};
77};
@@ -87,7 +84,7 @@ public:
87 ~ConcreteScreens();
84 ~ConcreteScreens();
88
85
89 Q_INVOKABLE ProxyScreens *createProxy();
86 Q_INVOKABLE ProxyScreens *createProxy();
90− Q_INVOKABLE void sync(Screens *proxy);
87+ Q_INVOKABLE void sync(ProxyScreens *proxy);
91
88
92 static ConcreteScreens *self();
89 static ConcreteScreens *self();
93
90
@@ -106,8 +103,12 @@ class ProxyScreens : public Screens
106public:
103public:
107 explicit ProxyScreens(Screens*const screens);
104 explicit ProxyScreens(Screens*const screens);
108
105
106+ void setSyncing(bool syncing);
107+ bool isSyncing() const { return m_syncing; }
108+
109private:
109private:
110 const QPointer<Screens> m_original;
110 const QPointer<Screens> m_original;
111+ bool m_syncing;
111};
112};
112
113
113#endif // SCREENS_H
114#endif // SCREENS_H
plugins/WindowManager/WorkspaceModel.cpp+11−9
@@ -17,6 +17,7 @@
17#include "WorkspaceModel.h"
17#include "WorkspaceModel.h"
18#include "WorkspaceManager.h"
18#include "WorkspaceManager.h"
19#include "Workspace.h"
19#include "Workspace.h"
20+#include "Screen.h"
20
21
21#include <QQmlEngine>
22#include <QQmlEngine>
22
23
@@ -119,11 +120,6 @@ QVariant WorkspaceModel::data(const QModelIndex &index, int role) const
119 }
120 }
120}
121}
121
122
122−void WorkspaceModel::setSyncing(bool syncing)
123−{
124− m_syncing = syncing;
125−}
126−
127void WorkspaceModel::sync(WorkspaceModel *proxy)
123void WorkspaceModel::sync(WorkspaceModel *proxy)
128{
124{
129 if (!proxy) return;
125 if (!proxy) return;
@@ -206,8 +202,9 @@ void WorkspaceModel::insertUnassigned(Workspace *workspace)
206}
202}
207
203
208
204
209−ProxyWorkspaceModel::ProxyWorkspaceModel(WorkspaceModel * const model)
205+ProxyWorkspaceModel::ProxyWorkspaceModel(WorkspaceModel * const model, ProxyScreen* screen)
210 : m_original(model)
206 : m_original(model)
207+ , m_screen(screen)
211{
208{
212 Q_FOREACH(auto workspace, model->list()) {
209 Q_FOREACH(auto workspace, model->list()) {
213 auto proxy = new ProxyWorkspace(workspace);
210 auto proxy = new ProxyWorkspace(workspace);
@@ -215,12 +212,12 @@ ProxyWorkspaceModel::ProxyWorkspaceModel(WorkspaceModel * const model)
215 proxy->assign(this);
212 proxy->assign(this);
216 }
213 }
217 connect(m_original, &WorkspaceModel::workspaceInserted, this, [this](int index, Workspace* inserted) {
214 connect(m_original, &WorkspaceModel::workspaceInserted, this, [this](int index, Workspace* inserted) {
218− if (m_original->isSyncing()) return;
215+ if (isSyncing()) return;
219
216
220 (new ProxyWorkspace(inserted))->assign(this, index);
217 (new ProxyWorkspace(inserted))->assign(this, index);
221 });
218 });
222 connect(m_original, &WorkspaceModel::workspaceRemoved, this, [this](Workspace* removed) {
219 connect(m_original, &WorkspaceModel::workspaceRemoved, this, [this](Workspace* removed) {
223− if (m_original->isSyncing()) return;
220+ if (isSyncing()) return;
224
221
225 for (int i = 0; i < rowCount(); i++) {
222 for (int i = 0; i < rowCount(); i++) {
226 auto workspaceProxy = qobject_cast<ProxyWorkspace*>(get(i));
223 auto workspaceProxy = qobject_cast<ProxyWorkspace*>(get(i));
@@ -232,7 +229,7 @@ ProxyWorkspaceModel::ProxyWorkspaceModel(WorkspaceModel * const model)
232 }
229 }
233 });
230 });
234 connect(m_original, &WorkspaceModel::workspaceMoved, this, [this](int from, int to) {
231 connect(m_original, &WorkspaceModel::workspaceMoved, this, [this](int from, int to) {
235− if (m_original->isSyncing()) return;
232+ if (isSyncing()) return;
236
233
237 move(from, to);
234 move(from, to);
238 });
235 });
@@ -243,6 +240,11 @@ void ProxyWorkspaceModel::move(int from, int to)
243 WorkspaceModel::move(from, to);
240 WorkspaceModel::move(from, to);
244}
241}
245
242
243+bool ProxyWorkspaceModel::isSyncing() const
244+{
245+ return m_screen->isSyncing();
246+}
247+
246void ProxyWorkspaceModel::addWorkspace()
248void ProxyWorkspaceModel::addWorkspace()
247{
249{
248 auto newWorkspace = WorkspaceManager::instance()->createWorkspace();
250 auto newWorkspace = WorkspaceManager::instance()->createWorkspace();
plugins/WindowManager/WorkspaceModel.h+5−5
@@ -25,6 +25,7 @@ Q_DECLARE_LOGGING_CATEGORY(WORKSPACES)
25
25
26class Workspace;
26class Workspace;
27class ProxyWorkspaceModel;
27class ProxyWorkspaceModel;
28+class ProxyScreen;
28
29
29class WorkspaceModel : public QAbstractListModel
30class WorkspaceModel : public QAbstractListModel
30{
31{
@@ -61,12 +62,9 @@ public:
61
62
62 const QVector<Workspace*>& list() const { return m_workspaces; }
63 const QVector<Workspace*>& list() const { return m_workspaces; }
63
64
64− void setSyncing(bool);
65 void sync(WorkspaceModel* proxy);
65 void sync(WorkspaceModel* proxy);
66 void finishSync();
66 void finishSync();
67
67
68− bool isSyncing() { return m_syncing; }
69−
70Q_SIGNALS:
68Q_SIGNALS:
71 void countChanged();
69 void countChanged();
72
70
@@ -79,7 +77,6 @@ protected:
79
77
80 QVector<Workspace*> m_workspaces;
78 QVector<Workspace*> m_workspaces;
81 QSet<Workspace*> m_unassignedWorkspaces;
79 QSet<Workspace*> m_unassignedWorkspaces;
82− bool m_syncing;
83
80
84 friend class ProxyWorkspaceModel;
81 friend class ProxyWorkspaceModel;
85};
82};
@@ -88,15 +85,18 @@ class ProxyWorkspaceModel : public WorkspaceModel
88{
85{
89 Q_OBJECT
86 Q_OBJECT
90public:
87public:
91− explicit ProxyWorkspaceModel(WorkspaceModel*const model);
88+ explicit ProxyWorkspaceModel(WorkspaceModel*const model, ProxyScreen* screen);
92
89
93 Q_INVOKABLE void move(int from, int to) override;
90 Q_INVOKABLE void move(int from, int to) override;
94
91
92+ bool isSyncing() const;
93+
95public Q_SLOTS:
94public Q_SLOTS:
96 void addWorkspace();
95 void addWorkspace();
97
96
98protected:
97protected:
99 const QPointer<WorkspaceModel> m_original;
98 const QPointer<WorkspaceModel> m_original;
99+ const ProxyScreen* m_screen;
100};
100};
101
101
102#endif // WORKSPACEMODEL_H
102#endif // WORKSPACEMODEL_H
qml/Shell.qml−16
@@ -907,20 +907,4 @@ StyledItem {
907 }
907 }
908 }
908 }
909 }
909 }
910−
911− Loader {
912− z: shutdownFadeOutRectangle.z + 1
913− active: DebuggingController.logOverlay
914−
915− sourceComponent: Text {
916− width: shell.width
917− height: shell.height
918−
919− text: consoleLog.out
920− Debug.ConsoleLog {
921− id: consoleLog
922− enabled: true
923− }
924− }
925− }
926}
910}
src/DebuggingController.cpp+1−12
@@ -49,8 +49,7 @@ public:
49};
49};
50
50
51DebuggingController::DebuggingController(QObject *parent):
51DebuggingController::DebuggingController(QObject *parent):
52− UnityDBusObject(QStringLiteral("/com/canonical/Unity8/Debugging"), QStringLiteral("com.canonical.Unity8"), true, parent),
52+ UnityDBusObject(QStringLiteral("/com/canonical/Unity8/Debugging"), QStringLiteral("com.canonical.Unity8"), true, parent)
53− m_logOverlay(false)
54{
53{
55}
54}
56
55
@@ -91,13 +90,3 @@ void DebuggingController::SetLoggingFilterRules(const QString &filterRules)
91{
90{
92 QLoggingCategory::setFilterRules(filterRules);
91 QLoggingCategory::setFilterRules(filterRules);
93}
92}
94−
95−void DebuggingController::SetLogOverlay(bool logOverlay)
96−{
97− if (logOverlay == m_logOverlay) {
98− return;
99− }
100−
101− m_logOverlay = logOverlay;
102− Q_EMIT logOverlayChanged(m_logOverlay);
103−}
src/DebuggingController.h−14
@@ -32,14 +32,10 @@ class DebuggingController: public UnityDBusObject
32 Q_OBJECT
32 Q_OBJECT
33 Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity8.Debugging")
33 Q_CLASSINFO("D-Bus Interface", "com.canonical.Unity8.Debugging")
34
34
35− Q_PROPERTY(bool logOverlay READ logOverlay NOTIFY logOverlayChanged)
36−
37public:
35public:
38 DebuggingController(QObject *parent = nullptr);
36 DebuggingController(QObject *parent = nullptr);
39 ~DebuggingController() = default;
37 ~DebuggingController() = default;
40
38
41− bool logOverlay() const { return m_logOverlay; }
42−
43public Q_SLOTS:
39public Q_SLOTS:
44 /**
40 /**
45 * Set the QSG_VISUALIZE mode. This follows the vlues supported by Qt in
41 * Set the QSG_VISUALIZE mode. This follows the vlues supported by Qt in
@@ -57,15 +53,5 @@ public Q_SLOTS:
57 */
53 */
58 Q_SCRIPTABLE void SetLoggingFilterRules(const QString &filterRules);
54 Q_SCRIPTABLE void SetLoggingFilterRules(const QString &filterRules);
59
55
60− /**
61− * Enable/Disable the shell console log overlay
62− */
63− Q_SCRIPTABLE void SetLogOverlay(bool logOverlay);
64−
65−Q_SIGNALS:
66− void logOverlayChanged(bool logOverlay);
67−
68−private:
69− bool m_logOverlay;
70};
56};
71#endif // DEBUGGINGCONTROLLER_H
57#endif // DEBUGGINGCONTROLLER_H
tests/CMakeLists.txt+1
@@ -46,6 +46,7 @@ macro(unity8_parse_arguments)
46 list(APPEND ld_paths
46 list(APPEND ld_paths
47 ${UNITY_MOCKPATH}/liblightdm
47 ${UNITY_MOCKPATH}/liblightdm
48 ${UNITY_MOCKPATH}/libusermetrics
48 ${UNITY_MOCKPATH}/libusermetrics
49+ ${UNITY_MOCKPATH}/WindowManager
49 )
50 )
50
51
51 string(REPLACE ";" ":" ld_library_path "${ld_paths}")
52 string(REPLACE ";" ":" ld_library_path "${ld_paths}")
tests/mocks/Unity/InputInfo/InputWindow.qmldeleted−68
@@ -1,68 +0,0 @@
1−import QtQuick 2.4
2−import Ubuntu.Components 1.3
3−import Unity.InputInfo 0.1
4−
5−Rectangle {
6− id: rect
7− color: "white"
8− width: parent.width
9− height: parent.height
10−
11− Action {
12− id: mouseAction
13− text: checked ? "Remove Mouse" : "Add Mouse"
14− onTriggered: {
15− if (checked) {
16− console.log("ADD")
17− MockInputDeviceBackend.addMockDevice("/mouse0", InputInfo.Mouse);
18− } else {
19− console.log("REMOVE")
20− MockInputDeviceBackend.removeDevice("/mouse0");
21− }
22− }
23− iconName: "input-mouse-symbolic"
24− checkable: true
25− checked: false
26− }
27−
28− Action {
29− id: kbAction
30− text: checked ? "Remove Keyboard" : "Add Keyboard"
31− onTriggered: {
32− if (checked) {
33− MockInputDeviceBackend.addMockDevice("/kbd0", InputInfo.Keyboard);
34− } else {
35− MockInputDeviceBackend.removeDevice("/kbd0");
36− }
37− }
38− iconName: "input-keyboard-symbolic"
39− checkable: true
40− checked: false
41− }
42−
43− Column {
44− anchors {
45− fill: parent
46− margins: units.gu(1)
47− }
48− spacing: units.gu(1)
49−
50− Button {
51− anchors {
52− left: parent.left
53− right: parent.right
54− }
55− action: mouseAction
56− color: mouseAction.checked ? UbuntuColors.red : UbuntuColors.green
57− }
58−
59− Button {
60− anchors {
61− left: parent.left
62− right: parent.right
63− }
64− action: kbAction
65− color: kbAction.checked ? UbuntuColors.red : UbuntuColors.green
66− }
67− }
68−}
tests/mocks/Unity/InputInfo/mockcontroller.cpp+4−16
@@ -23,26 +23,14 @@
23#include <QQuickItem>
23#include <QQuickItem>
24#include <paths.h>
24#include <paths.h>
25
25
26−MockController::MockController(QQmlEngine *engine)
26+MockController::MockController(QObject *parent):
27+ QObject(parent)
27{
28{
28− QQmlComponent component(engine);
29− component.setData("import QtQuick 2.4; import Unity.InputInfo 0.1; InputWindow { }", ::qmlDirectory());
30− QObject *myObject = component.create();
31− QQuickItem *item = qobject_cast<QQuickItem*>(myObject);
32− if (item) {
33− auto window = new QQuickView();
34− window->setTitle("Input");
35− item->setParentItem(window->contentItem());
36− window->setResizeMode(QQuickView::SizeRootObjectToView);
37− window->setWidth(200);
38− window->setHeight(100);
39− window->show();
40− }
41}
29}
42
30
43−MockController *MockController::instance(QQmlEngine *engine)
31+MockController *MockController::instance()
44{
32{
45− static MockController* controller = new MockController(engine);
33+ static MockController* controller = new MockController();
46 return controller;
34 return controller;
47}
35}
48
36
tests/mocks/Unity/InputInfo/mockcontroller.h+2−4
@@ -20,16 +20,14 @@
20#include <QObject>
20#include <QObject>
21#include "qinputinfo.h"
21#include "qinputinfo.h"
22
22
23−class QQmlEngine;
24−
25class MockController: public QObject
23class MockController: public QObject
26{
24{
27 Q_OBJECT
25 Q_OBJECT
28public:
26public:
29− MockController(QQmlEngine *engine);
27+ MockController(QObject *parent = nullptr);
30 ~MockController() = default;
28 ~MockController() = default;
31
29
32− static MockController *instance(QQmlEngine *engine);
30+ static MockController *instance();
33
31
34 Q_INVOKABLE QInputDevice* addMockDevice(const QString &devicePath, QInputDevice::InputType type);
32 Q_INVOKABLE QInputDevice* addMockDevice(const QString &devicePath, QInputDevice::InputType type);
35 Q_INVOKABLE void removeDevice(const QString &devicePath);
33 Q_INVOKABLE void removeDevice(const QString &devicePath);
tests/mocks/Unity/InputInfo/plugin.cpp+1−1
@@ -27,7 +27,7 @@
27static QObject *backendProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
27static QObject *backendProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
28{
28{
29 Q_UNUSED(scriptEngine)
29 Q_UNUSED(scriptEngine)
30− return MockController::instance(engine);
30+ return MockController::instance();
31}
31}
32
32
33void InputInfoPlugin::registerTypes(const char *uri)
33void InputInfoPlugin::registerTypes(const char *uri)
tests/mocks/Unity/InputInfo/qmldir−2
@@ -1,4 +1,2 @@
1module Unity.InputInfo
1module Unity.InputInfo
2plugin MockInputInfo
2plugin MockInputInfo
3−
4−InputWindow 0.1 InputWindow.qml
tests/mocks/WindowManager/CMakeLists.txt+4
@@ -19,6 +19,10 @@ target_link_libraries(mockwindowmanagmentpolicy
19)
19)
20qt5_use_modules(mockwindowmanagmentpolicy Core)
20qt5_use_modules(mockwindowmanagmentpolicy Core)
21
21
22+install(TARGETS mockwindowmanagmentpolicy
23+ DESTINATION ${SHELL_INSTALL_QML}/mocks/WindowManager
24+ )
25+
22set(WINDOWMANAGER_SRC
26set(WINDOWMANAGER_SRC
23 ${CMAKE_SOURCE_DIR}/plugins/WindowManager/Screen.cpp
27 ${CMAKE_SOURCE_DIR}/plugins/WindowManager/Screen.cpp
24 ${CMAKE_SOURCE_DIR}/plugins/WindowManager/ScreenAttached.cpp
28 ${CMAKE_SOURCE_DIR}/plugins/WindowManager/ScreenAttached.cpp
tests/qmltests/Panel/tst_Panel.qml+6−3
@@ -42,7 +42,9 @@ PanelTest {
42 value: keyboardAttached.checked
42 value: keyboardAttached.checked
43 }
43 }
44
44
45− readonly property alias panelState: panel.panelState
45+ readonly property var panelState: PanelState {
46+
47+ }
46
48
47 ApplicationMenuDataLoader {
49 ApplicationMenuDataLoader {
48 id: appMenuData
50 id: appMenuData
@@ -86,6 +88,7 @@ PanelTest {
86
88
87 indicatorMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
89 indicatorMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
88 applicationMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
90 applicationMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
91+ panelState: root.panelState
89
92
90 applicationMenus {
93 applicationMenus {
91 model: UnityMenuModel {
94 model: UnityMenuModel {
@@ -855,7 +858,7 @@ PanelTest {
855
858
856 var indicatorsBar = findChild(panel.applicationMenus, "indicatorsBar");
859 var indicatorsBar = findChild(panel.applicationMenus, "indicatorsBar");
857
860
858− PanelState.title = "Fake Title"
861+ root.panelState.title = "Fake Title"
859 pullDownApplicationsMenu(0 /*xPos*/);
862 pullDownApplicationsMenu(0 /*xPos*/);
860 compare(aboutToShowCalledSpy.count, 1);
863 compare(aboutToShowCalledSpy.count, 1);
861
864
@@ -888,7 +891,7 @@ PanelTest {
888
891
889 var indicatorsBar = findChild(panel.applicationMenus, "indicatorsBar");
892 var indicatorsBar = findChild(panel.applicationMenus, "indicatorsBar");
890
893
891− PanelState.title = "Fake Title"
894+ panelState.title = "Fake Title"
892 pullDownApplicationsMenu(0 /*xPos*/);
895 pullDownApplicationsMenu(0 /*xPos*/);
893
896
894 tryCompare(indicatorsBar, "currentItemIndex", 0);
897 tryCompare(indicatorsBar, "currentItemIndex", 0);
tests/qmltests/Stage/tst_PhoneStage.qml+4−5
@@ -31,6 +31,8 @@ Item {
31
31
32 property var greeter: { fullyShown: true }
32 property var greeter: { fullyShown: true }
33
33
34+ readonly property var topLevelSurfaceList: WorkspaceManager.activeWorkspace.windowModel
35+
34 ApplicationMenuDataLoader {
36 ApplicationMenuDataLoader {
35 id: appMenuData
37 id: appMenuData
36 }
38 }
@@ -45,11 +47,8 @@ Item {
45 orientations: Orientations {}
47 orientations: Orientations {}
46 applicationManager: ApplicationManager
48 applicationManager: ApplicationManager
47 mode: "staged"
49 mode: "staged"
48− topLevelSurfaceList: TopLevelWindowModel {
49− id: topLevelSurfaceList
50+ topLevelSurfaceList: root.topLevelSurfaceList
50− applicationManager: ApplicationManager
51+
51− surfaceManager: SurfaceManager
52− }
53 Component.onCompleted: {
52 Component.onCompleted: {
54 ApplicationManager.startApplication("unity8-dash");
53 ApplicationManager.startApplication("unity8-dash");
55 }
54 }
tests/qmltests/Stage/tst_TabletStage.qml+41−41
@@ -35,6 +35,8 @@ Rectangle {
35
35
36 property var greeter: { fullyShown: true }
36 property var greeter: { fullyShown: true }
37
37
38+ readonly property var topLevelSurfaceList: WorkspaceManager.activeWorkspace.windowModel
39+
38 ApplicationMenuDataLoader {
40 ApplicationMenuDataLoader {
39 id: appMenuData
41 id: appMenuData
40 }
42 }
@@ -54,12 +56,10 @@ Rectangle {
54 focus: true
56 focus: true
55 mode: "stagedWithSideStage"
57 mode: "stagedWithSideStage"
56 applicationManager: ApplicationManager
58 applicationManager: ApplicationManager
57− topLevelSurfaceList: TopLevelWindowModel {
58− id: topLevelSurfaceList
59+ topLevelSurfaceList: root.topLevelSurfaceList
59− applicationManager: ApplicationManager
60+
60− surfaceManager: SurfaceManager
61− }
62 Component.onCompleted: {
61 Component.onCompleted: {
62+ print("starting dash")
63 ApplicationManager.startApplication("unity8-dash");
63 ApplicationManager.startApplication("unity8-dash");
64 }
64 }
65 }
65 }
@@ -131,21 +131,21 @@ Rectangle {
131 name: "TabletStage"
131 name: "TabletStage"
132 when: windowShown
132 when: windowShown
133
133
134− readonly property alias topSurfaceList: stage.topLevelSurfaceList
134+ readonly property alias topLevelSurfaceList: root.topLevelSurfaceList
135 property Item sideStage: stage ? findChild(stage, "sideStage") : null
135 property Item sideStage: stage ? findChild(stage, "sideStage") : null
136
136
137 function init() {
137 function init() {
138 stageSaver.clear();
138 stageSaver.clear();
139
139
140 ApplicationManager.startApplication("unity8-dash");
140 ApplicationManager.startApplication("unity8-dash");
141− tryCompare(topSurfaceList, "count", 1);
141+ tryCompare(topLevelSurfaceList, "count", 1);
142− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
142+ compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
143
143
144 // this is very strange, but sometimes the test starts without
144 // this is very strange, but sometimes the test starts without
145 // Stage components having finished loading themselves
145 // Stage components having finished loading themselves
146 var appWindow = null
146 var appWindow = null
147 while (!appWindow) {
147 while (!appWindow) {
148− appWindow = findAppWindowForSurfaceId(topSurfaceList.idAt(0));
148+ appWindow = findAppWindowForSurfaceId(topLevelSurfaceList.idAt(0));
149 if (!appWindow) {
149 if (!appWindow) {
150 console.log("didn't find unity8-dash appWindow in Stage. Trying again...");
150 console.log("didn't find unity8-dash appWindow in Stage. Trying again...");
151 wait(50);
151 wait(50);
@@ -157,7 +157,7 @@ Rectangle {
157 tryCompare(appRepeater, "count", 1);
157 tryCompare(appRepeater, "count", 1);
158 tryCompare(appRepeater.itemAt(0), "x", 0);
158 tryCompare(appRepeater.itemAt(0), "x", 0);
159
159
160− waitUntilAppSurfaceShowsUp(topSurfaceList.idAt(0));
160+ waitUntilAppSurfaceShowsUp(topLevelSurfaceList.idAt(0));
161 sideStage.hideNow()
161 sideStage.hideNow()
162 tryCompare(sideStage, "x", stage.width)
162 tryCompare(sideStage, "x", stage.width)
163 }
163 }
@@ -272,7 +272,7 @@ Rectangle {
272 function test_tappingSwitchesFocusBetweenStages() {
272 function test_tappingSwitchesFocusBetweenStages() {
273 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
273 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
274
274
275− var webbrowserSurfaceId = topSurfaceList.nextId;
275+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
276 webbrowserCheckBox.checked = true;
276 webbrowserCheckBox.checked = true;
277 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
277 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
278 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
278 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
@@ -283,7 +283,7 @@ Rectangle {
283
283
284 tryCompare(webbrowserWindow.surface, "activeFocus", true);
284 tryCompare(webbrowserWindow.surface, "activeFocus", true);
285
285
286− var dialerSurfaceId = topSurfaceList.nextId;
286+ var dialerSurfaceId = topLevelSurfaceList.nextId;
287 dialerCheckBox.checked = true;
287 dialerCheckBox.checked = true;
288 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
288 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
289
289
@@ -315,7 +315,7 @@ Rectangle {
315 function test_closeAppInSideStage() {
315 function test_closeAppInSideStage() {
316 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
316 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
317
317
318− var dialerSurfaceId = topSurfaceList.nextId;
318+ var dialerSurfaceId = topLevelSurfaceList.nextId;
319 dialerCheckBox.checked = true;
319 dialerCheckBox.checked = true;
320 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
320 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
321
321
@@ -341,7 +341,7 @@ Rectangle {
341 }
341 }
342
342
343 function test_suspendsAndResumesAppsInMainStage() {
343 function test_suspendsAndResumesAppsInMainStage() {
344− var webbrowserSurfaceId = topSurfaceList.nextId;
344+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
345 webbrowserCheckBox.checked = true;
345 webbrowserCheckBox.checked = true;
346 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
346 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
347 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
347 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
@@ -350,7 +350,7 @@ Rectangle {
350
350
351 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
351 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
352
352
353− var gallerySurfaceId = topSurfaceList.nextId;
353+ var gallerySurfaceId = topLevelSurfaceList.nextId;
354 galleryCheckBox.checked = true;
354 galleryCheckBox.checked = true;
355 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
355 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
356 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
356 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
@@ -381,7 +381,7 @@ Rectangle {
381 // launch two main stage apps
381 // launch two main stage apps
382 // gallery will be on foreground and webbrowser on background
382 // gallery will be on foreground and webbrowser on background
383
383
384− var webbrowserSurfaceId = topSurfaceList.nextId;
384+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
385 webbrowserCheckBox.checked = true;
385 webbrowserCheckBox.checked = true;
386 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
386 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
387 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
387 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
@@ -389,7 +389,7 @@ Rectangle {
389 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
389 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
390 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
390 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
391
391
392− var gallerySurfaceId = topSurfaceList.nextId;
392+ var gallerySurfaceId = topLevelSurfaceList.nextId;
393 galleryCheckBox.checked = true;
393 galleryCheckBox.checked = true;
394 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
394 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
395 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
395 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
@@ -401,14 +401,14 @@ Rectangle {
401 // then launch two side stage apps
401 // then launch two side stage apps
402 // facebook will be on foreground and dialer on background
402 // facebook will be on foreground and dialer on background
403
403
404− var dialerSurfaceId = topSurfaceList.nextId;
404+ var dialerSurfaceId = topLevelSurfaceList.nextId;
405 dialerCheckBox.checked = true;
405 dialerCheckBox.checked = true;
406 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
406 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
407 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
407 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
408 var dialerDelegate = findChild(stage, "appDelegate_" + dialerSurfaceId);
408 var dialerDelegate = findChild(stage, "appDelegate_" + dialerSurfaceId);
409 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
409 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
410
410
411− var facebookSurfaceId = topSurfaceList.nextId;
411+ var facebookSurfaceId = topLevelSurfaceList.nextId;
412 facebookCheckBox.checked = true;
412 facebookCheckBox.checked = true;
413 waitUntilAppSurfaceShowsUp(facebookSurfaceId);
413 waitUntilAppSurfaceShowsUp(facebookSurfaceId);
414 var facebookApp = ApplicationManager.findApplication(facebookCheckBox.appId);
414 var facebookApp = ApplicationManager.findApplication(facebookCheckBox.appId);
@@ -443,14 +443,14 @@ Rectangle {
443 function test_foregroundAppsAreSuspendedWhenStageIsSuspended() {
443 function test_foregroundAppsAreSuspendedWhenStageIsSuspended() {
444 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
444 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
445
445
446− var webbrowserSurfaceId = topSurfaceList.nextId;
446+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
447 webbrowserCheckBox.checked = true;
447 webbrowserCheckBox.checked = true;
448 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
448 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
449 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
449 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
450 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
450 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
451 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
451 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
452
452
453− var dialerSurfaceId = topSurfaceList.nextId;
453+ var dialerSurfaceId = topLevelSurfaceList.nextId;
454 dialerCheckBox.checked = true;
454 dialerCheckBox.checked = true;
455 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
455 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
456 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
456 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
@@ -524,7 +524,7 @@ Rectangle {
524 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
524 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
525 tryCompare(stagesPriv, "sideStageAppId", "");
525 tryCompare(stagesPriv, "sideStageAppId", "");
526
526
527− var appSurfaceId = topSurfaceList.nextId;
527+ var appSurfaceId = topLevelSurfaceList.nextId;
528 var app = ApplicationManager.startApplication(data.appId);
528 var app = ApplicationManager.startApplication(data.appId);
529 waitUntilAppSurfaceShowsUp(appSurfaceId);
529 waitUntilAppSurfaceShowsUp(appSurfaceId);
530
530
@@ -548,7 +548,7 @@ Rectangle {
548 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
548 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
549 tryCompare(stagesPriv, "sideStageAppId", "");
549 tryCompare(stagesPriv, "sideStageAppId", "");
550
550
551− var webbrowserSurfaceId = topSurfaceList.nextId;
551+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
552 webbrowserCheckBox.checked = true;
552 webbrowserCheckBox.checked = true;
553 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
553 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
554
554
@@ -573,7 +573,7 @@ Rectangle {
573 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
573 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
574 tryCompare(stagesPriv, "sideStageAppId", "");
574 tryCompare(stagesPriv, "sideStageAppId", "");
575
575
576− var webbrowserSurfaceId = topSurfaceList.nextId;
576+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
577 webbrowserCheckBox.checked = true;
577 webbrowserCheckBox.checked = true;
578 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
578 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
579
579
@@ -591,7 +591,7 @@ Rectangle {
591 function test_loadSideStageByDraggingFromMainStage() {
591 function test_loadSideStageByDraggingFromMainStage() {
592 sideStage.showNow();
592 sideStage.showNow();
593 print("sidestage now shown. launching browser")
593 print("sidestage now shown. launching browser")
594− var webbrowserSurfaceId = topSurfaceList.nextId;
594+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
595 webbrowserCheckBox.checked = true;
595 webbrowserCheckBox.checked = true;
596 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
596 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
597
597
@@ -612,7 +612,7 @@ Rectangle {
612 tryCompareFunction(function() {
612 tryCompareFunction(function() {
613 return WindowStateStorage.getStage(webbrowserCheckBox.appId, ApplicationInfoInterface.MainStage) === ApplicationInfoInterface.SideStage
613 return WindowStateStorage.getStage(webbrowserCheckBox.appId, ApplicationInfoInterface.MainStage) === ApplicationInfoInterface.SideStage
614 }, true);
614 }, true);
615− var webbrowserSurfaceId = topSurfaceList.nextId;
615+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
616 webbrowserCheckBox.checked = true;
616 webbrowserCheckBox.checked = true;
617 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
617 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
618
618
@@ -628,7 +628,7 @@ Rectangle {
628
628
629 /*
629 /*
630 1- Suspended app gets killed behind the scenes, causing its surface to go zombie.
630 1- Suspended app gets killed behind the scenes, causing its surface to go zombie.
631− 2- Surface gets screenshotted and removed. Its slot in the topSurfaceList remains,
631+ 2- Surface gets screenshotted and removed. Its slot in the topLevelSurfaceList remains,
632 though (so ApplicationWindow can display the screenshot in its place).
632 though (so ApplicationWindow can display the screenshot in its place).
633 3- User taps on the screenshot of the long-gone surface.
633 3- User taps on the screenshot of the long-gone surface.
634
634
@@ -636,11 +636,11 @@ Rectangle {
636 Application gets relaunched. Its new surface will seamlessly replace the screenshot.
636 Application gets relaunched. Its new surface will seamlessly replace the screenshot.
637 */
637 */
638 function test_selectSuspendedAppWithoutSurface() {
638 function test_selectSuspendedAppWithoutSurface() {
639− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
639+ compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
640− var dashSurfaceId = topSurfaceList.idAt(0);
640+ var dashSurfaceId = topLevelSurfaceList.idAt(0);
641− var dashWindow = topSurfaceList.windowAt(0);
641+ var dashWindow = topLevelSurfaceList.windowAt(0);
642
642
643− var webbrowserSurfaceId = topSurfaceList.nextId;
643+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
644 webbrowserCheckBox.checked = true;
644 webbrowserCheckBox.checked = true;
645 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
645 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
646 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
646 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
@@ -657,22 +657,22 @@ Rectangle {
657
657
658 // wait until the surface is gone
658 // wait until the surface is gone
659 tryCompare(webbrowserApp.surfaceList, "count", 0);
659 tryCompare(webbrowserApp.surfaceList, "count", 0);
660− compare(topSurfaceList.surfaceAt(topSurfaceList.indexForId(webbrowserSurfaceId)), null);
660+ compare(topLevelSurfaceList.surfaceAt(topLevelSurfaceList.indexForId(webbrowserSurfaceId)), null);
661
661
662 switchToSurface(webbrowserSurfaceId);
662 switchToSurface(webbrowserSurfaceId);
663
663
664 // webbrowser should have been brought to front
664 // webbrowser should have been brought to front
665− tryCompareFunction(function(){return topSurfaceList.idAt(0);}, webbrowserSurfaceId);
665+ tryCompareFunction(function(){return topLevelSurfaceList.idAt(0);}, webbrowserSurfaceId);
666
666
667 // and it should eventually get a new surface and get resumed
667 // and it should eventually get a new surface and get resumed
668− tryCompareFunction(function(){return topSurfaceList.surfaceAt(0) !== null;}, true);
668+ tryCompareFunction(function(){return topLevelSurfaceList.surfaceAt(0) !== null;}, true);
669− compare(topSurfaceList.count, 2); // still two top-level items
669+ compare(topLevelSurfaceList.count, 2); // still two top-level items
670 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
670 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
671 compare(webbrowserApp.surfaceList.count, 1);
671 compare(webbrowserApp.surfaceList.count, 1);
672 }
672 }
673
673
674 function test_draggingSurfaceKeepsSurfaceFocus() {
674 function test_draggingSurfaceKeepsSurfaceFocus() {
675− var webbrowserSurfaceId = topSurfaceList.nextId;
675+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
676 webbrowserCheckBox.checked = true;
676 webbrowserCheckBox.checked = true;
677 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
677 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
678
678
@@ -690,8 +690,8 @@ Rectangle {
690
690
691 function test_dashDoesNotDragToSidestage() {
691 function test_dashDoesNotDragToSidestage() {
692 sideStage.showNow();
692 sideStage.showNow();
693− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
693+ compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
694− var dashSurfaceId = topSurfaceList.idAt(0);
694+ var dashSurfaceId = topLevelSurfaceList.idAt(0);
695
695
696 var appDelegate = findChild(stage, "appDelegate_" + dashSurfaceId);
696 var appDelegate = findChild(stage, "appDelegate_" + dashSurfaceId);
697 verify(appDelegate);
697 verify(appDelegate);
@@ -713,7 +713,7 @@ Rectangle {
713
713
714 function test_switchRestoreStageOnRotation() {
714 function test_switchRestoreStageOnRotation() {
715 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
715 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
716− var webbrowserSurfaceId = topSurfaceList.nextId;
716+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
717 webbrowserCheckBox.checked = true;
717 webbrowserCheckBox.checked = true;
718 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
718 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
719
719
@@ -732,7 +732,7 @@ Rectangle {
732 }
732 }
733
733
734 function test_restoreSavedStageOnCloseReopen() {
734 function test_restoreSavedStageOnCloseReopen() {
735− var webbrowserSurfaceId = topSurfaceList.nextId;
735+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
736 webbrowserCheckBox.checked = true;
736 webbrowserCheckBox.checked = true;
737 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
737 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
738
738
@@ -750,7 +750,7 @@ Rectangle {
750 // back to landscape
750 // back to landscape
751 stage.shellOrientation = Qt.LandscapeOrientation;
751 stage.shellOrientation = Qt.LandscapeOrientation;
752
752
753− webbrowserSurfaceId = topSurfaceList.nextId;
753+ webbrowserSurfaceId = topLevelSurfaceList.nextId;
754 webbrowserCheckBox.checked = true;
754 webbrowserCheckBox.checked = true;
755 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
755 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
756
756
tests/qmltests/tst_Shell.qml+2−2
@@ -60,7 +60,7 @@ Rectangle {
60 property var shell: shellLoader.item ? shellLoader.item : null
60 property var shell: shellLoader.item ? shellLoader.item : null
61 onShellChanged: {
61 onShellChanged: {
62 if (shell) {
62 if (shell) {
63− topLevelSurfaceList = testCase.findInvisibleChild(shell, "topLevelSurfaceList");
63+ topLevelSurfaceList = shell.topLevelSurfaceList;
64 panelState = testCase.findInvisibleChild(shell, "panelState");
64 panelState = testCase.findInvisibleChild(shell, "panelState");
65 } else {
65 } else {
66 topLevelSurfaceList = null;
66 topLevelSurfaceList = null;
@@ -607,7 +607,7 @@ Rectangle {
607 waitForGreeterToStabilize();
607 waitForGreeterToStabilize();
608
608
609 // from StageTestCase
609 // from StageTestCase
610− topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
610+ topLevelSurfaceList = shell.topLevelSurfaceList;
611 verify(topLevelSurfaceList);
611 verify(topLevelSurfaceList);
612 stage = findChild(shell, "stage");
612 stage = findChild(shell, "stage");
613
613