8b1cbcaa6a2fc086515bc589f56ace9ee4efb9eb
[harmattan/cameraplus] / qml / ImagePage.qml
1 // -*- qml -*-
2 import QtQuick 1.1
3 import com.nokia.meego 1.1
4 import QtCamera 1.0
5 import CameraPlus 1.0
6 import "data.js" as Data
7
8 CameraPage {
9         id: page
10
11         policyMode: CameraResources.Image
12         controlsVisible: capture.visible && cam.running && !standbyWidget.visible
13
14         Button {
15                 id: capture
16                 anchors.right: parent.right
17                 anchors.rightMargin: 20
18                 anchors.verticalCenter: parent.verticalCenter
19                 iconSource: "image://theme/icon-m-camera-shutter"
20                 width: 75
21                 height: 75
22                 opacity: 0.5
23                 onClicked: {
24                         if (!fileSystem.available) {
25                                 showError(qsTr("Camera cannot capture images in mass storage mode."));
26                                 return;
27                         }
28
29                         metaData.setMetaData();
30
31                         if (!imageMode.capture(fileNaming.imageFileName())) {
32                                 showError(qsTr("Failed to capture image. Please restart the camera."));
33                         }
34                 }
35
36                 visible: imageMode.canCapture && !cameraMode.animationRunning && !previewAnimationRunning && cam.running
37         }
38
39         ImageMode {
40                 id: imageMode
41                 camera: cam
42                 onPreviewAvailable: page.setPreview(preview);
43         }
44
45         FlashButton {
46                 id: flash
47                 visible: controlsVisible
48                 anchors.top: parent.top
49                 anchors.left: parent.left
50                 anchors.topMargin: 20
51                 anchors.leftMargin: 20
52         }
53
54         ImageSceneButton {
55                 id: scene
56                 visible: controlsVisible
57                 anchors.top: flash.bottom
58                 anchors.left: parent.left
59                 anchors.topMargin: 10
60                 anchors.leftMargin: 20
61         }
62
63         EvCompButton {
64                 id: evComp
65                 visible: controlsVisible
66                 anchors.top: scene.bottom
67                 anchors.left: parent.left
68                 anchors.topMargin: 10
69                 anchors.leftMargin: 20
70         }
71
72         Indicators {
73                 visible: controlsVisible
74                 anchors.bottom: parent.bottom
75                 anchors.bottomMargin: 20
76                 anchors.left: parent.left
77                 anchors.leftMargin: 20
78
79                 onClicked: openFile("ImageSettingsPage.qml");
80
81 //                Label {
82                 // TODO:
83                         // resolution
84 //                }
85
86                 Indicator {
87                         id: wbIndicator
88                         source: "image://theme/" + Data.wbIcon(settings.imageWhiteBalance) + "-screen"
89                         width: parent.width
90                         height: width
91                         visible: settings.imageWhiteBalance != WhiteBalance.Auto
92                 }
93
94                 Indicator {
95                         id: cfIndicator
96                         anchors.top: wbIndicator.bottom
97                         source: "image://theme/" + Data.cfIcon(settings.imageColorFilter) + "-screen"
98                         width: parent.width
99                         height: width
100                         visible: settings.imageColorFilter != ColorTone.Normal
101                 }
102
103                 Indicator {
104                         id: isoIndicator
105                         width: parent.width
106                         height: width
107                         visible: settings.imageIso != 0
108                         source: "image://theme/" + Data.isoIcon(settings.imageIso);
109                         anchors.top: cfIndicator.bottom
110                 }
111
112                 Indicator {
113                         id: gpsIndicator
114                         width: parent.width
115                         height: width
116                         anchors.top: isoIndicator.bottom
117                         visible: settings.useGps
118                         source: "image://theme/icon-m-camera-location"
119
120                         PropertyAnimation on opacity  {
121                                 easing.type: Easing.OutSine
122                                 loops: Animation.Infinite
123                                 from: 0.2
124                                 to: 1.0
125                                 duration: 1000
126                                 running: settings.useGps && !positionSource.position.longitudeValid
127                                 alwaysRunToEnd: true
128                         }
129                 }
130         }
131
132         Button {
133                 id: cameraRoll
134                 anchors.top: parent.top
135                 anchors.right: parent.right
136                 anchors.topMargin: 20
137                 anchors.rightMargin: 20
138                 width: 56
139                 height: 56
140
141                 opacity: 0.5
142                 iconSource: "image://theme/icon-m-camera-roll"
143                 onClicked: openFile("PostCapturePage.qml");
144                 visible: controlsVisible
145         }
146 }