summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJing Bai <jing.bai@digia.com>2012-12-13 14:00:02 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-19 17:55:08 +0100
commit13ecd7171b4876bcf5027f9b349781b6dd9be790 (patch)
treeeff24af92470e83bfb959131b567baf6a76ce8c1
parentd396262bc9771cacbc71e79215768984fa1974ff (diff)
downloadqtmultimedia-13ecd7171b4876bcf5027f9b349781b6dd9be790.tar.gz
add error handling in image capturing in camera
Task-number: QTBUG-28589 Change-Id: Ib3a04038c16beba66f8b8cff85b310dad9a4460a Reviewed-by: Andy Nichols <andy.nichols@digia.com>
-rw-r--r--examples/multimediawidgets/camera/camera.cpp10
-rw-r--r--examples/multimediawidgets/camera/camera.h1
-rw-r--r--examples/multimediawidgets/camera/camera.ui5
3 files changed, 15 insertions, 1 deletions
diff --git a/examples/multimediawidgets/camera/camera.cpp b/examples/multimediawidgets/camera/camera.cpp
index 9c1f2902e..2b7a96f82 100644
--- a/examples/multimediawidgets/camera/camera.cpp
+++ b/examples/multimediawidgets/camera/camera.cpp
@@ -136,6 +136,8 @@ void Camera::setCamera(const QByteArray &cameraDevice)
connect(imageCapture, SIGNAL(readyForCaptureChanged(bool)), this, SLOT(readyForCapture(bool)));
connect(imageCapture, SIGNAL(imageCaptured(int,QImage)), this, SLOT(processCapturedImage(int,QImage)));
connect(imageCapture, SIGNAL(imageSaved(int,QString)), this, SLOT(imageSaved(int,QString)));
+ connect(imageCapture, SIGNAL(error(int,QCameraImageCapture::Error,QString)), this,
+ SLOT(displayCaptureError(int,QCameraImageCapture::Error,QString)));
connect(camera, SIGNAL(lockStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)),
this, SLOT(updateLockStatus(QCamera::LockStatus, QCamera::LockChangeReason)));
@@ -320,6 +322,14 @@ void Camera::takeImage()
imageCapture->capture();
}
+void Camera::displayCaptureError(int id, const QCameraImageCapture::Error error, const QString &errorString)
+{
+ Q_UNUSED(id);
+ Q_UNUSED(error);
+ QMessageBox::warning(this, tr("Image Capture Error"), errorString);
+ isCapturingImage = false;
+}
+
void Camera::startCamera()
{
camera->start();
diff --git a/examples/multimediawidgets/camera/camera.h b/examples/multimediawidgets/camera/camera.h
index 9203216b3..52f03cbd3 100644
--- a/examples/multimediawidgets/camera/camera.h
+++ b/examples/multimediawidgets/camera/camera.h
@@ -72,6 +72,7 @@ private slots:
void toggleLock();
void takeImage();
+ void displayCaptureError(int, QCameraImageCapture::Error, const QString &errorString);
void configureCaptureSettings();
void configureVideoSettings();
diff --git a/examples/multimediawidgets/camera/camera.ui b/examples/multimediawidgets/camera/camera.ui
index ea790fab0..8a5ee519c 100644
--- a/examples/multimediawidgets/camera/camera.ui
+++ b/examples/multimediawidgets/camera/camera.ui
@@ -138,6 +138,9 @@
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="takeImageButton">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="text">
<string>Capture Photo</string>
</property>
@@ -245,7 +248,7 @@
<x>0</x>
<y>0</y>
<width>668</width>
- <height>29</height>
+ <height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">