#include "videomute.h"
#include "videotorch.h"
+#include "cameraconfig.h"
Camera::Camera(QDeclarativeItem *parent) :
QDeclarativeItem(parent),
m_autoFocus(0),
m_roi(0),
m_videoMute(0),
- m_videoTorch(0) {
+ m_videoTorch(0),
+ m_config(new CameraConfig(this)) {
QObject::connect(m_vf, SIGNAL(renderAreaChanged()), this, SIGNAL(renderAreaChanged()));
QObject::connect(m_vf, SIGNAL(videoResolutionChanged()), this, SIGNAL(videoResolutionChanged()));
void Camera::setRenderingEnabled(bool enabled) {
m_vf->setRenderingEnabled(enabled);
}
+
+CameraConfig *Camera::cameraConfig() const {
+ return m_config;
+}
class Roi;
class VideoMute;
class VideoTorch;
+class CameraConfig;
class Camera : public QDeclarativeItem {
Q_OBJECT
Q_PROPERTY(VideoTorch *videoTorch READ videoTorch NOTIFY videoTorchChanged);
Q_PROPERTY(bool renderingEnabled READ isRenderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged);
+ // TODO: We need a setter here too.
+ Q_PROPERTY(CameraConfig *cameraConfig READ cameraConfig CONSTANT);
Q_ENUMS(CameraMode);
bool isRenderingEnabled() const;
void setRenderingEnabled(bool enabled);
+ CameraConfig *cameraConfig() const;
+
signals:
void deviceCountChanged();
void deviceIdChanged();
void videoTorchChanged();
void renderingEnabledChanged();
+ void cameraConfigChanged();
+
protected:
void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
VideoMute *m_videoMute;
VideoTorch *m_videoTorch;
+ CameraConfig *m_config;
};
#endif /* CAMERA_H */
--- /dev/null
+// -*- c++ -*-
+
+/*!
+ * 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
+ */
+
+#include "cameraconfig.h"
+#include "qtcamconfig.h"
+#include <QDeclarativeInfo>
+
+CameraConfig::CameraConfig(QObject *parent) :
+ QObject(parent),
+ m_config(0) {
+
+}
+
+CameraConfig::~CameraConfig() {
+ m_config = 0;
+}
+
+QString CameraConfig::configPath() const {
+ return m_path;
+}
+
+void CameraConfig::setConfigPath(const QString& configPath) {
+ if (m_config) {
+ qmlInfo(this) << "configPath cannot be changed after initialization";
+ return;
+ }
+
+ if (m_path != configPath) {
+ m_path = configPath;
+ emit configPathChanged();
+ }
+}
+
+QtCamConfig *CameraConfig::config() const {
+ return m_config;
+}
+
+void CameraConfig::classBegin() {
+ // Nothing
+}
+
+void CameraConfig::componentComplete() {
+ if (m_path.isEmpty()) {
+ m_config = new QtCamConfig(this);
+ }
+ else {
+ m_config = new QtCamConfig(m_path, this);
+ }
+}
--- /dev/null
+// -*- c++ -*-
+
+/*!
+ * 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
+ */
+
+#ifndef CAMERA_CONFIG_H
+#define CAMERA_CONFIG_H
+
+#include <QObject>
+#include <QDeclarativeParserStatus>
+
+class QtCamConfig;
+
+class CameraConfig : public QObject, public QDeclarativeParserStatus {
+ Q_OBJECT
+
+ Q_PROPERTY(QString configPath READ configPath WRITE setConfigPath NOTIFY configPathChanged);
+
+public:
+ CameraConfig(QObject *parent = 0);
+ ~CameraConfig();
+
+ QString configPath() const;
+ void setConfigPath(const QString& configPath);
+
+ QtCamConfig *config() const;
+
+ virtual void classBegin();
+ virtual void componentComplete();
+
+signals:
+ void configPathChanged();
+
+private:
+ QString m_path;
+ QtCamConfig *m_config;
+};
+
+#endif /* CAMERA_CONFIG_H */
flickerreduction.h videomute.h metadata.h imagesettings.h \
imageresolutionmodel.h videosettings.h videoresolutionmodel.h \
notificationscontainer.h sounds.h focus.h autofocus.h \
- roi.h
+ roi.h cameraconfig.h
SOURCES += plugin.cpp previewprovider.cpp camera.cpp mode.cpp imagemode.cpp videomode.cpp \
zoom.cpp flash.cpp scene.cpp evcomp.cpp videotorch.cpp whitebalance.cpp \
flickerreduction.cpp videomute.cpp metadata.cpp imagesettings.cpp \
imageresolutionmodel.cpp videosettings.cpp videoresolutionmodel.cpp \
notificationscontainer.cpp sounds.cpp focus.cpp autofocus.cpp \
- roi.cpp
+ roi.cpp cameraconfig.cpp
HEADERS += declarativeqtcameranotifications.h
#include "videoresolutionmodel.h"
#include "declarativeqtcameranotifications.h"
#include "sounds.h"
-
+#include "cameraconfig.h"
#include <QtDeclarative>
-#define URI "QtCamera"
#define MAJOR 1
#define MINOR 0
"VideoResolutionModel can be obtained from VideoSettings");
qmlRegisterType<Mode>();
+ qmlRegisterType<CameraConfig>(uri, MAJOR, MINOR, "CameraConfig");
}
Q_EXPORT_PLUGIN2(declarativeqtcamera, Plugin);