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>
30 #include "filenaming.h"
31 #include "quillitem.h"
32 #include "displaystate.h"
33 #include "fsmonitor.h"
34 #include "cameraresources.h"
36 #include "orientation.h"
38 #include "mountprotector.h"
39 #include "trackerstore.h"
40 #include "focusrectangle.h"
41 #include "sharehelper.h"
42 #include "deletehelper.h"
43 #include "galleryhelper.h"
44 #include "postcapturemodel.h"
45 #include "batteryinfo.h"
46 #include "gridlines.h"
47 #include "deviceinfo.h"
48 #include "devicekeys.h"
49 #include "platformsettings.h"
52 #include "qt_private/qdeclarativedebughelper_p.h"
53 #endif /* QMLJSDEBUGGER */
55 static void initQuill(PlatformSettings *settings) {
56 QList<QPair<QString, QSize> > previewLevels = settings->previewLevels();
57 Quill::setPreviewLevelCount(previewLevels.size());
59 for (int x = 0; x < previewLevels.size(); x++) {
60 Quill::setThumbnailFlavorName(x, previewLevels[x].first);
61 Quill::setPreviewSize(x, previewLevels[x].second);
62 Quill::setMinimumPreviewSize(x, previewLevels[x].second);
65 Quill::setThumbnailExtension(settings->thumbnailExtension());
66 Quill::setBackgroundRenderingColor(settings->backgroundRenderingColor());
67 Quill::setDBusThumbnailingEnabled(settings->isDBusThumbnailingEnabled());
68 Quill::setThumbnailCreationEnabled(settings->isThumbnailCreationEnabled());
70 QString tempPath = settings->temporaryFilePath();
71 QDir().mkpath(tempPath);
72 Quill::setTemporaryFilePath(tempPath);
75 Q_DECL_EXPORT int main(int argc, char *argv[]) {
76 QApplication::setAttribute(Qt::AA_X11InitThreads, true);
77 QApplication app(argc, argv);
80 QDeclarativeDebugHelper::enableDebugging();
81 #endif /* QMLJSDEBUGGER */
83 QDeclarativeView view;
84 view.setAttribute(Qt::WA_NoSystemBackground);
85 view.setViewport(new QGLWidget);
86 view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
87 view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
88 view.viewport()->setAttribute(Qt::WA_NoSystemBackground);
90 PlatformSettings platformSettings;
92 // Let's initialize Quill:
93 initQuill(&platformSettings);
95 qmlRegisterType<Settings>("CameraPlus", 1, 0, "Settings");
96 qmlRegisterType<FileNaming>("CameraPlus", 1, 0, "FileNaming");
97 qmlRegisterType<QuillItem>("CameraPlus", 1, 0, "QuillItem");
98 qmlRegisterType<DisplayState>("CameraPlus", 1, 0, "DisplayState");
99 qmlRegisterType<FSMonitor>("CameraPlus", 1, 0, "FSMonitor");
100 qmlRegisterType<CameraResources>("CameraPlus", 1, 0, "CameraResources");
101 qmlRegisterType<Compass>("CameraPlus", 1, 0, "Compass");
102 qmlRegisterType<Orientation>("CameraPlus", 1, 0, "Orientation");
103 qmlRegisterType<Geocode>("CameraPlus", 1, 0, "ReverseGeocode");
104 qmlRegisterType<MountProtector>("CameraPlus", 1, 0, "MountProtector");
105 qmlRegisterType<TrackerStore>("CameraPlus", 1, 0, "TrackerStore");
106 qmlRegisterType<FocusRectangle>("CameraPlus", 1, 0, "FocusRectangle");
107 qmlRegisterType<ShareHelper>("CameraPlus", 1, 0, "ShareHelper");
108 qmlRegisterType<DeleteHelper>("CameraPlus", 1, 0, "DeleteHelper");
109 qmlRegisterType<GalleryHelper>("CameraPlus", 1, 0, "GalleryHelper");
110 qmlRegisterType<PostCaptureModel>("CameraPlus", 1, 0, "PostCaptureModel");
111 qmlRegisterType<BatteryInfo>("CameraPlus", 1, 0, "BatteryInfo");
112 qmlRegisterType<GridLines>("CameraPlus", 1, 0, "GridLines");
113 qmlRegisterType<DeviceInfo>("CameraPlus", 1, 0, "DeviceInfo");
114 qmlRegisterType<DeviceKeys>("CameraPlus", 1, 0, "DeviceKeys");
116 view.setSource(QUrl("qrc:/qml/main.qml"));
118 view.showFullScreen();
120 int ret = app.exec();