Added mount protector component.
[harmattan/cameraplus] / src / main.cpp
1 /*!
2  * This file is part of CameraPlus.
3  *
4  * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20
21 #include <QApplication>
22 #include <QDeclarativeView>
23 #include <QDeclarativeContext>
24 #include <QDeclarativeEngine>
25 #include <QtDeclarative>
26 #include <QGLWidget>
27
28 #include "imports/plugin.h"
29
30 #include "settings.h"
31 #include "filenaming.h"
32 #include "quillitem.h"
33 #include "displaystate.h"
34 #include "fsmonitor.h"
35 #include "cameraresources.h"
36 #include "compass.h"
37 #include "orientation.h"
38 #include "geocode.h"
39 #include "mountprotector.h"
40
41 Q_DECL_EXPORT int main(int argc, char *argv[]) {
42   QApplication::setAttribute(Qt::AA_X11InitThreads, true);
43   QApplication app(argc, argv);
44
45   QDeclarativeView view;
46   view.setViewport(new QGLWidget);
47   view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
48   view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
49
50   Plugin::registerTypes(view.engine());
51   qmlRegisterType<Settings>("CameraPlus", 1, 0, "Settings");
52   qmlRegisterType<FileNaming>("CameraPlus", 1, 0, "FileNaming");
53   qmlRegisterType<QuillItem>("CameraPlus", 1, 0, "QuillItem");
54   qmlRegisterType<DisplayState>("CameraPlus", 1, 0, "DisplayState");
55   qmlRegisterType<FSMonitor>("CameraPlus", 1, 0, "FSMonitor");
56   qmlRegisterType<CameraResources>("CameraPlus", 1, 0, "CameraResources");
57   qmlRegisterType<Compass>("CameraPlus", 1, 0, "Compass");
58   qmlRegisterType<Orientation>("CameraPlus", 1, 0, "Orientation");
59   qmlRegisterType<Geocode>("CameraPlus", 1, 0, "ReverseGeocode");
60   qmlRegisterType<MountProtector>("CameraPlus", 1, 0, "MountProtector");
61
62   QUrl sourceUrl = QUrl::fromLocalFile(QDir::currentPath() + "/main.qml");
63   view.setSource(sourceUrl);
64
65   view.showFullScreen();
66
67   int ret = app.exec();
68   return ret;
69 };