X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=qml%2Fmain.qml;h=d30139a109005e2bba2a9662ce7e608b2915408d;hb=523b619b6b356d744a271b39b68ab48fb80a7a8a;hp=340048890404b1887587a066c06b2e55d31e89ca;hpb=7e93cede986ef343f252f513d7d14adb6c3939e2;p=harmattan%2Fcameraplus diff --git a/qml/main.qml b/qml/main.qml index 3400488..d30139a 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -25,19 +25,16 @@ import com.nokia.meego 1.1 import com.nokia.extras 1.1 import QtCamera 1.0 import CameraPlus 1.0 -import QtMobility.systeminfo 1.2 +import QtMobility.systeminfo 1.2 as Qtm import QtMobility.location 1.2 -// TODO: postcapture // TODO: flash not ready (battery low or flash not ready message) // TODO: portrait/landscape -// TODO: stop viewfinder in settings pages ? // TODO: grid lines, face tracking // TODO: select primary/secondary camera. // TODO: disable debug builds. // TODO: a way to get buffers to the application // TODO: fcam like functionality (precise control over capture parameters). -// TODO: mute video sound PageStackWindow { id: root @@ -118,7 +115,7 @@ PageStackWindow { camera: cam } - DeviceInfo { + Qtm.DeviceInfo { id: deviceInfo } @@ -145,16 +142,49 @@ PageStackWindow { path: fileNaming.path } + BatteryInfo { + id: batteryMonitor + active: cam.running + + function check() { + if (!checkBattery()) { + pageStack.currentPage.batteryLow(); + } + } + + onChargingChanged: { + batteryMonitor.check(); + } + + onCriticalChanged: { + batteryMonitor.check(); + } + } + function replacePage(file) { - pageStack.replace(Qt.resolvedUrl(file), {cam: cam}, true); + pageStack.replace(Qt.resolvedUrl(file), {cam: cam, dimmer: root.dimmer}, true); } function openFile(file) { - pageStack.push(Qt.resolvedUrl(file), {cam: cam}); + pageStack.push(Qt.resolvedUrl(file), {cam: cam, dimmer: root.dimmer}); } function openFileNow(file) { - pageStack.push(Qt.resolvedUrl(file), {cam: cam}, true); + pageStack.push(Qt.resolvedUrl(file), {cam: cam, dimmer: root.dimmer}, true); + } + + function checkBattery() { + // We are fine if we are connected to the charger: + if (batteryMonitor.charging) { + return true; + } + + // If we have enough battery then we are fine: + if (!batteryMonitor.critical) { + return true; + } + + return false; } platformStyle: PageStackWindowStyle { @@ -222,7 +252,7 @@ PageStackWindow { visible: pageStack.currentPage && pageStack.currentPage.controlsVisible && pageStack.currentPage.focusReticleVisible && cam && cam.autoFocus.canFocus(cam.scene.value); cafStatus: cam ? cam.autoFocus.cafStatus : -1 status: cam ? cam.autoFocus.status : -1 - } + } /* onDeviceIdChanged: { @@ -262,11 +292,15 @@ PageStackWindow { z: -1 Rectangle { + property bool dimmed: false id: camDimmer z: 1 anchors.fill: parent - opacity: 0 + opacity: dimmed ? 1.0 : 0.0 color: "black" + Behavior on opacity { + PropertyAnimation { duration: 150 } + } } notifications: Sounds { @@ -374,6 +408,12 @@ PageStackWindow { value: cam.iso.value } + Binding { + target: cam.videoMute + property: "enabled" + value: settings.videoMuted + } + TrackerStore { id: trackerStore active: cam.running @@ -398,4 +438,9 @@ PageStackWindow { } } } + + Standby { + policyLost: pipelineManager.state == "policyLost" + show: !pageStack.currentPage || (pageStack.currentPage.standbyVisible && pageStack.currentPage.status == PageStatus.Active && pipelineManager.showStandBy) + } }