8dc4b2a11fd3e1902b11d22aa539bea394c21ce7
[harmattan/cameraplus] / qml / VideoPage.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
7 CameraPage {
8         id: page
9
10         controlsVisible: recording.visible && cam.running && !standbyWidget.visible
11
12         orientationLock: PageOrientation.LockLandscape
13
14         DisplayState {
15                 inhibitDim: videoMode.recording
16         }
17
18         Button {
19                 id: recording
20                 anchors.right: parent.right
21                 anchors.rightMargin: 20
22                 anchors.verticalCenter: parent.verticalCenter
23                 iconSource: "image://theme/icon-m-camera-video-record"
24                 width: 75
25                 height: 75
26                 opacity: 0.5
27                 onClicked: {
28                         if (!videoMode.recording) {
29                                 if (!fileSystem.available) {
30                                         showError(qsTr("Camera cannot record videos in mass storage mode."));
31                                 }
32                                 else if (!videoMode.startRecording(fileNaming.videoFileName())) {
33                                         showError(qsTr("Failed to record video. Please restart the camera."));
34                                 }
35                         }
36                         else {
37                                 videoMode.stopRecording();
38                         }
39                 }
40
41                 visible: (videoMode.recording || videoMode.canCapture) && !cameraMode.animationRunning && !previewAnimationRunning && !standbyWidget.visible
42         }
43
44         Connections {
45                 target: platformWindow
46                 onActiveChanged: {
47                         if (!platformWindow.active && videoMode.recording) {
48                                 videoMode.stopRecording();
49                         }
50                 }
51         }
52
53         VideoMode {
54                 id: videoMode
55                 camera: cam
56                 onPreviewAvailable: {
57                         if (!standbyWidget.visible) {
58                                 page.setPreview(preview);
59                         }
60                 }
61         }
62
63         VideoTorchButton {
64                 id: torch
65                 visible: controlsVisible
66                 anchors.top: parent.top
67                 anchors.left: parent.left
68                 anchors.topMargin: 20
69                 anchors.leftMargin: 20
70                 opacity: 0.5
71         }
72
73         VideoSceneButton {
74                 id: scene
75                 visible: controlsVisible && !videoMode.recording
76                 anchors.top: torch.bottom
77                 anchors.left: parent.left
78                 anchors.topMargin: 10
79                 anchors.leftMargin: 20
80         }
81
82         EvCompButton {
83                 id: evComp
84                 visible: controlsVisible
85                 anchors.top: scene.bottom
86                 anchors.left: parent.left
87                 anchors.topMargin: 10
88                 anchors.leftMargin: 20
89         }
90
91         Button {
92                 id: cameraRoll
93                 anchors.top: parent.top
94                 anchors.right: parent.right
95                 anchors.topMargin: 20
96                 anchors.rightMargin: 20
97                 width: 56
98                 height: 56
99
100                 opacity: 0.5
101                 iconSource: "image://theme/icon-m-camera-roll"
102                 onClicked: openFile("PostCapturePage.qml");
103                 visible: controlsVisible && !videoMode.recording
104         }
105 }