Merge lp:~zeller-benjamin/ubuntu-system-settings/applauncherd into lp:ubuntu-system-settings

Proposed by Benjamin Zeller
Status: Work in progress
Proposed branch: lp:~zeller-benjamin/ubuntu-system-settings/applauncherd
Merge into: lp:ubuntu-system-settings
Diff against target: 158 lines (+50/-19)
5 files modified
CMakeLists.txt (+7/-0)
debian/control (+3/-0)
src/CMakeLists.txt (+7/-0)
src/main.cpp (+32/-18)
ubuntu-system-settings.desktop.in.in (+1/-1)
To merge this branch: bzr merge lp:~zeller-benjamin/ubuntu-system-settings/applauncherd
Reviewer Review Type Date Requested Status
Ubuntu Touch System Settings Pending
Review via email: mp+287968@code.launchpad.net

Commit message

Prepare ubuntu-system-settings app for mapplauncherd

Description of the change

Prepare ubuntu-system-settings app for mapplauncherd

To post a comment you must log in.
1602. By Benjamin Zeller

Prepare ubuntu-system-settings app for mapplauncherd

1603. By Benjamin Zeller

Fix build error

Unmerged revisions

1603. By Benjamin Zeller

Fix build error

1602. By Benjamin Zeller

Prepare ubuntu-system-settings app for mapplauncherd

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-11-05 21:25:13 +0000
3+++ CMakeLists.txt 2016-03-04 07:19:42 +0000
4@@ -1,6 +1,8 @@
5 project(ubuntu-system-settings C CXX)
6 cmake_minimum_required(VERSION 2.8.10)
7
8+option(MAPPLAUNCHERD_ENABLED "Build with mapplauncherd support" ON)
9+
10 if(${PROJECT_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
11 message(FATAL_ERROR "In-tree build attempt detected, aborting. Set your build dir outside your source dir, delete CMakeCache.txt from source root and try again.")
12 endif()
13@@ -47,6 +49,11 @@
14 pkg_search_module(POLKIT_AGENT polkit-agent-1)
15 pkg_search_module(CLICK REQUIRED click-0.4)
16
17+if (MAPPLAUNCHERD_ENABLED)
18+ set(MAPPLAUNCHERD_COMMAND_PREFIX "/usr/bin/invoker --type=ubuntu-components ")
19+ pkg_check_modules(MAPPLAUNCH REQUIRED qdeclarative5-boostable)
20+endif()
21+
22 find_program(XGETTEXT_BIN xgettext)
23 find_program(MSGFMT_BIN msgfmt)
24 find_program(INTLTOOL_MERGE intltool-merge)
25
26=== modified file 'debian/control'
27--- debian/control 2016-02-03 20:58:04 +0000
28+++ debian/control 2016-03-04 07:19:42 +0000
29@@ -49,6 +49,7 @@
30 python3-dbus,
31 python3-xdg,
32 gir1.2-glib-2.0,
33+ libmdeclarativecache5-dev (>= 1.1.13),
34 Standards-Version: 3.9.6
35 Homepage: https://launchpad.net/ubuntu-system-settings
36 # If you aren't a member of ~system-settings-touch but need to upload packaging
37@@ -95,6 +96,8 @@
38 python3-dbus,
39 python3-xdg,
40 gir1.2-glib-2.0,
41+ libmdeclarativecache5-0,
42+ mapplauncherd-booster-ubuntu-components,
43 qml-module-ubuntu-connectivity
44 Recommends: ubuntu-system-settings-online-accounts,
45 ubuntu-touch-sounds,
46
47=== modified file 'src/CMakeLists.txt'
48--- src/CMakeLists.txt 2016-02-10 15:52:50 +0000
49+++ src/CMakeLists.txt 2016-03-04 07:19:42 +0000
50@@ -32,6 +32,13 @@
51
52 add_executable(system-settings ${USS_SOURCES} ${QML_SOURCES} ${system-settings-resources})
53 qt5_use_modules(system-settings Core Gui Quick Qml)
54+
55+if (MAPPLAUNCHERD_ENABLED)
56+ add_definitions(-DMAPPLAUNCHERD_ENABLED)
57+ target_link_libraries (system-settings ${MAPPLAUNCH_LDFLAGS})
58+ target_compile_options(system-settings PRIVATE ${MAPPLAUNCH_CFLAGS})
59+endif()
60+
61 target_link_libraries(system-settings SystemSettings ${GLIB_LDFLAGS})
62 install(TARGETS system-settings RUNTIME DESTINATION bin)
63
64
65=== modified file 'src/main.cpp'
66--- src/main.cpp 2016-02-08 14:26:43 +0000
67+++ src/main.cpp 2016-03-04 07:19:42 +0000
68@@ -30,20 +30,29 @@
69 #include <QQuickView>
70 #include <QtQml>
71 #include <QtQml/QQmlDebuggingEnabler>
72+#include <QScopedPointer>
73 static QQmlDebuggingEnabler debuggingEnabler(false);
74
75+#ifdef MAPPLAUNCHERD_ENABLED
76+#include <mdeclarativecache5/MDeclarativeCache>
77+#endif
78+
79 using namespace SystemSettings;
80
81-int main(int argc, char **argv)
82+int Q_DECL_EXPORT main(int argc, char **argv)
83 {
84- QGuiApplication app(argc, argv);
85+ #ifdef MAPPLAUNCHERD_ENABLED
86+ QScopedPointer<QGuiApplication> app(MDeclarativeCache::qApplication(argc, argv));
87+ #else
88+ QScopedPointer<QGuiApplication> app(new QGuiApplication(argc,argv));
89+ #endif
90
91 /* The testability driver is only loaded by QApplication but not by
92 * QGuiApplication. However, QApplication depends on QWidget which would
93 * add some unneeded overhead => Let's load the testability driver on our
94 * own.
95 */
96- if (app.arguments().contains(QStringLiteral("-testability"))) {
97+ if (app->arguments().contains(QStringLiteral("-testability"))) {
98 QLibrary testLib(QStringLiteral("qttestability"));
99 if (testLib.load()) {
100 typedef void (*TasInitialize)(void);
101@@ -78,24 +87,29 @@
102 */
103 QString defaultPlugin;
104 QVariantMap pluginOptions;
105- parsePluginOptions(app.arguments(), defaultPlugin, pluginOptions);
106+ parsePluginOptions(app->arguments(), defaultPlugin, pluginOptions);
107
108- QQuickView view;
109+ #ifdef MAPPLAUNCHERD_ENABLED
110+ QScopedPointer<QQuickView> view(MDeclarativeCache::qQuickView());
111+ #else
112+ QScopedPointer<QQuickView> view(new QQuickView);
113+ #endif
114 Utilities utils;
115- QObject::connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()),
116+ QObject::connect(view->engine(), SIGNAL(quit()), app.data(), SLOT(quit()),
117 Qt::QueuedConnection);
118 qmlRegisterType<QAbstractItemModel>();
119 qmlRegisterType<SystemSettings::PluginManager>("SystemSettings", 1, 0, "PluginManager");
120- view.engine()->rootContext()->setContextProperty("Utilities", &utils);
121- view.setResizeMode(QQuickView::SizeRootObjectToView);
122- view.engine()->addImportPath(PLUGIN_PRIVATE_MODULE_DIR);
123- view.engine()->addImportPath(PLUGIN_QML_DIR);
124- view.rootContext()->setContextProperty("defaultPlugin", defaultPlugin);
125- view.rootContext()->setContextProperty("i18nDirectory", I18N_DIRECTORY);
126- view.rootContext()->setContextProperty("pluginOptions", pluginOptions);
127- view.rootContext()->setContextProperty("view", &view);
128- view.setSource(QUrl("qrc:/qml/MainWindow.qml"));
129- view.show();
130-
131- return app.exec();
132+
133+ view->engine()->rootContext()->setContextProperty("Utilities", &utils);
134+ view->setResizeMode(QQuickView::SizeRootObjectToView);
135+ view->engine()->addImportPath(PLUGIN_PRIVATE_MODULE_DIR);
136+ view->engine()->addImportPath(PLUGIN_QML_DIR);
137+ view->rootContext()->setContextProperty("defaultPlugin", defaultPlugin);
138+ view->rootContext()->setContextProperty("i18nDirectory", I18N_DIRECTORY);
139+ view->rootContext()->setContextProperty("pluginOptions", pluginOptions);
140+ view->rootContext()->setContextProperty("view", view.data());
141+ view->setSource(QUrl("qrc:/qml/MainWindow.qml"));
142+ view->show();
143+
144+ return app->exec();
145 }
146
147=== modified file 'ubuntu-system-settings.desktop.in.in'
148--- ubuntu-system-settings.desktop.in.in 2014-10-01 14:10:47 +0000
149+++ ubuntu-system-settings.desktop.in.in 2016-03-04 07:19:42 +0000
150@@ -3,7 +3,7 @@
151 _Categories=System;
152 _Keywords=Preferences;Settings;
153 Icon=@SETTINGS_SHARE_DIR@/system-settings.png
154-Exec=system-settings %u
155+Exec=@MAPPLAUNCHERD_COMMAND_PREFIX@system-settings %u
156 Terminal=false
157 Type=Application
158 StartupNotify=true

Subscribers

People subscribed via source and target branches