Show an error if we fail to start the camera pipeline
authorMohammed Sameer <msameer@foolab.org>
Sun, 9 Sep 2012 22:54:36 +0000 (01:54 +0300)
committerMohammed Sameer <msameer@foolab.org>
Sun, 9 Sep 2012 23:02:11 +0000 (02:02 +0300)
qml/main.qml

index b3f0829..c5ab62a 100644 (file)
@@ -1,6 +1,7 @@
 // -*- qml -*-
 import QtQuick 1.1
 import com.nokia.meego 1.1
+import com.nokia.extras 1.1
 import QtCamera 1.0
 import CameraPlus 1.0
 
@@ -32,6 +33,15 @@ PageStackWindow {
                 }
         }
 
+        function showError(msg) {
+                error.text = msg;
+                error.show();
+        }
+
+        InfoBanner {
+                id: error
+        }
+
         Settings {
                 id: settings
         }
@@ -74,7 +84,9 @@ PageStackWindow {
                 target: platformWindow
                 onActiveChanged: {
                         if (platformWindow.active) {
-                                cam.start();
+                                if (!cam.start()) {
+                                        showError("Camera failed to start. Please restart the camera.");
+                                }
                         }
                         else {
                                 // This is a noop if camera is not idle so calling it will not hurt