Added a sounds component that implements the Notifications interface and is used to
[harmattan/cameraplus] / imports / plugin.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 "plugin.h"
22 #include "imagemode.h"
23 #include "videomode.h"
24 #include "camera.h"
25 #include "previewprovider.h"
26 #include "capability.h"
27 #include "zoom.h"
28 #include "flash.h"
29 #include "scene.h"
30 #include "evcomp.h"
31 #include "videotorch.h"
32 #include "whitebalance.h"
33 #include "colortone.h"
34 #include "exposure.h"
35 #include "aperture.h"
36 #include "iso.h"
37 #include "noisereduction.h"
38 #include "flickerreduction.h"
39 #include "mute.h"
40 #include "metadata.h"
41 #include "imagesettings.h"
42 #include "imageresolutionmodel.h"
43 #include "videosettings.h"
44 #include "videoresolutionmodel.h"
45 #include "notifications.h"
46 #include "sounds.h"
47
48 #include <QtDeclarative>
49
50 #define URI "QtCamera"
51 #define MAJOR 1
52 #define MINOR 0
53
54 void Plugin::registerTypes(QDeclarativeEngine *engine) {
55   qmlRegisterType<Camera>(URI, MAJOR, MINOR, "Camera");
56   qmlRegisterType<ImageMode>(URI, MAJOR, MINOR, "ImageMode");
57   qmlRegisterType<VideoMode>(URI, MAJOR, MINOR, "VideoMode");
58   qmlRegisterType<Zoom>(URI, MAJOR, MINOR, "Zoom");
59   qmlRegisterType<Flash>(URI, MAJOR, MINOR, "Flash");
60   qmlRegisterType<Scene>(URI, MAJOR, MINOR, "Scene");
61   qmlRegisterType<EvComp>(URI, MAJOR, MINOR, "EvComp");
62   qmlRegisterType<VideoTorch>(URI, MAJOR, MINOR, "VideoTorch");
63   qmlRegisterType<WhiteBalance>(URI, MAJOR, MINOR, "WhiteBalance");
64   qmlRegisterType<ColorTone>(URI, MAJOR, MINOR, "ColorTone");
65   qmlRegisterType<Exposure>(URI, MAJOR, MINOR, "Exposure");
66   qmlRegisterType<Aperture>(URI, MAJOR, MINOR, "Aperture");
67   qmlRegisterType<Iso>(URI, MAJOR, MINOR, "Iso");
68   qmlRegisterType<NoiseReduction>(URI, MAJOR, MINOR, "NoiseReduction");
69   qmlRegisterType<FlickerReduction>(URI, MAJOR, MINOR, "FlickerReduction");
70   qmlRegisterType<Mute>(URI, MAJOR, MINOR, "Mute");
71   qmlRegisterType<MetaData>(URI, MAJOR, MINOR, "MetaData");
72   qmlRegisterType<ImageSettings>(URI, MAJOR, MINOR, "ImageSettings");
73   qmlRegisterType<VideoSettings>(URI, MAJOR, MINOR, "VideoSettings");
74   qmlRegisterType<Sounds>(URI, MAJOR, MINOR, "Sounds");
75   qmlRegisterInterface<Notifications>("Notifications");
76
77   qmlRegisterUncreatableType<ImageResolutionModel>(URI, MAJOR, MINOR, "ImageResolutionModel",
78                           "ImageResolutionModel can be obtained from ImageSettings");
79   qmlRegisterUncreatableType<VideoResolutionModel>(URI, MAJOR, MINOR, "VideoResolutionModel",
80                           "VideoResolutionModel can be obtained from VideoSettings");
81
82   qmlRegisterType<Mode>();
83   qmlRegisterType<Capability>();
84
85   engine->addImageProvider("preview", new PreviewProvider);
86 }