2 * This file is part of CameraPlus.
4 * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
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.
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.
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
21 #include <QApplication>
22 #include <QDeclarativeView>
23 #include <QDeclarativeContext>
24 #include <QDeclarativeEngine>
25 #include <QtDeclarative>
29 #include "imports/plugin.h"
32 #include "filenaming.h"
33 #include "quillitem.h"
34 #include "displaystate.h"
35 #include "fsmonitor.h"
36 #include "cameraresources.h"
38 #include "orientation.h"
40 #include "mountprotector.h"
41 #include "trackerstore.h"
42 #include "focusrectangle.h"
44 static void initQuill() {
45 // TODO: All these are hardcoded.
46 Quill::setPreviewLevelCount(1);
47 Quill::setPreviewSize(0, QSize(854, 480));
48 Quill::setMinimumPreviewSize(0, QSize(854, 480));
49 Quill::setThumbnailExtension("jpeg");
50 Quill::setThumbnailFlavorName(0, "screen");
51 Quill::setBackgroundRenderingColor(Qt::black);
52 QString tempPath(QDir::homePath() + QDir::separator() + ".config" +
53 QDir::separator() + "quill" + QDir::separator() + "tmp");
54 QDir().mkpath(tempPath);
55 Quill::setTemporaryFilePath(tempPath);
56 Quill::setDBusThumbnailingEnabled(true);
57 Quill::setThumbnailCreationEnabled(true);
60 Q_DECL_EXPORT int main(int argc, char *argv[]) {
61 QApplication::setAttribute(Qt::AA_X11InitThreads, true);
62 QApplication app(argc, argv);
64 // Let's initialize Quill:
67 QDeclarativeView view;
68 view.setViewport(new QGLWidget);
69 view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
70 view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
72 Plugin::registerTypes(view.engine());
73 qmlRegisterType<Settings>("CameraPlus", 1, 0, "Settings");
74 qmlRegisterType<FileNaming>("CameraPlus", 1, 0, "FileNaming");
75 qmlRegisterType<QuillItem>("CameraPlus", 1, 0, "QuillItem");
76 qmlRegisterType<DisplayState>("CameraPlus", 1, 0, "DisplayState");
77 qmlRegisterType<FSMonitor>("CameraPlus", 1, 0, "FSMonitor");
78 qmlRegisterType<CameraResources>("CameraPlus", 1, 0, "CameraResources");
79 qmlRegisterType<Compass>("CameraPlus", 1, 0, "Compass");
80 qmlRegisterType<Orientation>("CameraPlus", 1, 0, "Orientation");
81 qmlRegisterType<Geocode>("CameraPlus", 1, 0, "ReverseGeocode");
82 qmlRegisterType<MountProtector>("CameraPlus", 1, 0, "MountProtector");
83 qmlRegisterType<TrackerStore>("CameraPlus", 1, 0, "TrackerStore");
84 qmlRegisterType<FocusRectangle>("CameraPlus", 1, 0, "FocusRectangle");
86 QUrl sourceUrl = QUrl::fromLocalFile(QDir::currentPath() + "/main.qml");
87 view.setSource(sourceUrl);
89 view.showFullScreen();