--- /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 "focus.h"
+#include "camera.h"
+
+Focus::Focus(QObject *parent) :
+ Capability(parent),
+ m_f(0) {
+
+}
+
+Focus::~Focus() {
+ if (m_f) {
+ delete m_f; m_f = 0;
+ }
+}
+
+void Focus::deviceChanged() {
+ if (m_f) {
+ delete m_f; m_f = 0;
+ }
+
+ if (m_cam->device()) {
+ m_f = new QtCamFocus(m_cam->device(), this);
+ QObject::connect(m_f, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
+ }
+
+ emit valueChanged();
+}
+
+Focus::FocusMode Focus::value() {
+ return m_f ? (FocusMode)m_f->value() : Focus::Auto;
+}
+
+void Focus::setValue(const Focus::FocusMode& mode) {
+ if (m_f) {
+ m_f->setValue((QtCamFocus::FocusMode)mode);
+ }
+}
--- /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 FOCUS_H
+#define FOCUS_H
+
+#include "capability.h"
+#include "qtcamfocus.h"
+
+class Focus : public Capability {
+ Q_OBJECT
+
+ Q_PROPERTY(FocusMode value READ value WRITE setValue NOTIFY valueChanged);
+ Q_ENUMS(FocusMode);
+
+public:
+ typedef enum {
+ Auto = QtCamFocus::Auto,
+ Macro = QtCamFocus::Macro,
+ Portrait = QtCamFocus::Portrait,
+ Infinity = QtCamFocus::Infinity,
+ Hyperfocal = QtCamFocus::Hyperfocal,
+ Extended = QtCamFocus::Extended,
+ ContinuousNormal = QtCamFocus::ContinuousNormal,
+ ContinuousExtended = QtCamFocus::ContinuousExtended,
+ Sport = QtCamFocus::Sport,
+ } FocusMode;
+
+ Focus(QObject *parent = 0);
+ ~Focus();
+
+ FocusMode value();
+ void setValue(const FocusMode& mode);
+
+signals:
+ void valueChanged();
+
+private:
+ virtual void deviceChanged();
+
+ QtCamFocus *m_f;
+};
+
+#endif /* 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
+ notificationscontainer.h sounds.h focus.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
+ notificationscontainer.cpp sounds.cpp focus.cpp
#include "iso.h"
#include "noisereduction.h"
#include "flickerreduction.h"
+#include "focus.h"
#include "mute.h"
#include "metadata.h"
#include "imagesettings.h"
qmlRegisterType<Iso>(URI, MAJOR, MINOR, "Iso");
qmlRegisterType<NoiseReduction>(URI, MAJOR, MINOR, "NoiseReduction");
qmlRegisterType<FlickerReduction>(URI, MAJOR, MINOR, "FlickerReduction");
+ qmlRegisterType<Focus>(URI, MAJOR, MINOR, "Focus");
qmlRegisterType<Mute>(URI, MAJOR, MINOR, "Mute");
qmlRegisterType<MetaData>(URI, MAJOR, MINOR, "MetaData");
qmlRegisterType<ImageSettings>(URI, MAJOR, MINOR, "ImageSettings");
qtcamzoom.h qtcamflash.h qtcamscene.h qtcamevcomp.h qtcamvideotorch.h \
qtcamwhitebalance.h qtcamcolortone.h qtcamflickerreduction.h \
qtcamnoisereduction.h qtcamiso.h qtcamaperture.h qtcamexposure.h \
- qtcammute.h qtcamnotifications.h
+ qtcammute.h qtcamnotifications.h qtcamfocus.h
SOURCES += qtcamconfig.cpp qtcamera.cpp qtcamscanner.cpp qtcamdevice.cpp qtcamviewfinder.cpp \
qtcammode.cpp qtcamgstreamermessagehandler.cpp qtcamgstreamermessagelistener.cpp \
qtcamzoom.cpp qtcamflash.cpp qtcamscene.cpp qtcamevcomp.cpp qtcamvideotorch.cpp \
qtcamwhitebalance.cpp qtcamcolortone.cpp qtcamflickerreduction.cpp \
qtcamnoisereduction.cpp qtcamiso.cpp qtcamaperture.cpp qtcamexposure.cpp \
- qtcammute.cpp qtcamnotifications.cpp
+ qtcammute.cpp qtcamnotifications.cpp qtcamfocus.cpp
HEADERS += qtcammode_p.h qtcamdevice_p.h qtcamcapability_p.h
--- /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 "qtcamfocus.h"
+#include "qtcamcapability_p.h"
+
+QtCamFocus::QtCamFocus(QtCamDevice *dev, QObject *parent) :
+ QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::Focus, "focus-mode"), parent) {
+
+}
+
+QtCamFocus::~QtCamFocus() {
+
+}
+
+QtCamFocus::FocusMode QtCamFocus::value() {
+ int val = 0;
+ if (!d_ptr->intValue(&val)) {
+ return QtCamFocus::Auto;
+ }
+
+ switch (val) {
+ case QtCamFocus::Macro:
+ case QtCamFocus::Portrait:
+ case QtCamFocus::Infinity:
+ case QtCamFocus::Hyperfocal:
+ case QtCamFocus::Extended:
+ case QtCamFocus::ContinuousNormal:
+ case QtCamFocus::ContinuousExtended:
+ case QtCamFocus::Sport:
+ return (QtCamFocus::FocusMode)val;
+
+ default:
+ return QtCamFocus::Auto;
+ }
+}
+
+bool QtCamFocus::setValue(const FocusMode& mode) {
+ return d_ptr->setIntValue(mode, 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 QT_CAM_FOCUS_H
+#define QT_CAM_FOCUS_H
+
+#include "qtcamcapability.h"
+
+class QtCamFocus : public QtCamCapability {
+ Q_OBJECT
+
+public:
+ typedef enum {
+ Auto = 0,
+ Macro = 1,
+ Portrait = 2,
+ Infinity = 3,
+ Hyperfocal = 4,
+ Extended = 5,
+ ContinuousNormal = 6,
+ ContinuousExtended = 7,
+ Sport = 8,
+ } FocusMode;
+
+ QtCamFocus(QtCamDevice *dev, QObject *parent = 0);
+ ~QtCamFocus();
+
+ FocusMode value();
+ bool setValue(const FocusMode& mode);
+};
+
+#endif /* QT_CAM_FOCUS_H */