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>
This commit is contained in:
Tobias Koenig
2013-10-23 18:04:58 +02:00
committed by The Qt Project
parent e3bd0333de
commit a2f9f25d85
2 changed files with 7 additions and 9 deletions

View File

@@ -165,10 +165,8 @@ void BbCameraSession::setState(QCamera::State state)
} }
} else if (state == QCamera::ActiveState) { } else if (state == QCamera::ActiveState) {
if (openCamera()) { if (openCamera()) {
applyConfiguration(); QMetaObject::invokeMethod(this, "applyConfiguration", Qt::QueuedConnection);
if (startViewFinder()) { m_state = state;
m_state = state;
}
} }
} }
} else if (previousState == QCamera::LoadedState) { } else if (previousState == QCamera::LoadedState) {
@@ -176,10 +174,8 @@ void BbCameraSession::setState(QCamera::State state)
closeCamera(); closeCamera();
m_state = state; m_state = state;
} else if (state == QCamera::ActiveState) { } else if (state == QCamera::ActiveState) {
applyConfiguration(); QMetaObject::invokeMethod(this, "applyConfiguration", Qt::QueuedConnection);
if (startViewFinder()) { m_state = state;
m_state = state;
}
} }
} else if (previousState == QCamera::ActiveState) { } else if (previousState == QCamera::ActiveState) {
if (state == QCamera::LoadedState) { if (state == QCamera::LoadedState) {
@@ -1157,6 +1153,8 @@ void BbCameraSession::applyConfiguration()
} else if (m_captureMode & QCamera::CaptureVideo) { } else if (m_captureMode & QCamera::CaptureVideo) {
applyVideoSettings(); applyVideoSettings();
} }
startViewFinder();
} }
static void videoRecordingStatusCallback(camera_handle_t handle, camera_devstatus_t status, uint16_t value, void *context) static void videoRecordingStatusCallback(camera_handle_t handle, camera_devstatus_t status, uint16_t value, void *context)

View File

@@ -176,13 +176,13 @@ private slots:
void deviceOrientationChanged(int); void deviceOrientationChanged(int);
void handleCameraPowerUp(); void handleCameraPowerUp();
void viewfinderFrameGrabbed(const QImage &image); void viewfinderFrameGrabbed(const QImage &image);
void applyConfiguration();
private: private:
bool openCamera(); bool openCamera();
void closeCamera(); void closeCamera();
bool startViewFinder(); bool startViewFinder();
void stopViewFinder(); void stopViewFinder();
void applyConfiguration();
bool startVideoRecording(); bool startVideoRecording();
void stopVideoRecording(); void stopVideoRecording();