Just pass the filename to pageStack.push()
[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         policyMode: CameraResources.Video
11
12         controlsVisible: recording.visible && cam.running && !standbyWidget.visible
13
14         orientationLock: PageOrientation.LockLandscape
15
16         DisplayState {
17                 inhibitDim: videoMode.recording
18         }
19
20         Button {
21                 id: recording
22                 anchors.right: parent.right
23                 anchors.rightMargin: 20
24                 anchors.verticalCenter: parent.verticalCenter
25                 iconSource: "image://theme/icon-m-camera-video-record"
26                 width: 75
27                 height: 75
28                 opacity: 0.5
29
30                 onClicked: {
31                         if (!fileSystem.available) {
32                                 showError(qsTr("Camera cannot record videos in mass storage mode."));
33                                 return;
34                         }
35
36                         // We only toggle the mode to video recording so
37                         // policy can acquire the needed resources
38
39                         if (policyMode == CameraResources.Video) {
40                                 policyMode = CameraResources.Recording;
41                         }
42                         else if (videoMode.recording) {
43                                 // We just ask to stop video.
44                                 videoMode.stopRecording();
45                         }
46                 }
47
48                 Connections {
49                         target: videoMode
50                         onRecordingChanged: {
51                                 if (!videoMode.recording) {
52                                         policyMode = CameraResources.Video;
53                                 }
54                         }
55                 }
56
57                 Connections {
58                         target: resourcePolicy
59                         onAcquiredChanged: {
60                                 if (resourcePolicy.acquired && policyMode == CameraResources.Recording) {
61                                         metaData.setMetaData();
62                                         if (!videoMode.startRecording(fileNaming.videoFileName())) {
63                                                 showError(qsTr("Failed to record video. Please restart the camera."));
64                                                 policyMode = CameraResources.Video
65 }
66                                 }
67                         }
68                 }
69
70                 visible: (videoMode.recording || videoMode.canCapture) && !cameraMode.animationRunning && !previewAnimationRunning && !standbyWidget.visible
71         }
72
73         Connections {
74                 target: Qt.application
75                 onActiveChanged: {
76                         if (!Qt.application.active && videoMode.recording) {
77                                 videoMode.stopRecording();
78                         }
79                 }
80         }
81
82         VideoMode {
83                 id: videoMode
84                 camera: cam
85                 onPreviewAvailable: {
86                         if (!standbyWidget.visible) {
87                                 page.setPreview(preview);
88                         }
89                 }
90         }
91
92         VideoTorchButton {
93                 id: torch
94                 visible: controlsVisible
95                 anchors.top: parent.top
96                 anchors.left: parent.left
97                 anchors.topMargin: 20
98                 anchors.leftMargin: 20
99                 opacity: 0.5
100         }
101
102         VideoSceneButton {
103                 id: scene
104                 visible: controlsVisible && !videoMode.recording
105                 anchors.top: torch.bottom
106                 anchors.left: parent.left
107                 anchors.topMargin: 10
108                 anchors.leftMargin: 20
109         }
110
111         EvCompButton {
112                 id: evComp
113                 visible: controlsVisible
114                 anchors.top: scene.bottom
115                 anchors.left: parent.left
116                 anchors.topMargin: 10
117                 anchors.leftMargin: 20
118         }
119
120         Button {
121                 id: cameraRoll
122                 anchors.top: parent.top
123                 anchors.right: parent.right
124                 anchors.topMargin: 20
125                 anchors.rightMargin: 20
126                 width: 56
127                 height: 56
128
129                 opacity: 0.5
130                 iconSource: "image://theme/icon-m-camera-roll"
131                 onClicked: openFile("PostCapturePage.qml");
132                 visible: controlsVisible && !videoMode.recording
133         }
134 }