Move imageIcon and videoIcon to CameraTheme
authorMohammed Sameer <msameer@foolab.org>
Sat, 3 Aug 2013 19:12:33 +0000 (22:12 +0300)
committerMohammed Sameer <msameer@foolab.org>
Sat, 3 Aug 2013 19:24:24 +0000 (22:24 +0300)
qml/ImageOverlay.qml
qml/VideoOverlay.qml
qml/data.js
qml/harmattan/CameraTheme.qml

index 20becc2..18e7c9b 100644 (file)
@@ -181,7 +181,7 @@ Item {
                 id: resolutionIndicator
                 property string imageAspectRatio: settings.device == 1 ? settings.secondaryImageAspectRatio : settings.primaryImageAspectRatio
                 property string imageResolution: settings.device == 1 ? settings.secondaryImageResolution : settings.primaryImageResolution
-                source: "image://theme/" + Data.imageIcon(imageAspectRatio, imageResolution)
+                source: "image://theme/" + cameraTheme.imageIcon(imageAspectRatio, imageResolution, settings.device)
             }
 
             Indicator {
index 9bce237..3e46aaa 100644 (file)
@@ -150,7 +150,8 @@ Item {
             Indicator {
                 id: resolutionIndicator
                 property string videoResolution: settings.device == 1 ? settings.secondaryVideoResolution : settings.primaryVideoResolution
-                source: "image://theme/" + Data.videoIcon(videoResolution)
+                property string videoRatio: settings.device == 1 ? settings.secondaryVideoAspectRatio : settings.primaryVideoAspectRatio
+                source: "image://theme/" + cameraTheme.videoIcon(videoRatio, videoResolution, settings.device)
             }
 
             Indicator {
index 620a97a..59078f2 100644 (file)
@@ -74,26 +74,6 @@ 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"],
-    ["3:2", "high", "icon-m-camera-resolution-7m"],
-    ["4:3", "low", "icon-m-camera-resolution-3m"],
-    ["4:3", "medium", "icon-m-camera-resolution-6m"],
-    ["4:3", "high", "icon-m-camera-resolution-8m"],
-    ["16:9", "low", "icon-m-camera-resolution-3m"],
-    ["16:9", "medium", "icon-m-camera-resolution-6m"],
-    ["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"],
-    ["high", "icon-m-camera-video-high-resolution"],
-];
-
 function filterData(val, data, item) {
     var x = 0;
     var i = data.length;
@@ -124,22 +104,6 @@ function isoIcon(value) {
     return filterData(value, __iso, 1);
 }
 
-function imageIcon(aspect, res) {
-    var x = 0;
-    var len = __image.length;
-    for (x = 0; x < len; x++) {
-       if (__image[x][0] == aspect && __image[x][1] == res) {
-           return __image[x][2];
-       }
-    }
-
-    return "";
-}
-
-function videoIcon(res) {
-    return filterData(res, __video, 1);
-}
-
 function flashIcon(val) {
     return filterData(val, __flash, 1);
 }
index 3ab34d2..14a05dd 100644 (file)
@@ -71,4 +71,40 @@ QtObject {
     property string 
     property string 
 */
+
+    function videoIcon(ratio, res, device) {
+        if (res == "high") {
+            return "icon-m-camera-video-high-resolution"
+        } else if (res == "medium") {
+            return "icon-m-camera-video-fine-resolution"
+        } else if (res == "low") {
+            return "icon-m-camera-video-low-resolution"
+        } else {
+            return ""
+        }
+    }
+
+    property variant __imageData: [
+        ["3:2", "low", "icon-m-camera-resolution-3m"],
+        ["3:2", "medium", "icon-m-camera-resolution-6m"],
+        ["3:2", "high", "icon-m-camera-resolution-7m"],
+        ["4:3", "low", "icon-m-camera-resolution-3m"],
+        ["4:3", "medium", "icon-m-camera-resolution-6m"],
+        ["4:3", "high", "icon-m-camera-resolution-8m"],
+        ["16:9", "low", "icon-m-camera-resolution-3m"],
+        ["16:9", "medium", "icon-m-camera-resolution-6m"],
+        ["16:9", "high", "icon-m-camera-resolution-7m"]
+    ]
+
+    function imageIcon(ratio, res, device) {
+        var x = 0
+        var len = __imageData.length
+        for (x = 0; x < len; x++) {
+            if (__imageData[x][0] == ratio && __imageData[x][1] == res) {
+                return __imageData[x][2]
+            }
+        }
+
+        return ""
+    }
 }
\ No newline at end of file