Request theme icons instead of hardcoding paths
[harmattan/cameraplus] / qml / WhiteBalanceButton.qml
1 // -*- qml -*-
2 import QtQuick 1.1
3 import com.nokia.meego 1.1
4 import QtCamera 1.0
5
6 Selector {
7         id: button
8
9         property alias value: wb.value
10
11         timerConstraints: true // Never trigger
12
13         iconSource: wbIcon(wb.value);
14
15         title: qsTr("White balance mode");
16
17         WhiteBalance {
18                 id: wb
19                 camera: cam
20                 // TODO: hardcoding
21                 value: WhiteBalance.Auto
22         }
23
24         function wbIcon(val) {
25                 var x = row.children.length;
26                 var i = 0;
27                 for (i = 0; i < x; i++) {
28                         if (row.children[i].value == val) {
29                                 return row.children[i].normalIcon;
30                         }
31                 }
32         }
33
34         widget: Row {
35                 id: row
36                 height: button.checked ? 64 : 0
37                 width: button.checked ? (children.length * height) +  (children.length - 1) * spacing : 0
38                 spacing: 10
39
40                 Behavior on width {
41                         // TODO: seems animation is not working
42                         PropertyAnimation { duration: 250; }
43                 }
44
45                 CheckButton {
46                         normalIcon: "image://theme/icon-m-camera-whitebalance-auto"
47                         checkedIcon: "image://theme/icon-m-camera-whitebalance-auto-selected"
48                         controller: wb
49                         value: WhiteBalance.Auto
50                         doClose: false
51                 }
52
53                 CheckButton {
54                         normalIcon: "image://theme/icon-m-camera-whitebalance-cloudy"
55                         checkedIcon: "image://theme/icon-m-camera-whitebalance-cloudy-selected"
56                         controller: wb
57                         value: WhiteBalance.Cloudy
58                         doClose: false
59                 }
60
61                 CheckButton {
62                         normalIcon: "image://theme/icon-m-camera-whitebalance-sunny"
63                         checkedIcon: "image://theme/icon-m-camera-whitebalance-sunny-selected"
64                         controller: wb
65                         value: WhiteBalance.Sunset
66                         doClose: false
67                 }
68
69                 CheckButton {
70                         normalIcon: "image://theme/icon-m-camera-whitebalance-tungsten"
71                         checkedIcon: "image://theme/icon-m-camera-whitebalance-tungsten-selected"
72                         controller: wb
73                         value: WhiteBalance.Tungsten
74                         doClose: false
75                 }
76
77                 CheckButton {
78                         normalIcon: "image://theme/icon-m-camera-whitebalance-fluorescent"
79                         checkedIcon: "image://theme/icon-m-camera-whitebalance-fluorescent-selected"
80                         controller: wb
81                         value: WhiteBalance.Flourescent
82                         doClose: false
83                 }
84
85         }
86 }