3 import com.nokia.meego 1.1
10 property alias standbyWidget: standby
12 property bool needsPipeline: true
13 property int policyMode: CameraResources.None
15 Component.onCompleted: {
16 if (Qt.application.active && needsPipeline) {
17 resourcePolicy.acquire(page.policyMode);
22 if (Qt.application.active && status == PageStatus.Activating) {
23 resourcePolicy.acquire(page.policyMode);
28 if (status == PageStatus.Active && !page.needsPipeline) {
34 onPolicyModeChanged: {
35 if (Qt.application.active) {
36 resourcePolicy.acquire(page.policyMode);
40 function handlePipeline() {
41 if (!Qt.application.active) {
42 // TODO: force if we lost resources ?
45 else if (resourcePolicy.acquired && page.needsPipeline && !cam.running) {
49 else if (!resourcePolicy.acquired) {
56 target: resourcePolicy
57 onAcquiredChanged: handlePipeline();
61 target: Qt.application
63 if (!Qt.application.active) {
64 // This is a noop if camera is not
65 // idle so calling it will not hurt
67 resourcePolicy.acquire(CameraResources.None);
70 else if (page.needsPipeline) {
71 resourcePolicy.acquire(page.policyMode);
79 if (cam.idle && !Qt.application.active) {
81 resourcePolicy.acquire(CameraResources.None);
84 else if (cam.idle && !page.needsPipeline) {
93 // TODO: fade out transition
94 // TODO: there is a toolbar visible on the first startup
98 visible: !Qt.application.active || !cam.running || !resourcePolicy.acquired
100 source: "image://theme/icon-l-camera-standby"
101 anchors.centerIn: parent
105 property Camera cam: null
106 property bool controlsVisible: cam.running && !standby.visible
110 property alias previewAnimationRunning: preview.animationRunning
112 function setPreview(image) {
113 preview.setPreview(image);
117 anchors.bottom: parent.bottom
118 anchors.right: parent.right
119 anchors.rightMargin: 20
120 anchors.bottomMargin: 20
121 visible: controlsVisible
131 anchors.top: parent.top
133 anchors.horizontalCenter: parent.horizontalCenter
134 visible: controlsVisible