import CameraPlus 1.0
import QtCamera 1.0
-// TODO: qrc:/qml/PostCaptureView.qml:104:5: QML CameraToolBar: Binding loop detected for property "height"
-// TODO: try to reload the preview thumbnail when the picture becomes available
-// TODO: prevent flicking to this view while preview animation is running
Item {
id: postCaptureView
- property Camera camera: null
+ property Camera camera: viewfinder.camera
property bool pressed: view.currentItem ? view.currentItem.playing : false
property int policyMode: view.currentItem && view.currentItem.playing ?
CameraResources.Player : settings.mode == Camera.VideoMode ? CameraResources.Video :
CameraResources.Image
- property bool available: view.currentItem ? view.currentItem.itemData.available : false
+ property bool inhibitDim: pressed
+
+ 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()
+ }
+ }
Connections {
target: view.currentItem
}
}
- property variant postCaptureModel: postCaptureModelLoader.item ?
- postCaptureModelLoader.item.model : null
- property bool loadModel: mainView.currentIndex == 2 && Qt.application.active
-
- Loader {
- id: postCaptureModelLoader
- sourceComponent: loadModel ? postCaptureModelComponent : undefined
- }
-
- // We have to do it that way because Loader does not support non-visual elements.
- Component {
- id: postCaptureModelComponent
-
- Item {
- property alias model: postCaptureModel
-
- PostCaptureModel {
- id: postCaptureModel
- manufacturer: deviceInfo.manufacturer
- model: deviceInfo.model
- Component.onCompleted: reload()
- onError: {
- console.log("Error populating model " + msg)
- showError(qsTr("Failed to load captures"))
- }
- }
- }
+ PostCaptureModel {
+ id: postCaptureModel
+ imagePath: platformSettings.imagePath
+ videoPath: platformSettings.videoPath
}
Timer {
expanded: true
hideBack: true
anchors.bottom: parent.bottom
- anchors.bottomMargin: show ? 20 : -1 * (height + 20)
+ anchors.bottomMargin: 20
anchors.left: parent.left
anchors.leftMargin: 20
anchors.right: parent.right
anchors.rightMargin: 20
- opacity: 0.8
-
+ opacity: show ? 0.8 : 0.0
+ visible: opacity > 0
property bool show: deleteDialog.isOpen || deleteDialog.isOpening ||
hideTimer.running ||
- (view.currentItem && view.currentItem.error) && !view.currentItem.playing
+ (view.currentItem != null && view.currentItem.error) && !view.currentItem.playing
- Behavior on anchors.bottomMargin {
+ Behavior on opacity {
PropertyAnimation { duration: view.currentItem && view.currentItem.playing ? 0 : 200 }
}
tools: CameraToolBarTools {
CameraToolIcon {
- iconId: available && view.currentItem.itemData.favorite ? cameraTheme.favoriteMarkIconId : cameraTheme.favoriteUnmarkIconId
- opacity: available ? 1.0 : 0.4
- onClicked: {
- addOrRemoveFavorite()
- restartTimer()
- }
- }
-
- CameraToolIcon {
- iconId: cameraTheme.shareIconId
- opacity: available ? 1.0 : 0.4
+ iconSource: cameraTheme.shareIconId
+ enabled: view.currentItem != null
onClicked: {
shareCurrentItem()
restartTimer()
}
CameraToolIcon {
- iconId: cameraTheme.deleteIconId
- opacity: available ? 1.0 : 0.4
+ iconSource: cameraTheme.deleteIconId
+ enabled: view.currentItem != null
onClicked: {
deleteCurrentItem()
restartTimer()
}
CameraToolIcon {
- iconId: cameraTheme.galleryIconId
+ iconSource: cameraTheme.galleryIconId
onClicked: {
launchGallery()
restartTimer()
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)
}
}
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: view.currentItem && view.currentItem.playing ? 0 : 200 }
- }
-
Flow {
width: parent.width - 40
x: 20
height: parent.height
CameraLabel {
- text: view.currentItem ? view.currentItem.itemData.title : ""
+ text: view.currentItem ? view.currentItem.itemTitle : ""
width: parent.width / 2
height: parent.height
font.bold: true
}
CameraLabel {
- text: view.currentItem ? view.currentItem.itemData.created : ""
+ text: view.currentItem ? view.currentItem.itemCreated : ""
width: parent.width / 2
height: parent.height
font.bold: true
}
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()
}