on xenial help sign in
merge
commit74da756c457f6ea47f07d36d13fb23ab85a335fe authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 28 Jun 2013, 13:23 (13 years ago) parent3623bf74c2b3ae
3 files changed+15−13
debian/control+2−1 main.cpp+7−8 paths.h.in+6−4
debian/control+2−1
@@ -45,7 +45,7 @@ Depends: ${misc:Depends},
4545 qtdeclarative5-unity-notifications-plugin | unity-notifications-impl,
4646 unity-notifications-impl-1,
4747 qtdeclarative5-xmllistmodel-plugin,
48− qtubuntu,
48+ unity8-fake-env | qtubuntu-shell,
4949Recommends: indicators-client-plugin-datetime (>= 0.6.1),
5050 indicators-client-plugin-messaging (>= 0.6.1),
5151 indicators-client-plugin-network (>= 0.6.1),
@@ -72,6 +72,7 @@ Multi-Arch: same
7272Pre-Depends: ${misc:Pre-Depends}
7373Depends: ${misc:Depends},
7474 ${shlibs:Depends},
75+Provides: qtubuntu-shell,
7576Description: Fake environment for running Unity 8 shell
7677 Provides fake implementations of some QML modules used by Unity 8 shell
7778 (e.g Ubuntu.Application) so that you can run it in a sandboxed environment.
main.cpp+7−8
@@ -39,10 +39,10 @@ void prependImportPaths(QQmlEngine *engine, const QStringList &paths)
3939 // don't duplicate
4040 const QString& path = paths[i];
4141 QStringList::iterator iter = qFind(importPathList.begin(), importPathList.end(), path);
42− if (iter == importPathList.end())
43− importPathList.prepend(path);
42+ if (iter == importPathList.end()) {
43+ engine->addImportPath(path);
44+ }
4445 }
45− engine->setImportPathList(importPathList);
4646}
4747
4848/* When you append and import path to the list of import paths it will be the *last*
@@ -54,10 +54,10 @@ void appendImportPaths(QQmlEngine *engine, const QStringList &paths)
5454 Q_FOREACH(const QString& path, paths) {
5555 // don't duplicate
5656 QStringList::iterator iter = qFind(importPathList.begin(), importPathList.end(), path);
57− if (iter == importPathList.end())
57+ if (iter == importPathList.end()) {
5858 importPathList.append(path);
59+ }
5960 }
60− importPathList.append(paths);
6161 engine->setImportPathList(importPathList);
6262}
6363
@@ -134,9 +134,8 @@ int main(int argc, char** argv)
134134 QObject::connect(view->engine(), SIGNAL(quit()), qApp, SLOT(quit()));
135135
136136 QUrl source("Shell.qml");
137− prependImportPaths(view->engine(), QStringList() << ::shellAppDirectory());
138− prependImportPaths(view->engine(), ::shellImportPaths());
139− appendImportPaths(view->engine(), QStringList() << ::fakePluginsImportPath());
137+ prependImportPaths(view->engine(), ::overrideImportPaths());
138+ appendImportPaths(view->engine(), ::fallbackImportPaths());
140139 view->setSource(source);
141140 view->setColor("transparent");
142141
paths.h.in+6−4
@@ -46,7 +46,7 @@ inline QString shellAppDirectory() {
4646 }
4747}
4848
49−inline QStringList shellImportPaths() {
49+inline QStringList overrideImportPaths() {
5050 QStringList paths;
5151 if (isRunningInstalled()) {
5252 paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_PRIVATE_LIBDIR@/qml");
@@ -56,12 +56,14 @@ inline QStringList shellImportPaths() {
5656 return paths;
5757}
5858
59−inline QString fakePluginsImportPath() {
59+inline QStringList fallbackImportPaths() {
60+ QStringList paths;
6061 if (isRunningInstalled()) {
61− return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_PRIVATE_LIBDIR@/qml/mocks");
62+ paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_PRIVATE_LIBDIR@/qml/mocks");
6263 } else {
63− return QString("@CMAKE_BINARY_DIR@/tests/mocks");
64+ paths << QString("@CMAKE_BINARY_DIR@/tests/mocks");
6465 }
66+ return paths;
6567}
6668
6769inline QString sourceDirectory() {