Cleaned up unused icon ids
[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, qsTr("Automatic"), "icon-m-camera-whitebalance-auto"],
29     [WhiteBalance.Sunset, qsTr("Sunny"), "icon-m-camera-whitebalance-sunny"],
30     [WhiteBalance.Cloudy, qsTr("Cloudy"), "icon-m-camera-whitebalance-cloudy"],
31     [WhiteBalance.Flourescent, qsTr("Flourescent"), "icon-m-camera-whitebalance-fluorescent"],
32     [WhiteBalance.Tungsten, qsTr("Tungsten"), "icon-m-camera-whitebalance-tungsten"],
33 ];
34
35 // Color Filter
36 var __cf = [
37     [ColorTone.Normal, qsTr("Off"), "icon-m-camera-no-filter"],
38     [ColorTone.GrayScale, qsTr("Black & white"), "icon-m-camera-filter-black-white"],
39     [ColorTone.Sepia, qsTr("Sepia"), "icon-m-camera-filter-sepia"],
40     [ColorTone.Vivid, qsTr("Vivid"), "icon-m-camera-filter-vivid"],
41     [ColorTone.Negative, qsTr("Negative"), "icon-m-camera-filter-negative"],
42     [ColorTone.Solarize, qsTr("Solarize"), "icon-m-camera-filter-solarize"]
43 ];
44
45 // Image Scene Mode
46 var __ism = [
47     [Scene.Auto, qsTr("Automatic"), "icon-m-camera-scene-auto"],
48     [Scene.Closeup, qsTr("Macro"), "icon-m-camera-scene-macro"],
49     [Scene.Landscape, qsTr("Landscape"), "icon-m-camera-scene-landscape"],
50     [Scene.Portrait, qsTr("Portrait"), "icon-m-camera-scene-portrait"],
51     [Scene.Night, qsTr("Night"), "icon-m-camera-night"],
52     [Scene.Sport, qsTr("Sports"), "icon-m-camera-scene-sports"]
53 ];
54
55 // Video Scene Mode
56 var __vsm = [
57     [Scene.Auto, qsTr("Automatic"), "icon-m-camera-scene-auto"],
58     [Scene.Night, qsTr("Video at 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, 2);
109 }
110
111 function wbName(wb) {
112     return filterData(wb, __wb, 1);
113 }
114
115 function cfIcon(cf) {
116     return filterData(cf, __cf, 2);
117 }
118
119 function cfName(cf) {
120     return filterData(cf, __cf, 1);
121 }
122
123 function ismIcon(sm) {
124     return filterData(sm, __ism, 2);
125 }
126
127 function ismName(sm) {
128     return filterData(sm, __ism, 1);
129 }
130
131 function vsmIcon(sm) {
132     return filterData(sm, __vsm, 2);
133 }
134
135 function vsmName(sm) {
136     return filterData(sm, __vsm, 1);
137 }
138
139 function isoIcon(value) {
140     return filterData(value, __iso, 1);
141 }
142
143 function imageIcon(aspect, res) {
144     var x = 0;
145     var len = __image.length;
146     for (x = 0; x < len; x++) {
147         if (__image[x][0] == aspect && __image[x][1] == res) {
148             return __image[x][2];
149         }
150     }
151
152     return "";
153 }
154
155 function videoIcon(res) {
156     return filterData(res, __video, 1);
157 }
158
159 function flashIcon(val) {
160     return filterData(val, __flash, 1);
161 }