2
* Copyright (C) 2012 Canonical, Ltd.
5
* Gerry Boland <gerry.boland@canonical.com>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; version 3.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#include <QtQuick/QQuickView>
22
#include <QtGui/QGuiApplication>
23
#include <QtQml/QQmlEngine>
24
#include <QtQml/QQmlContext>
25
#include <QScopedPointer>
32
#include "registry-tracker.h"
35
int main(int argc, const char *argv[])
37
/* Workaround Qt platform integration plugin not advertising itself
38
as having the following capabilities:
39
- QPlatformIntegration::ThreadedOpenGL
40
- QPlatformIntegration::BufferQueueingOpenGL
42
setenv("QML_FORCE_THREADED_RENDERER", "1", 1);
43
setenv("QML_FIXED_ANIMATION_STEP", "1", 1);
45
QGuiApplication::setApplicationName("Unity Scope Tool");
46
QGuiApplication *application;
47
application = new QGuiApplication(argc, (char**)argv);
49
QStringList arguments = application->arguments();
51
if (arguments.contains("--scope-dir")) {
52
int idx = arguments.indexOf("--scope-dir");
53
scopesDir = arguments[idx+1];
56
QScopedPointer<RegistryTracker> tracker;
57
if (!scopesDir.isEmpty()) {
58
tracker.reset(new RegistryTracker(scopesDir));
63
bindtextdomain("unity8", translationDirectory().toUtf8().data());
65
QQuickView* view = new QQuickView();
66
view->setResizeMode(QQuickView::SizeRootObjectToView);
67
view->setTitle(QGuiApplication::applicationName());
68
view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));
70
QUrl source(::qmlDirectory() + "ScopeTool.qml");
71
prependImportPaths(view->engine(), ::overrideImportPaths());
72
appendImportPaths(view->engine(), ::fallbackImportPaths());
74
view->setSource(source);
78
int result = application->exec();