b91715397c153b8ba77b94fd1f622be4f8cdb8b9
[harmattan/cameraplus] / qml / ColorToneButton.qml
1 // -*- qml -*-
2 import QtQuick 1.1
3 import com.nokia.meego 1.1
4 import QtCamera 1.0
5
6
7 Selector {
8         id: button
9
10         property alias value: ct.value
11
12         timerConstraints: true // Never trigger
13
14         iconSource: ctIcon(ct.value);
15
16         title: qsTr("Color filter");
17
18         ColorTone {
19                 id: ct
20                 camera: cam
21                 // TODO: hardcoding
22                 value: ColorTone.Normal
23         }
24
25         function ctIcon(val) {
26                 var x = row.children.length;
27                 var i = 0;
28                 for (i = 0; i < x; i++) {
29                         if (row.children[i].value == val) {
30                                 return row.children[i].normalIcon;
31                         }
32                 }
33         }
34
35         widget: Row {
36                 id: row
37                 height: button.checked ? 64 : 0
38                 width: button.checked ? (children.length * height) +  (children.length - 1) * spacing : 0
39                 spacing: 10
40
41                 Behavior on width {
42                         // TODO: seems animation is not working
43                         PropertyAnimation { duration: 250; }
44                 }
45
46                 CheckButton {
47                         normalIcon: "image://theme/icon-m-camera-no-filter"
48                         checkedIcon: "image://theme/icon-m-camera-no-filter-selected"
49                         controller: ct
50                         value: ColorTone.Normal
51                         doClose: false
52                 }
53
54                 CheckButton {
55                         normalIcon: "image://theme/icon-m-camera-filter-black-white"
56                         checkedIcon: "image://theme/icon-m-camera-filter-black-white-selected"
57                         controller: ct
58                         value: ColorTone.GrayScale
59                         doClose: false
60                 }
61
62                 CheckButton {
63                         normalIcon: "image://theme/icon-m-camera-filter-sepia"
64                         checkedIcon: "image://theme/icon-m-camera-filter-sepia-selected"
65                         controller: ct
66                         value: ColorTone.Sepia
67                         doClose: false
68                 }
69
70                 CheckButton {
71                         normalIcon: "image://theme/icon-m-camera-filter-vivid"
72                         checkedIcon: "image://theme/icon-m-camera-filter-vivid-selected"
73                         controller: ct
74                         value: ColorTone.Vivid
75                         doClose: false
76                 }
77
78                 CheckButton {
79                         normalIcon: "image://theme/icon-m-camera-filter-negative"
80                         checkedIcon: "image://theme/icon-m-camera-filter-negative-selected"
81                         controller: ct
82                         value: ColorTone.Negative
83                         doClose: false
84                 }
85
86                 CheckButton {
87                         normalIcon: "image://theme/icon-m-camera-filter-solarize"
88                         checkedIcon: "image://theme/icon-m-camera-filter-solarize-selected"
89                         controller: ct
90                         value: ColorTone.Solarize
91                         doClose: false
92                 }
93         }
94 }