Camera doesn't need to subclass QDeclarativeItem
[harmattan/cameraplus] / declarative / camera.h
index f7af0ac..f6bb59e 100644 (file)
 #ifndef CAMERA_H
 #define CAMERA_H
 
-#include <QDeclarativeItem>
+#include <QObject>
 #include <QVariant>
 #include <QPointer>
 
 class QtCamera;
 class QtCamDevice;
-class QtCamGraphicsViewfinder;
-class DeclarativeQtCameraNotifications;
+class Sounds;
 class NotificationsContainer;
 class Zoom;
 class Flash;
@@ -48,8 +47,9 @@ class AutoFocus;
 class Roi;
 class VideoMute;
 class VideoTorch;
+class CameraConfig;
 
-class Camera : public QDeclarativeItem {
+class Camera : public QObject {
   Q_OBJECT
 
   Q_PROPERTY(int deviceCount READ deviceCount NOTIFY deviceCountChanged)
@@ -59,10 +59,7 @@ class Camera : public QDeclarativeItem {
   Q_PROPERTY(bool running READ isRunning NOTIFY runningStateChanged);
   Q_PROPERTY(QString imageSuffix READ imageSuffix CONSTANT);
   Q_PROPERTY(QString videoSuffix READ videoSuffix CONSTANT);
-  Q_PROPERTY(DeclarativeQtCameraNotifications *notifications READ notifications WRITE setNotifications NOTIFY notificationsChanged);
-
-  Q_PROPERTY(QRectF renderArea READ renderArea NOTIFY renderAreaChanged);
-  Q_PROPERTY(QSizeF videoResolution READ videoResolution NOTIFY videoResolutionChanged);
+  Q_PROPERTY(Sounds *sounds READ sounds WRITE setSounds NOTIFY soundsChanged);
 
   Q_PROPERTY(Zoom *zoom READ zoom NOTIFY zoomChanged);
   Q_PROPERTY(Flash *flash READ flash NOTIFY flashChanged);
@@ -82,7 +79,8 @@ class Camera : public QDeclarativeItem {
   Q_PROPERTY(VideoMute *videoMute READ videoMute NOTIFY videoMuteChanged);
   Q_PROPERTY(VideoTorch *videoTorch READ videoTorch NOTIFY videoTorchChanged);
 
-  Q_PROPERTY(bool renderingEnabled READ isRenderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged);
+  // TODO: We need a setter here too.
+  Q_PROPERTY(CameraConfig *cameraConfig READ cameraConfig CONSTANT);
 
   Q_ENUMS(CameraMode);
 
@@ -93,11 +91,9 @@ public:
     VideoMode
   } CameraMode;
 
-  Camera(QDeclarativeItem *parent = 0);
+  Camera(QObject *parent = 0);
   ~Camera();
 
-  virtual void componentComplete();
-
   int deviceCount() const;
   Q_INVOKABLE QString deviceName(int index) const;
   Q_INVOKABLE QVariant deviceId(int index) const;
@@ -119,8 +115,8 @@ public:
   QString imageSuffix() const;
   QString videoSuffix() const;
 
-  DeclarativeQtCameraNotifications *notifications() const;
-  void setNotifications(DeclarativeQtCameraNotifications *notifications);
+  Sounds *sounds() const;
+  void setSounds(Sounds *sounds);
 
   Zoom *zoom() const;
   Flash *flash() const;
@@ -140,11 +136,7 @@ public:
   VideoMute *videoMute() const;
   VideoTorch *videoTorch() const;
 
-  QRectF renderArea() const;
-  QSizeF videoResolution() const;
-
-  bool isRenderingEnabled() const;
-  void setRenderingEnabled(bool enabled);
+  CameraConfig *cameraConfig() const;
 
 signals:
   void deviceCountChanged();
@@ -154,7 +146,7 @@ signals:
   void idleStateChanged();
   void runningStateChanged();
   void error(const QString& message, int code, const QString& debug);
-  void notificationsChanged();
+  void soundsChanged();
   void renderAreaChanged();
   void videoResolutionChanged();
 
@@ -177,9 +169,6 @@ signals:
   void videoTorchChanged();
   void renderingEnabledChanged();
 
-protected:
-  void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
-
 private:
   bool applyMode();
   bool setDeviceId(const QVariant& deviceId);
@@ -190,7 +179,6 @@ private:
   QtCamera *m_cam;
   QtCamDevice *m_dev;
   QVariant m_id;
-  QtCamGraphicsViewfinder *m_vf;
   CameraMode m_mode;
   NotificationsContainer *m_notifications;
 
@@ -211,6 +199,7 @@ private:
 
   VideoMute *m_videoMute;
   VideoTorch *m_videoTorch;
+  CameraConfig *m_config;
 };
 
 #endif /* CAMERA_H */