diff options
author | Tobias Koenig <tobias.koenig.qnx@kdab.com> | 2013-10-23 18:04:58 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-24 16:42:25 +0200 |
commit | a2f9f25d8577fefe8358eb848da206e5ebdf4178 (patch) | |
tree | 0e32458f40da8bef22138be7d3f61365a1cebf2f /src | |
parent | e3bd0333de0b7632024cdd5e8e8833173c960549 (diff) |
Blackberry: Fix camera viewfinder
Enter the event loop between opening the camera and starting
the viewfinder window grabber. The latter needs a windowGroup
set, so in case the QCamera and QCameraViewfinder are constructed
directly/indirectly inside the main window constructor, we have to
wait for the top-level window of the application to be created, so
that we can retrieve the windowGroup from it.
Task-number: QTBUG-33739
Change-Id: Ib23781f0e4a2a07ba388e22debcb59b00509ed16
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Tobias Koenig <tobias.koenig.qnx@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/blackberry/camera/bbcamerasession.cpp | 14 | ||||
-rw-r--r-- | src/plugins/blackberry/camera/bbcamerasession.h | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/plugins/blackberry/camera/bbcamerasession.cpp b/src/plugins/blackberry/camera/bbcamerasession.cpp index 8f8e666d9..0185dccb4 100644 --- a/src/plugins/blackberry/camera/bbcamerasession.cpp +++ b/src/plugins/blackberry/camera/bbcamerasession.cpp @@ -165,10 +165,8 @@ void BbCameraSession::setState(QCamera::State state) } } else if (state == QCamera::ActiveState) { if (openCamera()) { - applyConfiguration(); - if (startViewFinder()) { - m_state = state; - } + QMetaObject::invokeMethod(this, "applyConfiguration", Qt::QueuedConnection); + m_state = state; } } } else if (previousState == QCamera::LoadedState) { @@ -176,10 +174,8 @@ void BbCameraSession::setState(QCamera::State state) closeCamera(); m_state = state; } else if (state == QCamera::ActiveState) { - applyConfiguration(); - if (startViewFinder()) { - m_state = state; - } + QMetaObject::invokeMethod(this, "applyConfiguration", Qt::QueuedConnection); + m_state = state; } } else if (previousState == QCamera::ActiveState) { if (state == QCamera::LoadedState) { @@ -1157,6 +1153,8 @@ void BbCameraSession::applyConfiguration() } else if (m_captureMode & QCamera::CaptureVideo) { applyVideoSettings(); } + + startViewFinder(); } static void videoRecordingStatusCallback(camera_handle_t handle, camera_devstatus_t status, uint16_t value, void *context) diff --git a/src/plugins/blackberry/camera/bbcamerasession.h b/src/plugins/blackberry/camera/bbcamerasession.h index f57c7dabf..f226d4245 100644 --- a/src/plugins/blackberry/camera/bbcamerasession.h +++ b/src/plugins/blackberry/camera/bbcamerasession.h @@ -176,13 +176,13 @@ private slots: void deviceOrientationChanged(int); void handleCameraPowerUp(); void viewfinderFrameGrabbed(const QImage &image); + void applyConfiguration(); private: bool openCamera(); void closeCamera(); bool startViewFinder(); void stopViewFinder(); - void applyConfiguration(); bool startVideoRecording(); void stopVideoRecording(); |