2 * Copyright (C) 2012-2015 Canonical, Ltd.
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.
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.
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/>.
18#include <QCommandLineParser>
19#include <QtQuick/QQuickView>
20#include <QtGui/QGuiApplication>
21#include <QtQml/QQmlEngine>
22#include <QtQml/QQmlContext>
28// libandroid-properties
29#include <hybris/properties/properties.h>
33#include "MouseTouchAdaptor.h"
34#include "ApplicationArguments.h"
35#include "CachingNetworkManagerFactory.h"
36#include "UnityCommandLineParser.h"
39#include <TouchRegistry.h>
41int main(int argc, const char *argv[])
43 bool isMirServer = false;
44 if (qgetenv("QT_QPA_PLATFORM") == "ubuntumirclient") {
45 setenv("QT_QPA_PLATFORM", "mirserver", 1 /* overwrite */);
49 QGuiApplication::setApplicationName("unity8");
50 QGuiApplication *application;
52 application = new QGuiApplication(argc, (char**)argv);
54 UnityCommandLineParser parser(*application);
56 ApplicationArguments qmlArgs;
58 if (!parser.deviceName().isEmpty()) {
59 qmlArgs.setDeviceName(parser.deviceName());
62 property_get("ro.product.device", buffer /* value */, "desktop" /* default_value*/);
63 qmlArgs.setDeviceName(QString(buffer));
66 // The testability driver is only loaded by QApplication but not by QGuiApplication.
67 // However, QApplication depends on QWidget which would add some unneeded overhead => Let's load the testability driver on our own.
68 if (parser.hasTestability() || getenv("QT_LOAD_TESTABILITY")) {
69 QLibrary testLib(QLatin1String("qttestability"));
71 typedef void (*TasInitialize)(void);
72 TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
76 qCritical("Library qttestability resolve failed!");
79 qCritical("Library qttestability load failed!");
83 bindtextdomain("unity8", translationDirectory().toUtf8().data());
86 QQuickView* view = new QQuickView();
87 view->setResizeMode(QQuickView::SizeRootObjectToView);
88 view->setColor("black");
89 view->setTitle("Unity8 Shell");
91 if (parser.windowGeometry().isValid()) {
92 view->setWidth(parser.windowGeometry().width());
93 view->setHeight(parser.windowGeometry().height());
96 view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));
97 view->rootContext()->setContextProperty("applicationArguments", &qmlArgs);
98 view->rootContext()->setContextProperty("shellMode", parser.mode());
99 if (parser.hasFrameless()) {
100 view->setFlags(Qt::FramelessWindowHint);
102 TouchRegistry touchRegistry;
103 view->installEventFilter(&touchRegistry);
105 // You will need this if you want to interact with touch-only components using a mouse
106 // Needed only when manually testing on a desktop.
107 MouseTouchAdaptor *mouseTouchAdaptor = 0;
108 if (parser.hasMouseToTouch()) {
109 mouseTouchAdaptor = MouseTouchAdaptor::instance();
112 QUrl source(::qmlDirectory()+"OrientedShell.qml");
113 prependImportPaths(view->engine(), ::overrideImportPaths());
115 prependImportPaths(view->engine(), ::nonMirImportPaths());
117 appendImportPaths(view->engine(), ::fallbackImportPaths());
119 CachingNetworkManagerFactory *managerFactory = new CachingNetworkManagerFactory();
120 view->engine()->setNetworkAccessManagerFactory(managerFactory);
122 view->setSource(source);
123 QObject::connect(view->engine(), SIGNAL(quit()), application, SLOT(quit()));
125 if (isMirServer || parser.hasFullscreen()) {
126 view->showFullScreen();
131 int result = application->exec();
134 delete mouseTouchAdaptor;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list