fb9bd567ee3c2809a210cd6f532784a37db472af
[harmattan/cameraplus] / qml / PostCapturePage.qml
1 // -*- qml -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012-2013 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 CameraPage {
29         id: page
30
31         controlsVisible: false
32         policyMode: CameraResources.None
33         activationData: ControlsActivationData {standbyVisible: !Qt.application.active}
34
35         property Item currentItem: null
36         property bool available: currentItem ? currentItem.itemData.available : false
37
38         Component.onCompleted: postCaptureModel.reload();
39
40         Rectangle {
41                 color: "black"
42                 anchors.fill: parent
43         }
44
45         PathView {
46                 id: view
47                 anchors.fill: parent
48
49                 path: Path {
50                         startX: - view.width
51                         startY: view.height / 2
52                         PathLine { x: view.width * 2; y: view.height / 2 }
53                 }
54
55                 // Insanely high value to prevent panning multiple images
56                 flickDeceleration: 999999
57
58                 preferredHighlightBegin: 0.5
59                 preferredHighlightEnd: 0.5
60                 highlightRangeMode: PathView.StrictlyEnforceRange
61                 pathItemCount: 3
62
63                 model: PostCaptureModel {
64                         id: postCaptureModel
65                         manufacturer: deviceInfo.manufacturer
66                         model: deviceInfo.model
67                         onError: {
68                                 console.log("Error populating model " + msg);
69                                 showError(qsTr("Failed to load captures"));
70                         }
71                 }
72
73                 Label {
74                         // TODO: Hide this when we have no items
75                         text: qsTr("No captures available");
76                         anchors.centerIn: parent
77                         font.pixelSize: 36
78                         visible: currentItem == null
79                 }
80
81                 delegate: PostCaptureItem {
82                         width: view.width
83                         height: view.height
84                         onClicked: hideTimer.running = !hideTimer.running;
85                 }
86         }
87 }