~ci-train-bot/ubuntu-system-settings/ubuntu-system-settings-ubuntu-zesty-2066

« back to all changes in this revision

Viewing changes to src/main.cpp

  • Committer: Bileto Bot
  • Author(s): Jonas G. Drange
  • Date: 2016-09-30 13:48:06 UTC
  • mfrom: (1720.3.7 path-fixes)
  • Revision ID: ci-train-bot@canonical.com-20160930134806-tir714ireb8xzaau
uses XDG_DATA_DIRS where applicable to enable USS to find files and folders on snappy-based systems (LP: #1629009)

Approved by: Alberto Mardegan, Ken VanDine, Lukáš Tinkl, system-apps-ci-bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "plugin-manager.h"
24
24
#include "utils.h"
25
25
 
 
26
#include <QByteArray>
26
27
#include <QGuiApplication>
27
28
#include <QProcessEnvironment>
28
29
#include <QQmlContext>
29
30
#include <QUrl>
30
31
#include <QQuickView>
 
32
#include <QtGlobal>
31
33
#include <QtQml>
32
34
#include <QtQml/QQmlDebuggingEnabler>
33
35
static QQmlDebuggingEnabler debuggingEnabler(false);
37
39
int main(int argc, char **argv)
38
40
{
39
41
    QGuiApplication app(argc, argv);
 
42
    QByteArray mountPoint = qEnvironmentVariableIsSet("SNAP") ? qgetenv("SNAP") : "";
40
43
 
41
44
    /* The testability driver is only loaded by QApplication but not by
42
45
     * QGuiApplication.  However, QApplication depends on QWidget which would
88
91
    qmlRegisterType<SystemSettings::PluginManager>("SystemSettings", 1, 0, "PluginManager");
89
92
    view.engine()->rootContext()->setContextProperty("Utilities", &utils);
90
93
    view.setResizeMode(QQuickView::SizeRootObjectToView);
91
 
    view.engine()->addImportPath(PLUGIN_PRIVATE_MODULE_DIR);
92
 
    view.engine()->addImportPath(PLUGIN_QML_DIR);
 
94
    view.engine()->addImportPath(mountPoint + PLUGIN_PRIVATE_MODULE_DIR);
 
95
    view.engine()->addImportPath(mountPoint + PLUGIN_QML_DIR);
93
96
    view.rootContext()->setContextProperty("defaultPlugin", defaultPlugin);
94
 
    view.rootContext()->setContextProperty("i18nDirectory", I18N_DIRECTORY);
 
97
    view.rootContext()->setContextProperty("mountPoint", mountPoint);
 
98
    view.rootContext()->setContextProperty("i18nDirectory", mountPoint + I18N_DIRECTORY);
95
99
    view.rootContext()->setContextProperty("pluginOptions", pluginOptions);
96
100
    view.rootContext()->setContextProperty("view", &view);
97
101
    view.setSource(QUrl("qrc:/qml/MainWindow.qml"));