~lukas-kde/miral/shellchrome-windowinfo

« back to all changes in this revision

Viewing changes to miral-qt/demos/qml-demo-shell/main.cpp

  • Committer: Larry Price
  • Date: 2016-09-13 16:19:29 UTC
  • mto: (330.4.1 miral)
  • mto: This revision was merged to the branch mainline in revision 352.
  • Revision ID: larry.price@canonical.com-20160913161929-vs9ka1capmljq1es
Removing miral-qt from release branch, updating copyright file, and adding GPL3 license to root dir

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2012-2015 Canonical, Ltd.
3
 
 *
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.
7
 
 *
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.
12
 
 *
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/>.
15
 
 */
16
 
 
17
 
// Qt
18
 
#include <QCommandLineParser>
19
 
#include <QtQuick/QQuickView>
20
 
#include <QtGui/QGuiApplication>
21
 
#include <QtQml/QQmlEngine>
22
 
#include <QtQml/QQmlContext>
23
 
#include <QLibrary>
24
 
#include <QDebug>
25
 
#include <csignal>
26
 
#include <libintl.h>
27
 
#include "../paths.h"
28
 
 
29
 
#include <private/qobject_p.h>
30
 
 
31
 
// REMOVEME - Should be able to use qmlscene, but in order to use the mir benchmarking we need
32
 
// to parse command line switches. Wait until MIR_SOCKET supported by the benchmark framework.
33
 
 
34
 
int main(int argc, const char *argv[])
35
 
{
36
 
    setenv("QT_QPA_PLATFORM_PLUGIN_PATH", qPrintable(::qpaPluginDirectory()), 1 /* overwrite */);
37
 
    setenv("QT_QPA_PLATFORM", "mirserver", 1 /* overwrite */);
38
 
 
39
 
    QGuiApplication::setApplicationName("qml-demo-shell");
40
 
    QGuiApplication *application;
41
 
 
42
 
    application = new QGuiApplication(argc, (char**)argv);
43
 
    QQuickView* view = new QQuickView();
44
 
    view->engine()->addImportPath(::qmlPluginDirectory());
45
 
    view->setResizeMode(QQuickView::SizeRootObjectToView);
46
 
    view->setColor("lightgray");
47
 
    view->setTitle("Demo Shell");
48
 
    
49
 
    QUrl source(::qmlDirectory() + "qml-demo-shell/windowModel.qml");
50
 
 
51
 
    view->setSource(source);
52
 
    QObject::connect(view->engine(), SIGNAL(quit()), application, SLOT(quit()));
53
 
 
54
 
    view->showFullScreen();
55
 
    int result = application->exec();
56
 
 
57
 
    delete view;
58
 
    delete application;
59
 
 
60
 
    return result;
61
 
}