Cleaned up unused functions
[harmattan/cameraplus] / qml / data.js
1 // -*- js -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22
23 // Shared between all QML components
24 //.pragma library
25
26 // White Balance
27 var __wb = [
28     [WhiteBalance.Auto, "icon-m-camera-whitebalance-auto"],
29     [WhiteBalance.Sunset, "icon-m-camera-whitebalance-sunny"],
30     [WhiteBalance.Cloudy, "icon-m-camera-whitebalance-cloudy"],
31     [WhiteBalance.Flourescent, "icon-m-camera-whitebalance-fluorescent"],
32     [WhiteBalance.Tungsten, "icon-m-camera-whitebalance-tungsten"],
33 ];
34
35 // Color Filter
36 var __cf = [
37     [ColorTone.Normal, "icon-m-camera-no-filter"],
38     [ColorTone.GrayScale, "icon-m-camera-filter-black-white"],
39     [ColorTone.Sepia, "icon-m-camera-filter-sepia"],
40     [ColorTone.Vivid, "icon-m-camera-filter-vivid"],
41     [ColorTone.Negative, "icon-m-camera-filter-negative"],
42     [ColorTone.Solarize, "icon-m-camera-filter-solarize"]
43 ];
44
45 // Image Scene Mode
46 var __ism = [
47     [Scene.Auto, "icon-m-camera-scene-auto"],
48     [Scene.Closeup, "icon-m-camera-scene-macro"],
49     [Scene.Landscape, "icon-m-camera-scene-landscape"],
50     [Scene.Portrait, "icon-m-camera-scene-portrait"],
51     [Scene.Night, "icon-m-camera-night"],
52     [Scene.Sport, "icon-m-camera-scene-sports"]
53 ];
54
55 // Video Scene Mode
56 var __vsm = [
57     [Scene.Auto, "icon-m-camera-scene-auto"],
58     [Scene.Night, "icon-m-camera-video-night"]
59 ];
60
61 var __flash = [
62     [Flash.Auto, "icon-m-camera-flash-auto"],
63     [Flash.On, "icon-m-camera-flash-always"],
64     [Flash.Off, "icon-m-camera-flash-off"],
65     [Flash.RedEye, "icon-m-camera-flash-red-eye"]
66 ];
67
68 // ISO
69 var __iso = [
70     [0, "icon-m-camera-iso-auto"],
71     [100, "icon-m-camera-iso-100"],
72     [200, "icon-m-camera-iso-200"],
73     [400, "icon-m-camera-iso-400"],
74     [800, "icon-m-camera-iso-800"]
75 ];
76
77 // Image resolutions
78 var __image = [
79     ["3:2", "low", "icon-m-camera-resolution-3m"],
80     ["3:2", "medium", "icon-m-camera-resolution-6m"],
81     ["3:2", "high", "icon-m-camera-resolution-7m"],
82     ["4:3", "low", "icon-m-camera-resolution-3m"],
83     ["4:3", "medium", "icon-m-camera-resolution-6m"],
84     ["4:3", "high", "icon-m-camera-resolution-8m"],
85     ["16:9", "low", "icon-m-camera-resolution-3m"],
86     ["16:9", "medium", "icon-m-camera-resolution-6m"],
87     ["16:9", "high", "icon-m-camera-resolution-7m"]
88 ];
89
90 // Video resolutions
91 var __video = [
92     ["low", "icon-m-camera-video-low-resolution"],
93     ["medium", "icon-m-camera-video-fine-resolution"],
94     ["high", "icon-m-camera-video-high-resolution"],
95 ];
96
97 function filterData(val, data, item) {
98     var x = 0;
99     var i = data.length;
100     for (x = 0; x < i; x++) {
101         if (data[x][0] == val) {
102             return data[x][item];
103         }
104     }
105 }
106
107 function wbIcon(wb) {
108     return filterData(wb, __wb, 1);
109 }
110
111 function cfIcon(cf) {
112     return filterData(cf, __cf, 1);
113 }
114
115 function ismIcon(sm) {
116     return filterData(sm, __ism, 1);
117 }
118
119 function vsmIcon(sm) {
120     return filterData(sm, __vsm, 1);
121 }
122
123 function isoIcon(value) {
124     return filterData(value, __iso, 1);
125 }
126
127 function imageIcon(aspect, res) {
128     var x = 0;
129     var len = __image.length;
130     for (x = 0; x < len; x++) {
131         if (__image[x][0] == aspect && __image[x][1] == res) {
132             return __image[x][2];
133         }
134     }
135
136     return "";
137 }
138
139 function videoIcon(res) {
140     return filterData(res, __video, 1);
141 }
142
143 function flashIcon(val) {
144     return filterData(val, __flash, 1);
145 }