Added reset button to exposure settings
[harmattan/cameraplus] / lib / qtcamflash.cpp
index 24f1eb2..7348d4c 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 "qtcamflash.h"
 #include "qtcamcapability_p.h"
+#include "qtcamflash_p.h"
 
 QtCamFlash::QtCamFlash(QtCamDevice *dev, QObject *parent) :
-  QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::Flash, "flash-mode"), parent) {
+  QtCamCapability(new QtCamFlashPrivate(dev, parent), parent) {
 
+  QtCamFlashPrivate *pvt = dynamic_cast<QtCamFlashPrivate *>(d_ptr);
+
+  // We get a weird crash if we pass this as parent to QtCamFlashPrivate
+  pvt->setParent(this);
+
+  QObject::connect(pvt, SIGNAL(flashReadyChanged()), this, SIGNAL(flashReadyChanged()));
+
+  pvt->init();
 }
 
 QtCamFlash::~QtCamFlash() {
@@ -51,3 +60,7 @@ QtCamFlash::FlashMode QtCamFlash::value() {
 bool QtCamFlash::setValue(const QtCamFlash::FlashMode& mode) {
   return d_ptr->setIntValue(mode, false);
 }
+
+bool QtCamFlash::isReady() const {
+  return dynamic_cast<QtCamFlashPrivate *>(d_ptr)->isReady();
+}