* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-import QtQuick 1.1
+import QtQuick 2.0
import CameraPlus 1.0
-import com.nokia.meego 1.1
import QtCamera 1.0
Item {
+ id: postCaptureView
+
+ property Camera camera: null
property bool pressed: view.currentItem ? view.currentItem.playing : false
- property int policyMode: view.currentItem && view.currentItem.playing ? CameraResources.None :
- settings.mode == Camera.VideoMode ? CameraResources.Video
- : CameraResources.Image
- property bool available: view.currentItem ? view.currentItem.itemData.available : false
+ property int policyMode: view.currentItem && view.currentItem.playing ?
+ CameraResources.Player : settings.mode == Camera.VideoMode ? CameraResources.Video :
+ CameraResources.Image
+
+ property bool isCurrent: mainView.currentIndex == 2 && !mainView.moving
+ property bool inCameraMode: root.inCaptureMode && !mainView.moving
+
+ onIsCurrentChanged: {
+ if (isCurrent) {
+ postCaptureModel.reload()
+ }
+ }
+
+ onInCameraModeChanged: {
+ if (inCameraMode) {
+ postCaptureModel.clear()
+ }
+ }
- Component.onCompleted: postCaptureModel.reload()
+ Connections {
+ target: view.currentItem
+ onPlayingChanged: {
+ if (view.currentItem.playing) {
+ hideTimer.running = false
+ }
+ }
+ }
ShareHelper {
id: share
cacheBuffer: height * 3
model: postCaptureModel
highlightRangeMode: ListView.StrictlyEnforceRange
+ interactive: view.currentItem && view.currentItem.playing ? false : true
delegate: PostCaptureItem {
width: view.width
}
PostCaptureModel {
- // TODO: this should not be active all the time
id: postCaptureModel
- manufacturer: deviceInfo.manufacturer
- model: deviceInfo.model
- onError: {
- console.log("Error populating model " + msg)
- showError(qsTr("Failed to load captures"))
- }
+ imagePath: platformSettings.imagePath
+ videoPath: platformSettings.videoPath
}
Timer {
CameraToolBar {
id: toolBar
expanded: true
- manualBack: true
+ hideBack: true
anchors.bottom: parent.bottom
- anchors.bottomMargin: show ? 20 : -1 * (height + 20)
+ anchors.bottomMargin: 20
anchors.left: parent.left
anchors.leftMargin: 20
- opacity: 0.8
-// TODO: hide back button
- property bool show: deleteDialog.status == DialogStatus.Open ||
- deleteDialog.status == DialogStatus.Opening ||
- hideTimer.running || menu.status == DialogStatus.Open ||
- menu.status == DialogStatus.Opening ||
- (view.currentItem && view.currentItem.error) && !view.currentItem.playing
-
-// TODO:
-// onClicked: pageStack.pop()
-
- Behavior on anchors.bottomMargin {
- PropertyAnimation { duration: 200; }
+ anchors.right: parent.right
+ anchors.rightMargin: 20
+ opacity: show ? 0.8 : 0.0
+ visible: opacity > 0
+ property bool show: deleteDialog.isOpen || deleteDialog.isOpening ||
+ hideTimer.running ||
+ (view.currentItem != null && view.currentItem.error) && !view.currentItem.playing
+
+ Behavior on opacity {
+ PropertyAnimation { duration: view.currentItem && view.currentItem.playing ? 0 : 200 }
}
- items: [
- ToolIcon {
- iconId: !available ? "icon-m-toolbar-favorite-mark-dimmed-white" : view.currentItem.itemData.favorite ? "icon-m-toolbar-favorite-mark-white" : "icon-m-toolbar-favorite-unmark-white"
- onClicked: {
- addOrRemoveFavorite()
- restartTimer()
- }
- },
- ToolIcon {
- iconId: available ? "icon-m-toolbar-share-white" : "icon-m-toolbar-share-dimmed-white"
+ tools: CameraToolBarTools {
+ CameraToolIcon {
+ iconSource: cameraTheme.shareIconId
+ enabled: view.currentItem != null
onClicked: {
shareCurrentItem()
restartTimer()
}
- },
- ToolIcon {
- iconId: available ? "icon-m-toolbar-delete-white" : "icon-m-toolbar-delete-dimmed-white"
+ }
+
+ CameraToolIcon {
+ iconSource: cameraTheme.deleteIconId
+ enabled: view.currentItem != null
onClicked: {
deleteCurrentItem()
restartTimer()
}
- },
- ToolIcon {
- iconId: "icon-m-toolbar-view-menu-white"
+ }
+
+ CameraToolIcon {
+ iconSource: cameraTheme.galleryIconId
onClicked: {
- menu.open()
+ launchGallery()
restartTimer()
}
}
- ]
+ }
}
- QueryDialog {
+ CameraQueryDialog {
id: deleteDialog
titleText: qsTr("Delete item?");
acceptButtonText: qsTr("Yes");
onStatusChanged: restartTimer()
onAccepted: {
- if (!remove.remove(view.currentItem.itemData.url)) {
+ if (!remove.remove(view.currentItem.itemUrl)) {
showError(qsTr("Failed to delete item"))
} else {
- postCaptureModel.remove(view.currentItem.itemData);
+ view.model.remove(view.currentItem.itemUrl)
}
}
}
}
- Menu {
- id: menu
- onStatusChanged: restartTimer()
-
- MenuLayout {
- MenuItem {
- text: qsTr("Captures in gallery")
- onClicked: launchGallery()
- }
-
- MenuItem {
- text: qsTr("View in gallery")
- enabled: available
- onClicked: showInGallery()
- }
- }
- }
-
Rectangle {
opacity: toolBar.opacity
anchors.top: parent.top
- anchors.topMargin: toolBar.show ? 20 : -1 * (height + 20)
+ anchors.topMargin: 20
anchors.left: parent.left
anchors.leftMargin: 20
anchors.right: parent.right
border.color: toolBar.border.color
radius: toolBar.radius
- Behavior on anchors.topMargin {
- PropertyAnimation { duration: 200; }
- }
-
Flow {
width: parent.width - 40
x: 20
height: parent.height
- Label {
- text: view.currentItem ? view.currentItem.itemData.title : ""
+ CameraLabel {
+ text: view.currentItem ? view.currentItem.itemTitle : ""
width: parent.width / 2
height: parent.height
font.bold: true
horizontalAlignment: Text.AlignLeft
}
- Label {
- text: view.currentItem ? view.currentItem.itemData.created : ""
+ CameraLabel {
+ text: view.currentItem ? view.currentItem.itemCreated : ""
width: parent.width / 2
height: parent.height
font.bold: true
}
}
- function showInGallery() {
- if (!available) {
- return
- }
-
- if (!gallery.show(view.currentItem.itemUrl)) {
- showError(qsTr("Failed to launch gallery"))
- }
- }
-
function deleteCurrentItem() {
- if (!available) {
+ if (view.currentItem == null) {
return
}
- deleteDialog.message = view.currentItem.itemData.fileName
+ deleteDialog.message = view.currentItem.itemFileName
deleteDialog.open()
}
function shareCurrentItem() {
- if (!available) {
- return
- }
-
- if (!share.share(view.currentItem.itemData.url)) {
+ if (view.currentItem != null && !share.share(view.currentItem.itemUrl)) {
showError(qsTr("Failed to launch share service"))
}
}
- function addOrRemoveFavorite() {
- if (!available) {
- return
- }
-
- if (view.currentItem.itemData.favorite) {
- if (!trackerStore.removeFromFavorites(view.currentItem.itemData.url)) {
- showError(qsTr("Failed to remove favorite"))
- } else {
- view.currentItem.itemData.favorite = false
- }
- } else {
- if (!trackerStore.addToFavorites(view.currentItem.itemData.url)) {
- showError(qsTr("Failed to add favorite"))
- } else {
- view.currentItem.itemData.favorite = true
- }
- }
- }
-
function restartTimer() {
hideTimer.restart()
}
+
+ function policyLost() {
+ if (view.currentItem && view.currentItem.playing) {
+ view.currentItem.stopPlayback()
+ }
+ }
}