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, ambr
+// 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
camera: cam
}
- DeviceInfo {
+ Qtm.DeviceInfo {
id: deviceInfo
}
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 {
cornersVisible: false
- // TODO: Hack
- background: " "
+ background: ""
+ backgroundColor: "transparent"
}
ImageSettings {
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: {
}
*/
onError: {
+ if (pipelineManager.error) {
+ // Ignore any subsequent errors.
+ // Killing pulseaudio while recording will lead to an
+ // infinite supply of errors which will break the UI
+ // if we show a banner for each.
+ return;
+ }
+
+ pipelineManager.error = true;
+ pageStack.currentPage.cameraError();
console.log("Camera error (" + code + "): " + message + " " + debug);
showError(qsTr("Camera error. Please restart the application."));
- cam.stop();
- mountProtector.unlock();
+
+ // We cannot stop camera here. Seems there is a race condition somewhere
+ // which leads to a freeze if we do so.
}
onRunningChanged: {
Component.onDestruction: cam.stop();
- // TODO: Hack
+ // We need to show viewfinder below pages.
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 {
value: cam.iso.value
}
+ Binding {
+ target: cam.videoMute
+ property: "enabled"
+ value: settings.videoMuted
+ }
+
TrackerStore {
id: trackerStore
active: cam.running
}
}
}
+
+ Standby {
+ policyLost: pipelineManager.state == "policyLost"
+ show: !pageStack.currentPage || (pageStack.currentPage.standbyVisible && pageStack.currentPage.status == PageStatus.Active && pipelineManager.showStandBy)
+ }
}