* 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
+// TODO: qrc:/qml/PostCaptureView.qml:104:5: QML CameraToolBar: Binding loop detected for property "height"
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.Player : settings.mode == Camera.VideoMode ? CameraResources.Video :
CameraResources.Image
property bool available: view.currentItem ? view.currentItem.itemData.available : false
- 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"))
+ 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"))
+ }
+ }
}
}
anchors.bottomMargin: show ? 20 : -1 * (height + 20)
anchors.left: parent.left
anchors.leftMargin: 20
+ anchors.right: parent.right
+ anchors.rightMargin: 20
opacity: 0.8
- property bool show: deleteDialog.status == DialogStatus.Open ||
- deleteDialog.status == DialogStatus.Opening ||
- hideTimer.running || menu.status == DialogStatus.Open ||
- menu.status == DialogStatus.Opening ||
+ property bool show: deleteDialog.isOpen || deleteDialog.isOpening ||
+ hideTimer.running || menu.isOpen || menu.isOpening ||
(view.currentItem && view.currentItem.error) && !view.currentItem.playing
Behavior on anchors.bottomMargin {
- PropertyAnimation { duration: 200; }
+ 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"
+ tools: CameraToolBarTools {
+ CameraToolIcon {
+ iconId: !available ? cameraTheme.favoriteDisabledIconId : view.currentItem.itemData.favorite ? cameraTheme.favoriteMarkIconId : cameraTheme.favoriteUnmarkIconId
onClicked: {
addOrRemoveFavorite()
restartTimer()
}
- },
- ToolIcon {
- iconId: available ? "icon-m-toolbar-share-white" : "icon-m-toolbar-share-dimmed-white"
+ }
+
+ CameraToolIcon {
+ iconId: available ? cameraTheme.shareEnabledIconId : cameraTheme.shareDisabledIconId
onClicked: {
shareCurrentItem()
restartTimer()
}
- },
- ToolIcon {
- iconId: available ? "icon-m-toolbar-delete-white" : "icon-m-toolbar-delete-dimmed-white"
+ }
+
+ CameraToolIcon {
+ iconId: available ? cameraTheme.deleteEnabledIconId : cameraTheme.deleteDisabledIconId
onClicked: {
deleteCurrentItem()
restartTimer()
}
- },
- ToolIcon {
- iconId: "icon-m-toolbar-view-menu-white"
+ }
+
+ CameraToolIcon {
+ iconId: cameraTheme.menuIconId
onClicked: {
menu.open()
restartTimer()
}
}
- ]
+ }
}
- QueryDialog {
+ CameraQueryDialog {
id: deleteDialog
titleText: qsTr("Delete item?");
acceptButtonText: qsTr("Yes");
}
}
- Menu {
+ CameraMenu {
id: menu
onStatusChanged: restartTimer()
- MenuLayout {
- MenuItem {
+ actions: [
+ CameraMenuAction {
text: qsTr("Captures in gallery")
onClicked: launchGallery()
- }
-
- MenuItem {
+ },
+ CameraMenuAction {
+ // TODO: this is not working...
text: qsTr("View in gallery")
enabled: available
onClicked: showInGallery()
}
- }
+ ]
}
Rectangle {
radius: toolBar.radius
Behavior on anchors.topMargin {
- PropertyAnimation { duration: 200; }
+ PropertyAnimation { duration: view.currentItem && view.currentItem.playing ? 0 : 200 }
}
Flow {
x: 20
height: parent.height
- Label {
+ CameraLabel {
text: view.currentItem ? view.currentItem.itemData.title : ""
width: parent.width / 2
height: parent.height
horizontalAlignment: Text.AlignLeft
}
- Label {
+ CameraLabel {
text: view.currentItem ? view.currentItem.itemData.created : ""
width: parent.width / 2
height: parent.height
function restartTimer() {
hideTimer.restart()
}
+
+ function policyLost() {
+ if (view.currentItem && view.currentItem.playing) {
+ view.currentItem.stopPlayback()
+ }
+ }
}