4 * This file is part of CameraPlus.
6 * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
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.
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.
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
24 import com.nokia.meego 1.1
29 // QML QtGallery stuff is crap.
30 // Most of the ideas (and some code) for loading and displaying images are stolen from
31 // N9QmlPhotoPicker https://github.com/petrumotrescu/N9QmlPhotoPicker
33 // TODO: this is really basic.
38 controlsVisible: false
39 policyMode: CameraResources.PostCapture
43 if (status == PageStatus.Active) {
49 // Unlikely that we need this.
52 if (cam.idle && page.status == PageStatus.Active) {
69 startY: view.height / 2
70 PathLine { x: view.width * 2; y: view.height / 2 }
73 flickDeceleration: 999999 // Insanely high value to prevent panning multiple images
74 preferredHighlightBegin: 0.5
75 preferredHighlightEnd: 0.5
76 highlightRangeMode: PathView.StrictlyEnforceRange
79 model: SparqlListModel {
80 // This is the exact query used by Harmattan gallery.
81 // Gallery prints it as part of its debugging when
82 // passing -output-level debug ;-)
83 query: "SELECT nie:url(?urn) AS ?url nfo:fileName(?urn) AS ?filename ?created nie:mimeType(?urn) AS ?mimetype ( EXISTS { ?urn nao:hasTag nao:predefined-tag-favorite . } ) AS ?favorite nfo:duration(?urn) AS ?duration ?urn \"false\"^^xsd:boolean AS ?isVirtual nfo:fileLastModified(?urn) as ?lastmod nfo:hasRegionOfInterest(?urn) as ?roi tracker:id(?urn) AS ?trackerid WHERE { ?urn rdf:type nfo:Visual ; tracker:available \"true\"^^xsd:boolean . OPTIONAL { ?urn nie:contentCreated ?created } . ?urn nfo:equipment \"urn:equipment:" + deviceInfo.manufacturer + ":" + deviceInfo.model + ":\" . } ORDER BY DESC (?created)"
85 connection: SparqlConnection {
87 driver: "QTRACKER_DIRECT"
88 onStatusChanged: checkStatus(status)
90 function checkStatus(status) {
91 if (status == SparqlConnection.Error) {
92 console.log("Error = "+connection.errorString());
103 width: view.width - 10
105 anchors.centerIn: parent
106 visible: item.error && page.status == PageStatus.Active
107 text: qsTr("Failed to load preview");
108 verticalAlignment: Text.AlignVCenter
109 horizontalAlignment: Text.AlignHCenter
117 width: view.width - 10
119 anchors.centerIn: parent
125 onClicked: toolBar.visible = !toolBar.visible
134 anchors.bottom: parent.bottom
135 tools: ToolBarLayout {
137 ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: { cam.start(); pageStack.pop(); } }
144 anchors.top: parent.top
145 height: toolBar.height
148 opacity: toolBar.opacity
149 visible: toolBar.visible