// -*- qml -*-
+
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
import QtQuick 1.1
import com.nokia.meego 1.1
import QtCamera 1.0
// TODO: this is really basic.
-Page {
+CameraPage {
id: page
- property Camera cam: null
+
+ controlsVisible: false
+ policyMode: CameraResources.PostCapture
+ needsPipeline: true
+
+ onStatusChanged: {
+ if (status == PageStatus.Active) {
+ cam.stop();
+ }
+ }
+
+ Connections {
+ // Unlikely that we need this.
+ target: cam
+ onIdleChanged: {
+ if (cam.idle && page.status == PageStatus.Active) {
+ cam.stop();
+ }
+ }
+ }
Rectangle {
color: "black"
anchors.fill: parent
}
- ListView {
- // TODO: ListView does not loop and seems one has to use PathView.
+ PathView {
id: view
anchors.fill: parent
- orientation: ListView.Horizontal
- snapMode: ListView.SnapOneItem
- cacheBuffer: view.width * 2
+
+ path: Path {
+ startX: -view.width
+ startY: view.height / 2
+ PathLine { x: view.width * 2; y: view.height / 2 }
+ }
+
+ flickDeceleration: 999999 // Insanely high value to prevent panning multiple images
+ preferredHighlightBegin: 0.5
+ preferredHighlightEnd: 0.5
+ highlightRangeMode: PathView.StrictlyEnforceRange
+ pathItemCount: 3
model: SparqlListModel {
- query: "SELECT nie:url(?urn) AS ?url tracker:id(?urn) AS ?trackerid nie:mimeType(?urn) AS ?mime WHERE { ?urn rdf:type nfo:Media . ?urn nfo:equipment \"urn:equipment:Nokia:N950:\" ; tracker:available \"true\"^^xsd:boolean } ORDER BY DESC (?created)"
+ // This is the exact query used by Harmattan gallery.
+ // Gallery prints it as part of its debugging when
+ // passing -output-level debug ;-)
+ 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)"
connection: SparqlConnection {
id: connection
onStatusChanged: checkStatus(status)
function checkStatus(status) {
- if (status == SparqlConnection.Error)
- console.log("Error = "+connection.errorString());
+ if (status == SparqlConnection.Error) {
+ console.log("Error = "+connection.errorString());
+ }
}
}
}
width: view.width
height: view.height
+ Label {
+ width: view.width - 10
+ height: view.height
+ anchors.centerIn: parent
+ visible: item.error && page.status == PageStatus.Active
+ text: qsTr("Failed to load preview");
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: 32
+ }
+
QuillItem {
+ id: item
source: url
- mimeType: mime
+ mimeType: mimetype
width: view.width - 10
height: view.height
anchors.centerIn: parent
- // TODO: does not work because of preloading
- // onError: showError(qsTr("Failed to load image"));
+
+ MouseArea {
+ id: mouse
+ anchors.fill: parent
+ enabled: true
+ onClicked: toolBar.visible = !toolBar.visible
}
+ }
}
}
anchors.bottom: parent.bottom
tools: ToolBarLayout {
id: layout
- ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
+ ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: { cam.start(); pageStack.pop(); } }
+ }
+ }
+
+ Rectangle {
+ // TODO: transitions
+ id: rect
+ anchors.top: parent.top
+ height: toolBar.height
+ width: parent.width
+ color: "black"
+ opacity: toolBar.opacity
+ visible: toolBar.visible
+ Row {
+ anchors.fill: parent
+
+ Label {
+
+ }
+
+ Label {
+
+ }
}
}
}