Added a class to generate filenames for images and videos
[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
6 CameraPage {
7         id: page
8
9         controlsVisible: recording.visible && cam.running && !standbyWidget.visible
10
11         orientationLock: PageOrientation.LockLandscape
12
13         Button {
14                 id: recording
15                 anchors.right: parent.right
16                 anchors.rightMargin: 20
17                 anchors.verticalCenter: parent.verticalCenter
18                 iconSource: "image://theme/icon-m-camera-video-record"
19                 width: 75
20                 height: 75
21                 opacity: 0.5
22                 onClicked: {
23                         if (!videoMode.recording) {
24                                 // TODO: Show an error if file is empty or starting fails.
25                                 videoMode.startRecording(fileNaming.videoFileName());
26                         }
27                         else {
28                                 videoMode.stopRecording();
29                         }
30                 }
31
32                 visible: (videoMode.recording || videoMode.canCapture) && !cameraMode.animationRunning && !previewAnimationRunning && !standbyWidget.visible
33         }
34
35         Connections {
36                 target: platformWindow
37                 onActiveChanged: {
38                         if (!platformWindow.active && videoMode.recording) {
39                                 videoMode.stopRecording();
40                         }
41                 }
42         }
43
44         VideoMode {
45                 id: videoMode
46                 camera: cam
47                 onPreviewAvailable: {
48                         if (!standbyWidget.visible) {
49                                 page.setPreview(preview);
50                         }
51                 }
52         }
53
54         VideoTorchButton {
55                 id: torch
56                 visible: controlsVisible
57                 anchors.top: parent.top
58                 anchors.left: parent.left
59                 anchors.topMargin: 20
60                 anchors.leftMargin: 20
61                 opacity: 0.5
62         }
63
64         VideoSceneButton {
65                 id: scene
66                 visible: controlsVisible && !videoMode.recording
67                 anchors.top: torch.bottom
68                 anchors.left: parent.left
69                 anchors.topMargin: 10
70                 anchors.leftMargin: 20
71         }
72
73         EvCompButton {
74                 id: evComp
75                 visible: controlsVisible
76                 anchors.top: scene.bottom
77                 anchors.left: parent.left
78                 anchors.topMargin: 10
79                 anchors.leftMargin: 20
80         }
81 }