Stop video playback when we lose policy resources
[harmattan/cameraplus] / qml / data.js
index 58b2c8a..b3481ef 100644 (file)
@@ -3,7 +3,7 @@
 /*!
  * This file is part of CameraPlus.
  *
- * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -77,6 +77,14 @@ var __vsm = [
      "icon-m-camera-video-night-selected", "icon-m-camera-video-night"]
 ];
 
+var __flash = [
+    [Flash.Auto,"icon-m-camera-flash-auto-selected", "icon-m-camera-flash-auto"],
+    [Flash.On, "icon-m-camera-flash-always-selected", "icon-m-camera-flash-always"],
+    [Flash.Off, "icon-m-camera-flash-off-selected", "icon-m-camera-flash-off"],
+    [Flash.RedEye, "icon-m-camera-flash-red-eye-selected", "icon-m-camera-flash-red-eye"]
+];
+
+// ISO
 var __iso = [
     [0, "icon-m-camera-iso-auto"],
     [100, "icon-m-camera-iso-100"],
@@ -85,6 +93,7 @@ var __iso = [
     [800, "icon-m-camera-iso-800"]
 ];
 
+// Image resolutions
 var __image = [
     ["3:2", "low", "icon-m-camera-resolution-3m"],
     ["3:2", "medium", "icon-m-camera-resolution-6m"],
@@ -97,6 +106,7 @@ var __image = [
     ["16:9", "high", "icon-m-camera-resolution-7m"]
 ];
 
+// Video resolutions
 var __video = [
     ["low", "icon-m-camera-video-low-resolution"],
     ["medium", "icon-m-camera-video-fine-resolution"],
@@ -162,15 +172,7 @@ function vsmName(sm) {
 }
 
 function isoIcon(value) {
-    var x = 0;
-    var len = __iso.length;
-    for (x = 0; x < len; x++) {
-       if (__iso[x][0] == value) {
-           return __iso[x][1];
-       }
-    }
-
-    return "";
+    return filterData(value, __iso, 1);
 }
 
 function imageIcon(aspect, res) {
@@ -188,3 +190,11 @@ function imageIcon(aspect, res) {
 function videoIcon(res) {
     return filterData(res, __video, 1);
 }
+
+function flashIcon(val) {
+    return filterData(val, __flash, 2);
+}
+
+function flashPressedIcon(val) {
+    return filterData(val, __flash, 1);
+}