X-Git-Url: http://cgit.sxemacs.org/?p=harmattan%2Fcameraplus;a=blobdiff_plain;f=qml%2Fdata.js;h=b3481ef6fcbd053c552a02b3ccacbe0767614426;hp=6a5c3f6982297df8d69745dd4af2b5a358ac8dfc;hb=6d882ccfda5ef536140c82884feecf0ce4a905f5;hpb=53be0b21b24e82e9f069d5153318266e7446ece4 diff --git a/qml/data.js b/qml/data.js index 6a5c3f6..b3481ef 100644 --- a/qml/data.js +++ b/qml/data.js @@ -1,5 +1,25 @@ // -*- js -*- +/*! + * This file is part of CameraPlus. + * + * Copyright (C) 2012-2013 Mohammed Sameer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + // Shared between all QML components //.pragma library @@ -57,6 +77,42 @@ 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"], + [200, "icon-m-camera-iso-200"], + [400, "icon-m-camera-iso-400"], + [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; @@ -114,3 +170,31 @@ function vsmSelectedIcon(sm) { function vsmName(sm) { return filterData(sm, __vsm, 1); } + +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, 2); +} + +function flashPressedIcon(val) { + return filterData(val, __flash, 1); +}