Show an error if we fail to capture an image or to record a video.
[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                                 if (!videoMode.startRecording(fileNaming.videoFileName())) {
25                                         showError("Failed to record video. Please restart the camera.");
26                                 }
27                         }
28                         else {
29                                 videoMode.stopRecording();
30                         }
31                 }
32
33                 visible: (videoMode.recording || videoMode.canCapture) && !cameraMode.animationRunning && !previewAnimationRunning && !standbyWidget.visible
34         }
35
36         Connections {
37                 target: platformWindow
38                 onActiveChanged: {
39                         if (!platformWindow.active && videoMode.recording) {
40                                 videoMode.stopRecording();
41                         }
42                 }
43         }
44
45         VideoMode {
46                 id: videoMode
47                 camera: cam
48                 onPreviewAvailable: {
49                         if (!standbyWidget.visible) {
50                                 page.setPreview(preview);
51                         }
52                 }
53         }
54
55         VideoTorchButton {
56                 id: torch
57                 visible: controlsVisible
58                 anchors.top: parent.top
59                 anchors.left: parent.left
60                 anchors.topMargin: 20
61                 anchors.leftMargin: 20
62                 opacity: 0.5
63         }
64
65         VideoSceneButton {
66                 id: scene
67                 visible: controlsVisible && !videoMode.recording
68                 anchors.top: torch.bottom
69                 anchors.left: parent.left
70                 anchors.topMargin: 10
71                 anchors.leftMargin: 20
72         }
73
74         EvCompButton {
75                 id: evComp
76                 visible: controlsVisible
77                 anchors.top: scene.bottom
78                 anchors.left: parent.left
79                 anchors.topMargin: 10
80                 anchors.leftMargin: 20
81         }
82 }