summaryrefslogtreecommitdiff
path: root/src/plugins/winrt
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2016-11-07 12:35:46 +0100
committerYoann Lopes <yoann.lopes@qt.io>2016-11-07 13:56:41 +0000
commit50fc654aaf25b98e15148ecc9017e1eb529cd925 (patch)
tree17ab89a2cf6ac4c789490da8097830578d41b67a /src/plugins/winrt
parent77e6d1cc403d69c509206fd0c0ba4f589277e212 (diff)
downloadqtmultimedia-50fc654aaf25b98e15148ecc9017e1eb529cd925.tar.gz
winrt: Fixed emission of readyForCaptureChanged
The signal should only be emitted if the state of readyForCapture has actually changed. Change-Id: I4a4e2bf4451cd970f460813b2bdb32685067c453 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
Diffstat (limited to 'src/plugins/winrt')
-rw-r--r--src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp25
-rw-r--r--src/plugins/winrt/qwinrtcameraimagecapturecontrol.h2
2 files changed, 17 insertions, 10 deletions
diff --git a/src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp b/src/plugins/winrt/qwinrtcameraimagecapturecontrol.cpp
index 3f2c9ffa3..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::updateReadyForCapture);
+ 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,9 +216,15 @@ void QWinRTCameraImageCaptureControl::cancelCapture()
emit captureQueueChanged(true);
}
-void QWinRTCameraImageCaptureControl::updateReadyForCapture(QCamera::State state)
+void QWinRTCameraImageCaptureControl::onCameraStateChanged(QCamera::State state)
{
- emit readyForCaptureChanged(state != QCamera::UnloadedState);
+ 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)
diff --git a/src/plugins/winrt/qwinrtcameraimagecapturecontrol.h b/src/plugins/winrt/qwinrtcameraimagecapturecontrol.h
index 4cbba0444..3820bfaf1 100644
--- a/src/plugins/winrt/qwinrtcameraimagecapturecontrol.h
+++ b/src/plugins/winrt/qwinrtcameraimagecapturecontrol.h
@@ -73,7 +73,7 @@ public:
void cancelCapture() Q_DECL_OVERRIDE;
private slots:
- void updateReadyForCapture(QCamera::State state);
+ void onCameraStateChanged(QCamera::State state);
signals:
void captureQueueChanged(bool isEmpty);