X-Git-Url: http://cgit.sxemacs.org/?p=harmattan%2Fcameraplus;a=blobdiff_plain;f=qml%2Fdata.js;h=b3481ef6fcbd053c552a02b3ccacbe0767614426;hp=90f87ec7355295a952e851db3bbafd6fb86f1ce1;hb=6d882ccfda5ef536140c82884feecf0ce4a905f5;hpb=5bf5f4b6c8c6b23bd2e1c6d2169f6db1d8997a7c diff --git a/qml/data.js b/qml/data.js index 90f87ec..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,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"], @@ -65,6 +93,26 @@ 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,13 +172,29 @@ function vsmName(sm) { } function isoIcon(value) { + return filterData(value, __iso, 1); +} + +function imageIcon(aspect, res) { var x = 0; - var len = __iso.length; + var len = __image.length; for (x = 0; x < len; x++) { - if (__iso[x][0] == value) { - return __iso[x][1]; + 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); +}