Updated copyright year
[harmattan/cameraplus] / declarative / plugin.cpp
index 08ef8df..d94d8b2 100644 (file)
@@ -1,7 +1,7 @@
 /*!
  * This file is part of CameraPlus.
  *
- * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #include "flickerreduction.h"
 #include "focus.h"
 #include "autofocus.h"
+#include "roi.h"
 #include "videomute.h"
 #include "metadata.h"
 #include "imagesettings.h"
 #include "imageresolutionmodel.h"
 #include "videosettings.h"
 #include "videoresolutionmodel.h"
-#include "notifications.h"
+#include "declarativeqtcameranotifications.h"
 #include "sounds.h"
 
 #include <QtDeclarative>
 #define MAJOR 1
 #define MINOR 0
 
-void Plugin::registerTypes(QDeclarativeEngine *engine) {
-  qmlRegisterType<Camera>(URI, MAJOR, MINOR, "Camera");
-  qmlRegisterType<ImageMode>(URI, MAJOR, MINOR, "ImageMode");
-  qmlRegisterType<VideoMode>(URI, MAJOR, MINOR, "VideoMode");
-
-  qmlRegisterUncreatableType<Zoom>(URI, MAJOR, MINOR, "Zoom", QObject::tr("Cannot create separate instance of Zoom"));
-  qmlRegisterUncreatableType<Flash>(URI, MAJOR, MINOR, "Flash", QObject::tr("Cannot create separate instance of Flash"));
-  qmlRegisterUncreatableType<Scene>(URI, MAJOR, MINOR, "Scene", QObject::tr("Cannot create separate instance of Scene"));
-  qmlRegisterUncreatableType<EvComp>(URI, MAJOR, MINOR, "EvComp", QObject::tr("Cannot create separate instance of EvComp"));
-  qmlRegisterUncreatableType<WhiteBalance>(URI, MAJOR, MINOR, "WhiteBalance", QObject::tr("Cannot create separate instance of WhiteBalance"));
-  qmlRegisterUncreatableType<ColorTone>(URI, MAJOR, MINOR, "ColorTone", QObject::tr("Cannot create separate instance of ColorTone"));
-  qmlRegisterUncreatableType<Exposure>(URI, MAJOR, MINOR, "Exposure", QObject::tr("Cannot create separate instance of Exposure"));
-  qmlRegisterUncreatableType<Aperture>(URI, MAJOR, MINOR, "Aperture", QObject::tr("Cannot create separate instance of Iso"));
-  qmlRegisterUncreatableType<Iso>(URI, MAJOR, MINOR, "Iso", QObject::tr("Cannot create separate instance of Iso"));
-  qmlRegisterUncreatableType<NoiseReduction>(URI, MAJOR, MINOR, "NoiseReduction", QObject::tr("Cannot create separate instance of NoiseReduction"));
-  qmlRegisterUncreatableType<FlickerReduction>(URI, MAJOR, MINOR, "FlickerReduction", QObject::tr("Cannot create separate instance of FlickerReduction"));
-  qmlRegisterUncreatableType<Focus>(URI, MAJOR, MINOR, "Focus", QObject::tr("Cannot create separate instance of Focus"));
-  qmlRegisterUncreatableType<AutoFocus>(URI, MAJOR, MINOR, "AutoFocus", QObject::tr("Cannot create separate instance of AutoFocus"));
-
-  qmlRegisterUncreatableType<VideoMute>(URI, MAJOR, MINOR, "VideoMute", QObject::tr("Cannot create separate instance of VideoMute"));
-  qmlRegisterUncreatableType<VideoTorch>(URI, MAJOR, MINOR, "VideoTorch", QObject::tr("Cannot create separate instance of VideoTorch"));
-
-  qmlRegisterType<MetaData>(URI, MAJOR, MINOR, "MetaData");
-  qmlRegisterType<ImageSettings>(URI, MAJOR, MINOR, "ImageSettings");
-  qmlRegisterType<VideoSettings>(URI, MAJOR, MINOR, "VideoSettings");
-  qmlRegisterType<Sounds>(URI, MAJOR, MINOR, "Sounds");
-  qmlRegisterInterface<Notifications>("Notifications");
-
-  qmlRegisterUncreatableType<ImageResolutionModel>(URI, MAJOR, MINOR, "ImageResolutionModel",
+Plugin::Plugin(QObject *parent) :
+  QDeclarativeExtensionPlugin(parent) {
+
+}
+
+Plugin::~Plugin() {
+
+}
+
+void Plugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) {
+  Q_UNUSED(uri);
+
+  engine->addImageProvider("preview", new PreviewProvider);
+}
+
+void Plugin::registerTypes(const char *uri) {
+  qmlRegisterType<Camera>(uri, MAJOR, MINOR, "Camera");
+  qmlRegisterType<ImageMode>(uri, MAJOR, MINOR, "ImageMode");
+  qmlRegisterType<VideoMode>(uri, MAJOR, MINOR, "VideoMode");
+
+  qmlRegisterUncreatableType<Zoom>(uri, MAJOR, MINOR, "Zoom", QObject::tr("Cannot create separate instance of Zoom"));
+  qmlRegisterUncreatableType<Flash>(uri, MAJOR, MINOR, "Flash", QObject::tr("Cannot create separate instance of Flash"));
+  qmlRegisterUncreatableType<Scene>(uri, MAJOR, MINOR, "Scene", QObject::tr("Cannot create separate instance of Scene"));
+  qmlRegisterUncreatableType<EvComp>(uri, MAJOR, MINOR, "EvComp", QObject::tr("Cannot create separate instance of EvComp"));
+  qmlRegisterUncreatableType<WhiteBalance>(uri, MAJOR, MINOR, "WhiteBalance", QObject::tr("Cannot create separate instance of WhiteBalance"));
+  qmlRegisterUncreatableType<ColorTone>(uri, MAJOR, MINOR, "ColorTone", QObject::tr("Cannot create separate instance of ColorTone"));
+  qmlRegisterUncreatableType<Exposure>(uri, MAJOR, MINOR, "Exposure", QObject::tr("Cannot create separate instance of Exposure"));
+  qmlRegisterUncreatableType<Aperture>(uri, MAJOR, MINOR, "Aperture", QObject::tr("Cannot create separate instance of Iso"));
+  qmlRegisterUncreatableType<Iso>(uri, MAJOR, MINOR, "Iso", QObject::tr("Cannot create separate instance of Iso"));
+  qmlRegisterUncreatableType<NoiseReduction>(uri, MAJOR, MINOR, "NoiseReduction", QObject::tr("Cannot create separate instance of NoiseReduction"));
+  qmlRegisterUncreatableType<FlickerReduction>(uri, MAJOR, MINOR, "FlickerReduction", QObject::tr("Cannot create separate instance of FlickerReduction"));
+  qmlRegisterUncreatableType<Focus>(uri, MAJOR, MINOR, "Focus", QObject::tr("Cannot create separate instance of Focus"));
+  qmlRegisterUncreatableType<AutoFocus>(uri, MAJOR, MINOR, "AutoFocus", QObject::tr("Cannot create separate instance of AutoFocus"));
+  qmlRegisterUncreatableType<Roi>(uri, MAJOR, MINOR, "Roi", QObject::tr("Cannot create separate instance of Roi"));
+
+  qmlRegisterUncreatableType<VideoMute>(uri, MAJOR, MINOR, "VideoMute", QObject::tr("Cannot create separate instance of VideoMute"));
+  qmlRegisterUncreatableType<VideoTorch>(uri, MAJOR, MINOR, "VideoTorch", QObject::tr("Cannot create separate instance of VideoTorch"));
+
+  qmlRegisterType<MetaData>(uri, MAJOR, MINOR, "MetaData");
+  qmlRegisterType<ImageSettings>(uri, MAJOR, MINOR, "ImageSettings");
+  qmlRegisterType<VideoSettings>(uri, MAJOR, MINOR, "VideoSettings");
+  qmlRegisterType<Sounds>(uri, MAJOR, MINOR, "Sounds");
+  qmlRegisterInterface<DeclarativeQtCameraNotifications>("DeclarativeQtCameraNotifications");
+
+  qmlRegisterUncreatableType<ImageResolutionModel>(uri, MAJOR, MINOR, "ImageResolutionModel",
                          "ImageResolutionModel can be obtained from ImageSettings");
-  qmlRegisterUncreatableType<VideoResolutionModel>(URI, MAJOR, MINOR, "VideoResolutionModel",
+  qmlRegisterUncreatableType<VideoResolutionModel>(uri, MAJOR, MINOR, "VideoResolutionModel",
                          "VideoResolutionModel can be obtained from VideoSettings");
 
   qmlRegisterType<Mode>();
-
-  engine->addImageProvider("preview", new PreviewProvider);
 }
+
+Q_EXPORT_PLUGIN2(declarativeqtcamera, Plugin);