--- /dev/null
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 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
+ */
+
+#include "autofocus.h"
+#include "camera.h"
+
+AutoFocus::AutoFocus(QObject *parent) :
+ Capability(parent),
+ m_af(0) {
+
+}
+AutoFocus::~AutoFocus() {
+ if (m_af) {
+ delete m_af; m_af = 0;
+ }
+}
+
+void AutoFocus::deviceChanged() {
+ if (m_af) {
+ delete m_af; m_af = 0;
+ }
+
+ if (m_cam->device()) {
+ m_af = new QtCamAutoFocus(m_cam->device(), this);
+ QObject::connect(m_af, SIGNAL(statusChanged()), this, SIGNAL(valueChanged()));
+ QObject::connect(m_af, SIGNAL(cafStatusChanged()), this, SIGNAL(cafValueChanged()));
+ }
+
+ emit valueChanged();
+ emit cafValueChanged();
+}
+
+AutoFocus::Status AutoFocus::status() {
+ return m_af ? (AutoFocus::Status)m_af->status() : AutoFocus::None;
+}
+
+AutoFocus::Status AutoFocus::cafStatus() {
+ return m_af ? (AutoFocus::Status)m_af->cafStatus() : AutoFocus::None;
+}
+
+bool AutoFocus::startAutoFocus() {
+ if (m_af) {
+ return m_af->startAutoFocus();
+ }
+
+ return false;
+}
+
+bool AutoFocus::stopAutoFocus() {
+ if (m_af) {
+ return m_af->stopAutoFocus();
+ }
+
+ return false;
+}
--- /dev/null
+// -*- c++ -*-
+
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 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
+ */
+
+#ifndef AUTO_FOCUS_H
+#define AUTO_FOCUS_H
+
+#include "capability.h"
+#include "qtcamautofocus.h"
+
+class AutoFocus : public Capability {
+ Q_OBJECT
+ Q_PROPERTY(Status status READ status NOTIFY valueChanged);
+ Q_PROPERTY(Status cafStatus READ cafStatus NOTIFY cafValueChanged);
+ Q_ENUMS(Status);
+
+public:
+ typedef enum {
+ None = QtCamAutoFocus::None,
+ Running = QtCamAutoFocus::Running,
+ Fail = QtCamAutoFocus::Fail,
+ Success = QtCamAutoFocus::Success,
+ } Status;
+
+ AutoFocus(QObject *parent = 0);
+ ~AutoFocus();
+
+ Q_INVOKABLE bool startAutoFocus();
+ Q_INVOKABLE bool stopAutoFocus();
+
+ Status status();
+ Status cafStatus();
+
+signals:
+ void valueChanged();
+ void cafValueChanged();
+
+private:
+ virtual void deviceChanged();
+
+ QtCamAutoFocus *m_af;
+};
+
+#endif /* AUTO_FOCUS_H */
colortone.h exposure.h aperture.h iso.h noisereduction.h \
flickerreduction.h mute.h metadata.h imagesettings.h imageresolutionmodel.h \
videosettings.h videoresolutionmodel.h notifications.h \
- notificationscontainer.h sounds.h focus.h
+ notificationscontainer.h sounds.h focus.h autofocus.h
SOURCES += plugin.cpp previewprovider.cpp camera.cpp mode.cpp imagemode.cpp videomode.cpp \
capability.cpp zoom.cpp flash.cpp scene.cpp evcomp.cpp videotorch.cpp whitebalance.cpp \
colortone.cpp exposure.cpp aperture.cpp iso.cpp noisereduction.cpp \
flickerreduction.cpp mute.cpp metadata.cpp imagesettings.cpp imageresolutionmodel.cpp \
videosettings.cpp videoresolutionmodel.cpp notifications.cpp \
- notificationscontainer.cpp sounds.cpp focus.cpp
+ notificationscontainer.cpp sounds.cpp focus.cpp autofocus.cpp
#include "noisereduction.h"
#include "flickerreduction.h"
#include "focus.h"
+#include "autofocus.h"
#include "mute.h"
#include "metadata.h"
#include "imagesettings.h"
qmlRegisterType<NoiseReduction>(URI, MAJOR, MINOR, "NoiseReduction");
qmlRegisterType<FlickerReduction>(URI, MAJOR, MINOR, "FlickerReduction");
qmlRegisterType<Focus>(URI, MAJOR, MINOR, "Focus");
+ qmlRegisterType<AutoFocus>(URI, MAJOR, MINOR, "AutoFocus");
qmlRegisterType<Mute>(URI, MAJOR, MINOR, "Mute");
qmlRegisterType<MetaData>(URI, MAJOR, MINOR, "MetaData");
qmlRegisterType<ImageSettings>(URI, MAJOR, MINOR, "ImageSettings");