onCheckedChanged: settings.zoomAsShutter = checked
}
+ TextSwitch {
+ text: qsTr("Use proximity sensor for capture")
+
+ // We have to do it that way because QML complains about a binding
+ // loop for checked if we bind the checked property to the settings value.
+ Component.onCompleted: checked = settings.proximityAsShutter
+ onCheckedChanged: settings.proximityAsShutter = checked
+ }
+
TextSwitch {
text: qsTr("Enable camera sounds")
repeat: !settings.zoomAsShutter
}
+ CameraProximitySensor {
+ id: proximitySensor
+ active: Qt.application.active && viewfinder.camera.running && settings.proximityAsShutter
+ }
+
+ // TODO:
Standby {
policyLost: pipelineManager.state == "policyLost"
show: !Qt.application.active || pipelineManager.showStandBy ||
--- /dev/null
+// -*- qml -*-
+
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+import QtQuick 1.1
+import QtMobility.sensors 1.2
+
+ProximitySensor {
+ property bool close
+ onReadingChanged: close = reading.close
+ Component.onCompleted: close = reading.close
+ onActiveChanged: close = false
+}
<file>FullScreenThumbnail.qml</file>
<file>CameraPositionSource.qml</file>
<file>CameraPage.qml</file>
+ <file>CameraProximitySensor.qml</file>
</qresource>
</RCC>
#define DEFAULT_GRID_ENABLED false
#define DEFAULT_FACE_DETECTION_ENABLED true
#define DEFAULT_ZOOM_AS_SHUTTER false
+#define DEFAULT_PROXIMITY_AS_SHUTTER false
#define DEFAULT_DEVICE 0
Settings::Settings(QObject *parent) :
}
}
+bool Settings::isProximityAsShutterEnabled() const {
+ return m_settings->value("camera/proximityAsShutter", DEFAULT_PROXIMITY_AS_SHUTTER).toBool();
+}
+
+void Settings::setProximityAsShutterEnabled(bool enabled) {
+ if (isProximityAsShutterEnabled() != enabled) {
+ m_settings->setValue("camera/proximityAsShutter", enabled);
+
+ emit proximityAsShutterChanged();
+ }
+}
+
int Settings::device() const {
return m_settings->value("camera/device", DEFAULT_DEVICE).toInt();
}
Q_PROPERTY(bool faceDetectionEnabled READ isFaceDetectionEnabled WRITE setFaceDetectionEnabled NOTIFY faceDetectionEnabledChanged);
Q_PROPERTY(bool zoomAsShutter READ isZoomAsShutterEnabled WRITE setZoomAsShutterEnabled NOTIFY zoomAsShutterChanged);
+ Q_PROPERTY(bool proximityAsShutter READ isProximityAsShutterEnabled WRITE setProximityAsShutterEnabled NOTIFY proximityAsShutterChanged);
Q_PROPERTY(int device READ device WRITE setDevice NOTIFY deviceChanged);
public:
bool isZoomAsShutterEnabled() const;
void setZoomAsShutterEnabled(bool enabled);
+ bool isProximityAsShutterEnabled() const;
+ void setProximityAsShutterEnabled(bool enabled);
+
int device() const;
void setDevice(int device);
void gridEnabledChanged();
void faceDetectionEnabledChanged();
void zoomAsShutterChanged();
+ void proximityAsShutterChanged();
void deviceAboutToChange();
void deviceChanged();