Added copyright headers and COPYING file.
[harmattan/cameraplus] / qml / ImagePage.qml
1 // -*- qml -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22
23 import QtQuick 1.1
24 import com.nokia.meego 1.1
25 import QtCamera 1.0
26 import CameraPlus 1.0
27 import "data.js" as Data
28
29 CameraPage {
30         id: page
31
32         policyMode: CameraResources.Image
33         controlsVisible: capture.visible && cam.running && !standbyWidget.visible
34
35         Button {
36                 id: capture
37                 anchors.right: parent.right
38                 anchors.rightMargin: 20
39                 anchors.verticalCenter: parent.verticalCenter
40                 iconSource: "image://theme/icon-m-camera-shutter"
41                 width: 75
42                 height: 75
43                 opacity: 0.5
44                 onClicked: {
45                         if (!fileSystem.available) {
46                                 showError(qsTr("Camera cannot capture images in mass storage mode."));
47                                 return;
48                         }
49
50                         metaData.setMetaData();
51
52                         if (!imageMode.capture(fileNaming.imageFileName())) {
53                                 showError(qsTr("Failed to capture image. Please restart the camera."));
54                         }
55                 }
56
57                 visible: imageMode.canCapture && !cameraMode.animationRunning && !previewAnimationRunning && cam.running
58         }
59
60         ImageMode {
61                 id: imageMode
62                 camera: cam
63                 onPreviewAvailable: page.setPreview(preview);
64         }
65
66         FlashButton {
67                 id: flash
68                 visible: controlsVisible
69                 anchors.top: parent.top
70                 anchors.left: parent.left
71                 anchors.topMargin: 20
72                 anchors.leftMargin: 20
73         }
74
75         ImageSceneButton {
76                 id: scene
77                 visible: controlsVisible
78                 anchors.top: flash.bottom
79                 anchors.left: parent.left
80                 anchors.topMargin: 10
81                 anchors.leftMargin: 20
82         }
83
84         EvCompButton {
85                 id: evComp
86                 visible: controlsVisible
87                 anchors.top: scene.bottom
88                 anchors.left: parent.left
89                 anchors.topMargin: 10