Added support for strftime() format to creator name text
[harmattan/cameraplus] / declarative / plugin.cpp
index 1676e60..263328f 100644 (file)
 #include "imageresolutionmodel.h"
 #include "videosettings.h"
 #include "videoresolutionmodel.h"
-#include "declarativeqtcameranotifications.h"
 #include "sounds.h"
 #include "cameraconfig.h"
 #include "videoplayer.h"
-#include <QtDeclarative>
+#include "viewfinder.h"
+#include "capability.h"
+#include "imageresolution.h"
+#include "videoresolution.h"
+#include "quirks.h"
+#if defined(QT4)
+#include <QDeclarativeEngine>
+#elif defined(QT5)
+#include <QQmlEngine>
+#endif
 
 #define MAJOR 1
 #define MINOR 0
 
 Plugin::Plugin(QObject *parent) :
+#if defined(QT4)
   QDeclarativeExtensionPlugin(parent) {
+#elif defined(QT5)
+  QQmlExtensionPlugin(parent) {
+#endif
 
 }
 
@@ -62,7 +74,11 @@ Plugin::~Plugin() {
 
 }
 
+#if defined(QT4)
 void Plugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) {
+#elif defined(QT5)
+void Plugin::initializeEngine(QQmlEngine *engine, const char *uri) {
+#endif
   Q_UNUSED(uri);
 
   engine->addImageProvider("preview", new PreviewProvider);
@@ -82,7 +98,7 @@ void Plugin::registerTypes(const char *uri) {
   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<Aperture>(uri, MAJOR, MINOR, "Aperture", QObject::tr("Cannot create separate instance of Aperture"));
   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"));
@@ -97,7 +113,6 @@ void Plugin::registerTypes(const char *uri) {
   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");
@@ -108,6 +123,16 @@ void Plugin::registerTypes(const char *uri) {
   qmlRegisterType<CameraConfig>(uri, MAJOR, MINOR, "CameraConfig");
 
   qmlRegisterType<VideoPlayer>("QtCameraExtras", MAJOR, MINOR, "VideoPlayer");
+  qmlRegisterType<Viewfinder>(uri, MAJOR, MINOR, "Viewfinder");
+  qmlRegisterType<Capability>();
+
+  qmlRegisterType<ImageResolution>(uri, MAJOR, MINOR, "ImageResolution");
+  qmlRegisterType<VideoResolution>(uri, MAJOR, MINOR, "VideoResolution");
+
+  qmlRegisterUncreatableType<Quirks>(uri, MAJOR, MINOR, "Quirks",
+                         "Quirks can be obtained from Camera");
 }
 
+#if defined(QT4)
 Q_EXPORT_PLUGIN2(declarativeqtcamera, Plugin);
+#endif