diff options
Diffstat (limited to 'src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp')
-rw-r--r-- | src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp b/src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp index 177a0731c..54f4b103b 100644 --- a/src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp +++ b/src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp @@ -109,15 +109,16 @@ struct CaptureRequest class QWinRTCameraImageCaptureControlPrivate { public: + QWinRTCameraImageCaptureControlPrivate() + : isActive(false) + { + } + QPointer<QWinRTCameraControl> cameraControl; QHash<IAsyncAction *, CaptureRequest> requests; quint16 currentCaptureId; QMediaStorageLocation location; - - void onCameraStateChanged() - { - - } + bool isActive; }; QWinRTCameraImageCaptureControl::QWinRTCameraImageCaptureControl(QWinRTCameraControl *parent) @@ -128,14 +129,14 @@ QWinRTCameraImageCaptureControl::QWinRTCameraImageCaptureControl(QWinRTCameraCon d->cameraControl = parent; connect(d->cameraControl, &QCameraControl::stateChanged, - this, &QWinRTCameraImageCaptureControl::readyForCaptureChanged); + this, &QWinRTCameraImageCaptureControl::onCameraStateChanged); d->currentCaptureId = 0; } bool QWinRTCameraImageCaptureControl::isReadyForCapture() const { Q_D(const QWinRTCameraImageCaptureControl); - return d->cameraControl->state() == QCamera::ActiveState; + return d->isActive; } QCameraImageCapture::DriveMode QWinRTCameraImageCaptureControl::driveMode() const @@ -215,6 +216,17 @@ void QWinRTCameraImageCaptureControl::cancelCapture() emit captureQueueChanged(true); } +void QWinRTCameraImageCaptureControl::onCameraStateChanged(QCamera::State state) +{ + Q_D(QWinRTCameraImageCaptureControl); + const bool newActive = state == QCamera::ActiveState; + if (d->isActive == newActive) + return; + + d->isActive = newActive; + emit readyForCaptureChanged(newActive); +} + HRESULT QWinRTCameraImageCaptureControl::onCaptureCompleted(IAsyncAction *asyncInfo, AsyncStatus status) { qCDebug(lcMMCamera) << __FUNCTION__; |