Blackberry: Restart camera viewfinder after standby
authorTobias Koenig <tobias.koenig.qnx@kdab.com>
Fri, 8 Feb 2013 12:35:28 +0000 (13:35 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 11 Feb 2013 07:57:38 +0000 (08:57 +0100)
Listen to the CAMERA_STATUS_POWERUP signal, which is sent
after standby, and trigger a restart of the viewfinder
in this case.

Change-Id: I426f23657844bb270ddfd0e4bfb35880040aa583
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
src/plugins/blackberry/camera/bbcamerasession.cpp
src/plugins/blackberry/camera/bbcamerasession.h

index 9956bd0..be352b1 100644 (file)
@@ -924,6 +924,12 @@ void BbCameraSession::deviceOrientationChanged(int angle)
         camera_set_device_orientation(m_handle, angle);
 }
 
+void BbCameraSession::handleCameraPowerUp()
+{
+    stopViewFinder();
+    startViewFinder();
+}
+
 bool BbCameraSession::openCamera()
 {
     if (m_handle != CAMERA_HANDLE_INVALID) // camera is already open
@@ -1011,6 +1017,9 @@ static void viewFinderStatusCallback(camera_handle_t handle, camera_devstatus_t
     if (status == CAMERA_STATUS_FOCUS_CHANGE) {
         BbCameraSession *session = static_cast<BbCameraSession*>(context);
         QMetaObject::invokeMethod(session, "handleFocusStatusChanged", Qt::QueuedConnection, Q_ARG(int, value));
+    } else if (status == CAMERA_STATUS_POWERUP) {
+        BbCameraSession *session = static_cast<BbCameraSession*>(context);
+        QMetaObject::invokeMethod(session, "handleCameraPowerUp", Qt::QueuedConnection);
     }
 }
 
index 647e324..15126ee 100644 (file)
@@ -177,6 +177,7 @@ private slots:
     void handleVideoRecordingPaused();
     void handleVideoRecordingResumed();
     void deviceOrientationChanged(int);
+    void handleCameraPowerUp();
 
 private:
     bool openCamera();