Added copyright headers and COPYING file.
[harmattan/cameraplus] / qml / ImageSceneButton.qml
1 // -*- qml -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012 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 import QtQuick 1.1
24 import com.nokia.meego 1.1
25 import QtCamera 1.0
26 import "data.js" as Data
27
28 Selector {
29         id: button
30
31         property int value: settings.imageSceneMode
32
33         iconSource: sceneIcon(scene.value);
34
35         title: qsTr("Scene mode");
36
37         function sceneIcon(val) {
38                 // TODO: use the js functions.
39                 var x = row.children.length;
40                 var i = 0;
41                 for (i = 0; i < x; i++) {
42                         if (row.children[i].value == val) {
43                                 return row.children[i].normalIcon;
44                         }
45                 }
46         }
47
48         widget: Row {
49                 id: row
50                 height: button.checked ? 64 : 0
51                 width: button.checked ? (children.length * height) +  (children.length - 1) * spacing : 0
52                 spacing: 10
53
54                 Behavior on width {
55                         // TODO: seems animation is not working
56                         PropertyAnimation { duration: 250; }
57                 }
58
59                 CheckButton {
60                         normalIcon: "image://theme/" + Data.ismIcon(value);
61                         checkedIcon: "image://theme/" + Data.ismSelectedIcon(value);
62                         savedValue: settings.imageSceneMode
63                         onClicked: settings.imageSceneMode = value;
64                         value: Scene.Auto
65                 }
66
67                 CheckButton {
68                         normalIcon: "image://theme/" + Data.ismIcon(value);
69                         checkedIcon: "image://theme/" + Data.ismSelectedIcon(value);
70                         savedValue: settings.imageSceneMode
71                         onClicked: settings.imageSceneMode = value;
72                         value: Scene.Closeup
73                 }
74
75                 CheckButton {
76                         normalIcon: "image://theme/" + Data.ismIcon(value);
77                         checkedIcon: "image://theme/" + Data.ismSelectedIcon(value);
78                         savedValue: settings.imageSceneMode
79                         onClicked: settings.imageSceneMode = value;
80                         value: Scene.Landscape
81                 }
82
83                 CheckButton {
84                         normalIcon: "image://theme/" + Data.ismIcon(value);
85                         checkedIcon: "image://theme/" + Data.ismSelectedIcon(value);
86                         savedValue: settings.imageSceneMode
87                         onClicked: settings.imageSceneMode = value;
88                         value: Scene.Portrait
89                 }
90
91                 CheckButton {
92                         normalIcon: "image://theme/" + Data.ismIcon(value);
93                         checkedIcon: "image://theme/" + Data.ismSelectedIcon(value);
94                         savedValue: settings.imageSceneMode
95                         onClicked: settings.imageSceneMode = value;
96                         value: Scene.Night
97                 }
98
99                 CheckButton {
100                         normalIcon: "image://theme/" + Data.ismIcon(value);
101                         checkedIcon: "image://theme/" + Data.ismSelectedIcon(value);
102                         savedValue: settings.imageSceneMode
103                         onClicked: settings.imageSceneMode = value;
104                         value: Scene.Sport
105                 }
106         }
107 }