More work on image settings page. Now color filter and white balance are fine
[harmattan/cameraplus] / qml / ImageSettingsPage.qml
1 // -*- qml -*-
2 import QtQuick 1.1
3 import com.nokia.meego 1.1
4 import QtCamera 1.0
5
6 Page {
7         id: page
8         property Camera cam: null
9
10         property variant __wb: [
11         [WhiteBalance.Auto, qsTr("Automatic"), "icon-m-camera-whitebalance-auto-selected"],
12         [WhiteBalance.Sunset, qsTr("Sunny"), "icon-m-camera-whitebalance-sunny-selected"],
13         [WhiteBalance.Cloudy, qsTr("Cloudy"), "icon-m-camera-whitebalance-cloudy-selected"],        [WhiteBalance.Flourescent, qsTr("Flourescent"), "icon-m-camera-whitebalance-fluorescent-selected"],
14         [WhiteBalance.Tungsten, qsTr("Tungsten"), "icon-m-camera-whitebalance-tungsten-selected"],
15         ]
16
17         property variant __cf: [
18         [ColorTone.Normal, qsTr("Off"), "icon-m-camera-no-filter-selected"],
19         [ColorTone.GrayScale, qsTr("Black & white"), "icon-m-camera-filter-black-white-selected"],
20         [ColorTone.Sepia, qsTr("Sepia"), "icon-m-camera-filter-sepia-selected"],
21         [ColorTone.Vivid, qsTr("Vivid"), "icon-m-camera-filter-vivid-selected"],
22         [ColorTone.Negative, qsTr("Negative"), "icon-m-camera-filter-negative-selected"],
23         [ColorTone.Solarize, qsTr("Solarize"), "icon-m-camera-filter-solarize-selected"]
24         ]
25
26         function filterData(val, data, item) {
27                 var x = 0;
28                 var i = data.length;
29                 for (x = 0; x < i; x++) {
30                         if (data[x][0] == val) {
31                                 return data[x][item];
32                         }
33                 }
34         }
35
36         function wbIcon(wb) {
37                 return filterData(wb, __wb, 2);
38         }
39
40         function wbName(wb) {
41                 return filterData(wb, __wb, 1);
42         }
43
44         function cfIcon(cf) {
45                 return filterData(cf, __cf, 2);
46         }
47
48         function cfName(cf) {
49                 return filterData(cf, __cf, 1);
50         }
51
52         Rectangle {
53                 color: "black"
54                 anchors.fill: parent
55         }
56
57         Flickable {
58                 anchors.top: parent.top
59                 anchors.left: parent.left
60                 anchors.right: parent.right
61                 anchors.bottom: toolBar.top
62
63                 Column {
64                         width: parent.width
65
66                         Label {
67                                 // TODO:
68                                 text: qsTr("Image settings");
69                         }
70
71                         Row {
72                                 width: parent.width
73
74                                 ListItem {
75                                         id: wb
76                                         width: parent.width / 2
77                                         title: qsTr("White balance");
78                                         subtitle: wbName(settings.imageWhiteBalance);
79                                         iconId: wbIcon(settings.imageWhiteBalance);
80                                         onClicked: openFile("ImageWhiteBalancePage.qml");
81                                 }
82
83                                 ListItem {
84                                         id: cf
85                                         width: parent.width / 2
86                                         title: qsTr("Color filter");
87                                         subtitle: cfName(settings.imageColorFilter);
88                                         iconId: cfIcon(settings.imageColorFilter);
89                                         onClicked: openFile("ImageColorFilterPage.qml");
90                                 }
91                         }
92                 }
93         }
94
95         ToolBar {
96                 id: toolBar
97                 anchors.bottom: parent.bottom
98                 tools: ToolBarLayout {
99                         id: layout
100                         ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
101                 }
102         }
103 }