set the width of the delegate to the width of the parent. image width gets 10 pixels...
[harmattan/cameraplus] / qml / CameraPage.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
28 Page {
29         id: page
30
31         property bool needsPipeline: true
32         property int policyMode: CameraResources.None
33
34         property Camera cam: null
35         property Item dimmer: null
36
37         property bool controlsVisible: cam.running && !standby.visible
38         property bool zoomVisible: true
39         property bool modesVisible: true
40         property bool standbyVisible: true
41         property bool focusReticleVisible: true
42         property bool enableViewfinder: true
43
44         property alias previewAnimationRunning: preview.animationRunning
45
46         signal batteryLow
47
48         function cameraError() {
49                 // Nothing
50         }
51
52         function policyLost() {
53                 // Nothing
54         }
55
56         onStatusChanged: {
57                 if (status == PageStatus.Activating && enableViewfinder) {
58                         cam.renderingEnabled = true;
59                 }
60                 else if (status == PageStatus.Active) {
61                         focusReticle.setRegionOfInterest();
62
63                         if (!enableViewfinder) {
64                                 cam.renderingEnabled = false;
65                         }
66                 }
67         }
68
69         function setPreview(image) {
70                 preview.setPreview(image);
71         }
72
73         ModeButton {
74                 anchors.bottom: parent.bottom
75                 anchors.right: parent.right
76                 anchors.rightMargin: 20
77                 anchors.bottomMargin: 20
78                 visible: controlsVisible && modesVisible
79         }
80
81         PreviewImage {
82                 id: preview
83         }
84
85         ZoomSlider {
86                 id: zoom
87                 camera: cam
88                 anchors.top: parent.top
89                 anchors.topMargin: 0
90                 anchors.horizontalCenter: parent.horizontalCenter
91                 visible: controlsVisible && zoomVisible
92         }
93
94         function checkDiskSpace() {
95                 return fileSystem.hasFreeSpace(fileNaming.path);
96         }
97 }