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:
committed by
The Qt Project
parent
e3bd0333de
commit
a2f9f25d85
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user