project file fixes
[mardrone] / mardrone / main.cpp
1 /*==================================================================
2   !
3   !  mardrone application AR-Drone for MeeGo
4
5   ! Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6   ! All rights reserved.
7   !
8   !  Author:Kate Alhola  kate.alhola@nokia.com
9   !
10   ! GNU Lesser General Public License Usage
11   ! This file may be used under the terms of the GNU Lesser
12   ! General Public License version 2.1 as published by the Free Software
13   ! Foundation and appearing in the file LICENSE.LGPL included in the
14   ! packaging of this file.  Please review the following information to
15   ! ensure the GNU Lesser General Public License version 2.1 requirements
16   ! will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17   !
18   !
19   !
20   *===================================================================*/
21 #include <QtGui/QApplication>
22 #include "dronecontrol.h"
23 #include "video.h"
24 #include "gaugehorizon.h"
25 #include <QDeclarativeView>
26 #include <QDeclarativeContext>
27 #include <QDeclarativeEngine>
28 #include <QtDeclarative>
29 #include <QtComponents/qdeclarativewindow.h>
30
31 int main(int argc, char *argv[])
32 {
33     qmlRegisterType<DroneControl>("Drone", 1, 0, "DroneControl");
34     qmlRegisterType<DroneVideo>("Drone", 1, 0, "DroneVideo");
35     qmlRegisterType<GaugeHorizon>("Drone", 1, 0, "GaugeHorizon");
36     QApplication app(argc, argv);
37     QUrl *url;
38
39     qDebug() << "./ardrone.qml exists " << QFile("ardrone.qml").exists();
40     qDebug() << ":/ardrone.qml exists " << QFile(":/ardrone.qml").exists();
41
42     if(QFile("ardrone.qml").exists()) {
43         QDir::setCurrent(app.applicationDirPath());
44         url=new QUrl(QUrl::fromLocalFile("ardrone.qml"));
45     }
46     else  {
47         QDir::setCurrent(":/");
48         url=new QUrl("qrc:/ardrone.qml");
49     }
50     QDeclarativeWindow window(*url);
51     window.window()->show();
52
53     return app.exec();
54 }