*/
#include "aperture.h"
-#include "camera.h"
#include "qtcamaperture.h"
-Aperture::Aperture(QObject *parent) :
- Capability(parent),
- m_aperture(0) {
+Aperture::Aperture(QtCamDevice *dev, QObject *parent) :
+ QObject(parent),
+ m_aperture(new QtCamAperture(dev, this)) {
+ QObject::connect(m_aperture, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
+ QObject::connect(m_aperture, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
+ QObject::connect(m_aperture, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
}
Aperture::~Aperture() {
- if (m_aperture) {
- delete m_aperture; m_aperture = 0;
- }
-}
-
-void Aperture::deviceChanged() {
- if (m_aperture) {
- delete m_aperture; m_aperture = 0;
- }
-
- if (m_cam->device()) {
- m_aperture = new QtCamAperture(m_cam->device(), this);
- QObject::connect(m_aperture, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
- QObject::connect(m_aperture, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
- QObject::connect(m_aperture, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
- }
-
- emit valueChanged();
- emit minimumChanged();
- emit maximunmChanged();
+ delete m_aperture; m_aperture = 0;
}
unsigned int Aperture::value() {
- return m_aperture ? m_aperture->value() : 0;
+ return m_aperture->value();
}
void Aperture::setValue(unsigned int val) {
- if (m_aperture) {
- m_aperture->setValue(val);
- }
+ m_aperture->setValue(val);
}
unsigned int Aperture::minimum() {
- return m_aperture ? m_aperture->minimumValue() : 0;
+ return m_aperture->minimumValue();
}
unsigned int Aperture::maximum() {
- return m_aperture ? m_aperture->maximumValue() : 0;
+ return m_aperture->maximumValue();
}
#ifndef APERTURE_H
#define APERTURE_H
-#include "capability.h"
+#include <QObject>
class QtCamAperture;
+class QtCamDevice;
-class Aperture : public Capability {
+class Aperture : public QObject {
Q_OBJECT
Q_PROPERTY(unsigned int value READ value WRITE setValue NOTIFY valueChanged);
Q_PROPERTY(unsigned int maximum READ maximum NOTIFY maximunmChanged);
public:
- Aperture(QObject *parent = 0);
+ Aperture(QtCamDevice *dev, QObject *parent = 0);
~Aperture();
unsigned int value();
void maximunmChanged();
private:
- virtual void deviceChanged();
-
QtCamAperture *m_aperture;
};
*/
#include "autofocus.h"
-#include "camera.h"
-AutoFocus::AutoFocus(QObject *parent) :
- Capability(parent),
- m_af(0) {
+AutoFocus::AutoFocus(QtCamDevice *dev, QObject *parent) :
+ QObject(parent),
+ m_af(new QtCamAutoFocus(dev, this)) {
+ QObject::connect(m_af, SIGNAL(statusChanged()), this, SIGNAL(valueChanged()));
+ QObject::connect(m_af, SIGNAL(cafStatusChanged()), this, SIGNAL(cafValueChanged()));
}
-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::~AutoFocus() {
+ delete m_af; m_af = 0;
}
AutoFocus::Status AutoFocus::status() {
- return m_af ? (AutoFocus::Status)m_af->status() : AutoFocus::None;
+ return (AutoFocus::Status)m_af->status();
}
AutoFocus::Status AutoFocus::cafStatus() {
- return m_af ? (AutoFocus::Status)m_af->cafStatus() : AutoFocus::None;
+ return (AutoFocus::Status)m_af->cafStatus();
}
bool AutoFocus::startAutoFocus() {
- if (m_af) {
- return m_af->startAutoFocus();
- }
-
- return false;
+ return m_af->startAutoFocus();
}
bool AutoFocus::stopAutoFocus() {
- if (m_af) {
- return m_af->stopAutoFocus();
- }
-
- return false;
+ return m_af->stopAutoFocus();
}
#ifndef AUTO_FOCUS_H
#define AUTO_FOCUS_H
-#include "capability.h"
+#include <QObject>
#include "qtcamautofocus.h"
-class AutoFocus : public Capability {
+class QtCamDevice;
+
+class AutoFocus : public QObject {
Q_OBJECT
Q_PROPERTY(Status status READ status NOTIFY valueChanged);
Q_PROPERTY(Status cafStatus READ cafStatus NOTIFY cafValueChanged);
Success = QtCamAutoFocus::Success,
} Status;
- AutoFocus(QObject *parent = 0);
+ AutoFocus(QtCamDevice *dev, QObject *parent = 0);
~AutoFocus();
Q_INVOKABLE bool startAutoFocus();
void cafValueChanged();
private:
- virtual void deviceChanged();
-
QtCamAutoFocus *m_af;
};
#include "sounds.h"
#include <QDeclarativeInfo>
+#include "zoom.h"
+#include "flash.h"
+#include "scene.h"
+#include "evcomp.h"
+#include "whitebalance.h"
+#include "colortone.h"
+#include "iso.h"
+#include "exposure.h"
+#include "aperture.h"
+#include "noisereduction.h"
+#include "flickerreduction.h"
+#include "focus.h"
+#include "autofocus.h"
+
// TODO: a viewfinder class that inherits QDeclarativeItem
Camera::Camera(QDeclarativeItem *parent) :
m_dev(0),
m_vf(new QtCamGraphicsViewfinder(m_cam->config(), this)),
m_mode(Camera::UnknownMode),
- m_notifications(new NotificationsContainer(this)) {
+ m_notifications(new NotificationsContainer(this)),
+ m_zoom(0),
+ m_flash(0),
+ m_scene(0),
+ m_evComp(0),
+ m_whiteBalance(0),
+ m_colorTone(0),
+ m_iso(0),
+ m_exposure(0),
+ m_aperture(0),
+ m_noiseReduction(0),
+ m_flickerReduction(0),
+ m_focus(0),
+ m_autoFocus(0) {
+
// TODO:
}
m_dev = 0;
}
+ delete m_zoom;
+ delete m_flash;
+ delete m_scene;
+ delete m_evComp;
+ delete m_whiteBalance;
+ delete m_colorTone;
+ delete m_iso;
+ delete m_exposure;
+ delete m_aperture;
+ delete m_noiseReduction;
+ delete m_flickerReduction;
+ delete m_focus;
+ delete m_autoFocus;
+
// TODO: cleanup
}
if (oldId != m_id) {
emit deviceIdChanged();
emit deviceChanged();
+
+ resetCapabilities();
}
if (oldMode != m_mode) {
emit notificationsChanged();
}
}
+
+void Camera::resetCapabilities() {
+ QtCamDevice *dev = device();
+
+ delete m_zoom;
+ m_zoom = new Zoom(dev, this);
+ emit zoomChanged();
+
+ delete m_flash;
+ m_flash = new Flash(dev, this);
+ emit flashChanged();
+
+ delete m_scene;
+ m_scene = new Scene(dev, this);
+ emit sceneChanged();
+
+ delete m_evComp;
+ m_evComp = new EvComp(dev, this);
+ emit evCompChanged();
+
+ delete m_whiteBalance;
+ m_whiteBalance = new WhiteBalance(dev, this);
+ emit whiteBalanceChanged();
+
+ delete m_colorTone;
+ m_colorTone = new ColorTone(dev, this);
+ emit colorToneChanged();
+
+ delete m_iso;
+ m_iso = new Iso(dev, this);
+ emit isoChanged();
+
+ delete m_exposure;
+ m_exposure = new Exposure(dev, this);
+ emit exposureChanged();
+
+ delete m_aperture;
+ m_aperture = new Aperture(dev, this);
+ emit apertureChanged();
+
+ delete m_noiseReduction;
+ m_noiseReduction = new NoiseReduction(dev, this);
+ emit noiseReductionChanged();
+
+ delete m_flickerReduction;
+ m_flickerReduction = new FlickerReduction(dev, this);
+ emit flickerReductionChanged();
+
+ delete m_focus;
+ m_focus = new Focus(dev, this);
+ emit focusChanged();
+
+ delete m_autoFocus;
+ m_autoFocus = new AutoFocus(dev, this);
+ emit autoFocusChanged();
+}
+
+Zoom *Camera::zoom() const {
+ return m_zoom;
+}
+
+Flash *Camera::flash() const {
+ return m_flash;
+}
+
+Scene *Camera::scene() const {
+ return m_scene;
+}
+
+EvComp *Camera::evComp() const {
+ return m_evComp;
+}
+
+WhiteBalance *Camera::whiteBalance() const {
+ return m_whiteBalance;
+}
+
+ColorTone *Camera::colorTone() const {
+ return m_colorTone;
+}
+
+Iso *Camera::iso() const {
+ return m_iso;
+}
+
+Exposure *Camera::exposure() const {
+ return m_exposure;
+}
+
+Aperture *Camera::aperture() const {
+ return m_aperture;
+}
+
+NoiseReduction *Camera::noiseReduction() const {
+ return m_noiseReduction;
+}
+
+FlickerReduction *Camera::flickerReduction() const {
+ return m_flickerReduction;
+}
+
+Focus *Camera::focus() const {
+ return m_focus;
+}
+
+AutoFocus *Camera::autoFocus() const {
+ return m_autoFocus;
+}
class QtCamGraphicsViewfinder;
class Notifications;
class NotificationsContainer;
+class Zoom;
+class Flash;
+class Scene;
+class EvComp;
+class WhiteBalance;
+class ColorTone;
+class Iso;
+class Exposure;
+class Aperture;
+class NoiseReduction;
+class FlickerReduction;
+class Focus;
+class AutoFocus;
class Camera : public QDeclarativeItem {
Q_OBJECT
Q_PROPERTY(QString videoSuffix READ videoSuffix CONSTANT);
Q_PROPERTY(Notifications *notifications READ notifications WRITE setNotifications NOTIFY notificationsChanged);
+ Q_PROPERTY(Zoom *zoom READ zoom NOTIFY zoomChanged);
+ Q_PROPERTY(Flash *flash READ flash NOTIFY flashChanged);
+ Q_PROPERTY(Scene *scene READ scene NOTIFY sceneChanged);
+ Q_PROPERTY(EvComp *evComp READ evComp NOTIFY evCompChanged);
+ Q_PROPERTY(WhiteBalance *whiteBalance READ whiteBalance NOTIFY whiteBalanceChanged);
+ Q_PROPERTY(ColorTone *colorTone READ colorTone NOTIFY colorToneChanged);
+ Q_PROPERTY(Iso *iso READ iso NOTIFY isoChanged);
+ Q_PROPERTY(Exposure *exposure READ exposure NOTIFY exposureChanged);
+ Q_PROPERTY(Aperture *aperture READ aperture NOTIFY apertureChanged);
+ Q_PROPERTY(NoiseReduction *noiseReduction READ noiseReduction NOTIFY noiseReductionChanged);
+ Q_PROPERTY(FlickerReduction *flickerReduction READ flickerReduction NOTIFY flickerReductionChanged);
+ Q_PROPERTY(Focus *focus READ focus NOTIFY focusChanged);
+ Q_PROPERTY(AutoFocus *autoFocus READ autoFocus NOTIFY autoFocusChanged);
+
Q_ENUMS(CameraMode);
public:
Notifications *notifications() const;
void setNotifications(Notifications *notifications);
+ Zoom *zoom() const;
+ Flash *flash() const;
+ Scene *scene() const;
+ EvComp *evComp() const;
+ WhiteBalance *whiteBalance() const;
+ ColorTone *colorTone() const;
+ Iso *iso() const;
+ Exposure *exposure() const;
+ Aperture *aperture() const;
+ NoiseReduction *noiseReduction() const;
+ FlickerReduction *flickerReduction() const;
+ Focus *focus() const;
+ AutoFocus *autoFocus() const;
+
signals:
void deviceCountChanged();
void deviceIdChanged();
void error(const QString& message, int code, const QString& debug);
void notificationsChanged();
+ void zoomChanged();
+ void flashChanged();
+ void sceneChanged();
+ void evCompChanged();
+ void whiteBalanceChanged();
+ void colorToneChanged();
+ void isoChanged();
+ void exposureChanged();
+ void apertureChanged();
+ void noiseReductionChanged();
+ void flickerReductionChanged();
+ void focusChanged();
+ void autoFocusChanged();
+
protected:
void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
bool setDeviceId(const QVariant& deviceId);
bool setMode(const CameraMode& mode);
+ void resetCapabilities();
+
QtCamera *m_cam;
QtCamDevice *m_dev;
QVariant m_id;
QtCamGraphicsViewfinder *m_vf;
CameraMode m_mode;
NotificationsContainer *m_notifications;
+
+ Zoom *m_zoom;
+ Flash *m_flash;
+ Scene *m_scene;
+ EvComp *m_evComp;
+ WhiteBalance *m_whiteBalance;
+ ColorTone *m_colorTone;
+ Iso *m_iso;
+ Exposure *m_exposure;
+ Aperture *m_aperture;
+ NoiseReduction *m_noiseReduction;
+ FlickerReduction *m_flickerReduction;
+ Focus *m_focus;
+ AutoFocus *m_autoFocus;
};
#endif /* CAMERA_H */
+++ /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 CAPABILITY_H
-#define CAPABILITY_H
-
-#include <QObject>
-
-class Camera;
-
-class Capability : public QObject {
- Q_OBJECT
- Q_PROPERTY(Camera* camera READ camera WRITE setCamera NOTIFY cameraChanged);
- Q_PROPERTY(bool ready READ isReady NOTIFY isReadyChanged);
-
-public:
- Capability(QObject *parent = 0);
- virtual ~Capability();
-
- Camera *camera();
- void setCamera(Camera *cam);
-
- bool isReady() const;
-
-signals:
- void cameraChanged();
- void isReadyChanged();
-
-private slots:
- virtual void deviceChanged() = 0;
-
-protected:
- Camera *m_cam;
-};
-
-#endif /* CAPABILITY_H */
*/
#include "colortone.h"
-#include "camera.h"
-ColorTone::ColorTone(QObject *parent) :
- Capability(parent),
- m_color(0) {
+ColorTone::ColorTone(QtCamDevice *dev, QObject *parent) :
+ QObject(parent),
+ m_color(new QtCamColorTone(dev, this)) {
+ QObject::connect(m_color, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
}
ColorTone::~ColorTone() {
- if (m_color) {
- delete m_color; m_color = 0;
- }
-}
-
-void ColorTone::deviceChanged() {
- if (m_color) {
- delete m_color; m_color = 0;
- }
-
- if (m_cam->device()) {
- m_color = new QtCamColorTone(m_cam->device(), this);
- QObject::connect(m_color, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
- }
-
- emit valueChanged();
+ delete m_color; m_color = 0;
}
ColorTone::ColorToneMode ColorTone::value() {
- return m_color ? (ColorToneMode)m_color->value() : ColorTone::Normal;
+ return (ColorToneMode)m_color->value();
}
void ColorTone::setValue(const ColorTone::ColorToneMode& mode) {
- if (m_color) {
- m_color->setValue((QtCamColorTone::ColorToneMode)mode);
- }
+ m_color->setValue((QtCamColorTone::ColorToneMode)mode);
}
#ifndef COLOR_TONE_H
#define COLOR_TONE_H
-#include "capability.h"
+#include <QObject>
#include "qtcamcolortone.h"
-class ColorTone : public Capability {
+class QtCamDevice;
+
+class ColorTone : public QObject {
Q_OBJECT
Q_PROPERTY(ColorToneMode value READ value WRITE setValue NOTIFY valueChanged);
SkinWhite = QtCamColorTone::SkinWhite,
} ColorToneMode;
- ColorTone(QObject *parent = 0);
+ ColorTone(QtCamDevice *dev, QObject *parent = 0);
~ColorTone();
ColorToneMode value();
void valueChanged();
private:
- virtual void deviceChanged();
-
QtCamColorTone *m_color;
};
*/
#include "evcomp.h"
-#include "camera.h"
#include "qtcamevcomp.h"
-EvComp::EvComp(QObject *parent) :
- Capability(parent),
- m_evComp(0) {
+EvComp::EvComp(QtCamDevice *dev, QObject *parent) :
+ QObject(parent),
+ m_evComp(new QtCamEvComp(dev, this)) {
+ QObject::connect(m_evComp, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
+ QObject::connect(m_evComp, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
+ QObject::connect(m_evComp, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
}
EvComp::~EvComp() {
- if (m_evComp) {
- delete m_evComp; m_evComp = 0;
- }
-}
-
-void EvComp::deviceChanged() {
- if (m_evComp) {
- delete m_evComp; m_evComp = 0;
- }
-
- if (m_cam->device()) {
- m_evComp = new QtCamEvComp(m_cam->device(), this);
- QObject::connect(m_evComp, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
- QObject::connect(m_evComp, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
- QObject::connect(m_evComp, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
- }
-
- emit valueChanged();
- emit minimumChanged();
- emit maximunmChanged();
+ delete m_evComp; m_evComp = 0;
}
qreal EvComp::value() {
- return m_evComp ? m_evComp->value() : 0.0;
+ return m_evComp->value();
}
void EvComp::setValue(qreal val) {
- if (m_evComp) {
- m_evComp->setValue(val);
- }
+ m_evComp->setValue(val);
}
qreal EvComp::minimum() {
- return m_evComp ? m_evComp->minimumValue() : 0.0;
+ return m_evComp->minimumValue();
}
qreal EvComp::maximum() {
- return m_evComp ? m_evComp->maximumValue() : 0.0;
+ return m_evComp->maximumValue();
}
#ifndef EV_COMP_H
#define EV_COMP_H
-#include "capability.h"
+#include <QObject>
class QtCamEvComp;
+class QtCamDevice;
-class EvComp : public Capability {
+class EvComp : public QObject {
Q_OBJECT
Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged);
Q_PROPERTY(qreal maximum READ maximum NOTIFY maximunmChanged);
public:
- EvComp(QObject *parent = 0);
+ EvComp(QtCamDevice *dev, QObject *parent = 0);
~EvComp();
qreal value();
void maximunmChanged();
private:
- virtual void deviceChanged();
-
QtCamEvComp *m_evComp;
};
#include "camera.h"
#include "qtcamexposure.h"
-Exposure::Exposure(QObject *parent) :
- Capability(parent),
- m_exposure(0) {
+Exposure::Exposure(QtCamDevice *dev, QObject *parent) :
+ QObject(parent),
+ m_exposure(new QtCamExposure(dev, this)) {
+ QObject::connect(m_exposure, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
+ QObject::connect(m_exposure, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
+ QObject::connect(m_exposure, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
}
Exposure::~Exposure() {
- if (m_exposure) {
- delete m_exposure; m_exposure = 0;
- }
-}
-
-void Exposure::deviceChanged() {
- if (m_exposure) {
- delete m_exposure; m_exposure = 0;
- }
-
- if (m_cam->device()) {
- m_exposure = new QtCamExposure(m_cam->device(), this);
- QObject::connect(m_exposure, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
- QObject::connect(m_exposure, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
- QObject::connect(m_exposure, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
- }
-
- emit valueChanged();
- emit minimumChanged();
- emit maximunmChanged();
+ delete m_exposure; m_exposure = 0;
}
unsigned int Exposure::value() {
- return m_exposure ? m_exposure->value() : 0;
+ return m_exposure->value();
}
void Exposure::setValue(unsigned int val) {
- if (m_exposure) {
- m_exposure->setValue(val);
- }
+ m_exposure->setValue(val);
}
unsigned int Exposure::minimum() {
- return m_exposure ? m_exposure->minimumValue() : 0;
+ return m_exposure->minimumValue();
}
unsigned int Exposure::maximum() {
- return m_exposure ? m_exposure->maximumValue() : 0;
+ return m_exposure->maximumValue();
}
#ifndef EXPOSURE_H
#define EXPOSURE_H
-#include "capability.h"
+#include <QObject>
class QtCamExposure;
+class QtCamDevice;
-class Exposure : public Capability {
+class Exposure : public QObject {
Q_OBJECT
Q_PROPERTY(unsigned int value READ value WRITE setValue NOTIFY valueChanged);
Q_PROPERTY(unsigned int maximum READ maximum NOTIFY maximunmChanged);
public:
- Exposure(QObject *parent = 0);
+ Exposure(QtCamDevice *dev, QObject *parent = 0);
~Exposure();
unsigned int value();
void maximunmChanged();
private:
- virtual void deviceChanged();
-
QtCamExposure *m_exposure;
};
*/
#include "flash.h"
-#include "camera.h"
-Flash::Flash(QObject *parent) :
- Capability(parent),
- m_flash(0) {
+Flash::Flash(QtCamDevice *dev, QObject *parent) :
+ QObject(parent),
+ m_flash(new QtCamFlash(dev, this)) {
+ QObject::connect(m_flash, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
}
Flash::~Flash() {
- if (m_flash) {
- delete m_flash; m_flash = 0;
- }
-}
-
-void Flash::deviceChanged() {
- if (m_flash) {
- delete m_flash; m_flash = 0;
- }
-
- if (m_cam->device()) {
- m_flash = new QtCamFlash(m_cam->device(), this);
- QObject::connect(m_flash, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
- }
-
- emit valueChanged();
+ delete m_flash; m_flash = 0;
}
Flash::FlashMode Flash::value() {
- return m_flash ? (FlashMode)m_flash->value() : Flash::Auto;
+ return (FlashMode)m_flash->value();
}
void Flash::setValue(const Flash::FlashMode& mode) {
- if (m_flash) {
- m_flash->setValue((QtCamFlash::FlashMode)mode);
- }
+ m_flash->setValue((QtCamFlash::FlashMode)mode);
}
#ifndef FLASH_H
#define FLASH_H
-#include "capability.h"
+#include <QObject>
#include "qtcamflash.h"
-class Flash : public Capability {
+class QtCamDevice;
+
+class Flash : public QObject {
Q_OBJECT
Q_PROPERTY(FlashMode value READ value WRITE setValue NOTIFY valueChanged);
RedEye = QtCamFlash::RedEye
} FlashMode;
- Flash(QObject *parent = 0);
+ Flash(QtCamDevice *dev, QObject *parent = 0);
~Flash();
FlashMode value();
void valueChanged();
private:
- virtual void deviceChanged();
-
QtCamFlash *m_flash;
};
*/
#include "flickerreduction.h"
-#include "camera.h"
-FlickerReduction::FlickerReduction(QObject *parent) :
- Capability(parent),
- m_fr(0) {
+FlickerReduction::FlickerReduction(QtCamDevice *dev, QObject *parent) :
+ QObject(parent),
+ m_fr(new QtCamFlickerReduction(dev, this)) {
+ QObject::connect(m_fr, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
}
FlickerReduction::~FlickerReduction() {
- if (m_fr) {
- delete m_fr; m_fr = 0;
- }
-}
-
-void FlickerReduction::deviceChanged() {
- if (m_fr) {
- delete m_fr; m_fr = 0;
- }
-
- if (m_cam->device()) {
- m_fr = new QtCamFlickerReduction(m_cam->device(), this);
- QObject::connect(m_fr, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
- }
-
- emit valueChanged();
+ delete m_fr; m_fr = 0;
}
FlickerReduction::FlickerReductionMode FlickerReduction::value() {
- return m_fr ? (FlickerReductionMode)m_fr->value() : FlickerReduction::Off;
+ return (FlickerReductionMode)m_fr->value();
}
void FlickerReduction::setValue(const FlickerReduction::FlickerReductionMode& mode) {
- if (m_fr) {
- m_fr->setValue((QtCamFlickerReduction::FlickerReductionMode)mode);
- }
+ m_fr->setValue((QtCamFlickerReduction::FlickerReductionMode)mode);
}
#ifndef FLICKER_REDUCTION_H
#define FLICKER_REDUCTION_H
-#include "capability.h"
+#include <QObject>
#include "qtcamflickerreduction.h"
-class FlickerReduction : public Capability {
+class QtCamDevice;
+
+class FlickerReduction : public QObject {
Q_OBJECT
Q_PROPERTY(FlickerReductionMode value READ value WRITE setValue NOTIFY valueChanged);
Auto = QtCamFlickerReduction::Auto
} FlickerReductionMode;
- FlickerReduction(QObject *parent = 0);
+ FlickerReduction(QtCamDevice *dev, QObject *parent = 0);
~FlickerReduction();
FlickerReductionMode value();
void valueChanged();
private:
- virtual void deviceChanged();
-
QtCamFlickerReduction *m_fr;
};
*/
#include "focus.h"
-#include "camera.h"
-Focus::Focus(QObject *parent) :
- Capability(parent),
- m_f(0) {
+Focus::Focus(QtCamDevice *dev, QObject *parent) :
+ QObject(parent),
+ m_f(new QtCamFocus(dev, this)) {
+ QObject::connect(m_f, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
}
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();
+ delete m_f; m_f = 0;
}
Focus::FocusMode Focus::value() {
- return m_f ? (FocusMode)m_f->value() : Focus::Auto;
+ return (FocusMode)m_f->value();
}
void Focus::setValue(const Focus::FocusMode& mode) {
- if (m_f) {
- m_f->setValue((QtCamFocus::FocusMode)mode);
- }
+ m_f->setValue((QtCamFocus::FocusMode)mode);
}
#ifndef FOCUS_H
#define FOCUS_H
-#include "capability.h"
+#include <QObject>
#include "qtcamfocus.h"
-class Focus : public Capability {
+class QtCamDevice;
+
+class Focus : public QObject {
Q_OBJECT
Q_PROPERTY(FocusMode value READ value WRITE setValue NOTIFY valueChanged);
Sport = QtCamFocus::Sport,
} FocusMode;
- Focus(QObject *parent = 0);
+ Focus(QtCamDevice *dev, QObject *parent = 0);
~Focus();
FocusMode value();
void valueChanged();
private:
- virtual void deviceChanged();
-
QtCamFocus *m_f;
};
QT += declarative
HEADERS += plugin.h previewprovider.h camera.h mode.h imagemode.h videomode.h \
- capability.h zoom.h flash.h scene.h evcomp.h videotorch.h whitebalance.h \
+ zoom.h flash.h scene.h evcomp.h videotorch.h whitebalance.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 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 \
+ 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 \
*/
#include "iso.h"
-#include "camera.h"
#include "qtcamiso.h"
-Iso::Iso(QObject *parent) :
- Capability(parent),
- m_iso(0) {
+Iso::Iso(QtCamDevice *dev, QObject *parent) :
+ QObject(parent),
+ m_iso(new QtCamIso(dev, this)) {
+ QObject::connect(m_iso, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
+ QObject::connect(m_iso, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
+ QObject::connect(m_iso, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
}
Iso::~Iso() {
- if (m_iso) {
- delete m_iso; m_iso = 0;
- }
-}
-
-void Iso::deviceChanged() {
- if (m_iso) {
- delete m_iso; m_iso = 0;
- }
-
- if (m_cam->device()) {
- m_iso = new QtCamIso(m_cam->device(), this);
- QObject::connect(m_iso, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
- QObject::connect(m_iso, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
- QObject::connect(m_iso, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
- }
-
- emit valueChanged();
- emit minimumChanged();
- emit maximunmChanged();
+ delete m_iso; m_iso = 0;
}
unsigned int Iso::value() {
- return m_iso ? m_iso->value() : 0;
+ return m_iso->value();
}
void Iso::setValue(unsigned int val) {
- if (m_iso) {
- m_iso->setValue(val);
- }
+ m_iso->setValue(val);
}
unsigned int Iso::minimum() {
- return m_iso ? m_iso->minimumValue() : 0;
+ return m_iso->minimumValue();
}
unsigned int Iso::maximum() {
- return m_iso ? m_iso->maximumValue() : 0;
+ return m_iso->maximumValue();
}
#ifndef ISO_H
#define ISO_H
-#include "capability.h"
+#include <QObject>
class QtCamIso;
+class QtCamDevice;
-class Iso : public Capability {
+class Iso : public QObject {
Q_OBJECT
Q_PROPERTY(unsigned int value READ value WRITE setValue NOTIFY valueChanged);
Q_PROPERTY(unsigned int maximum READ maximum NOTIFY maximunmChanged);
public:
- Iso(QObject *parent = 0);
+ Iso(QtCamDevice *dev, QObject *parent = 0);
~Iso();
unsigned int value();
void maximunmChanged();
private:
- virtual void deviceChanged();
-
QtCamIso *m_iso;
};
*/
#include "noisereduction.h"
-#include "camera.h"
-NoiseReduction::NoiseReduction(QObject *parent) :
- Capability(parent),
- m_nr(0) {
+NoiseReduction::NoiseReduction(QtCamDevice *dev, QObject *parent) :
+ QObject(parent),
+ m_nr(new QtCamNoiseReduction(dev, this)) {
+ QObject::connect(m_nr, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
}
NoiseReduction::~NoiseReduction() {
- if (m_nr) {
- delete m_nr; m_nr = 0;
- }
+ delete m_nr; m_nr = 0;
}
-void NoiseReduction::deviceChanged() {
- if (m_nr) {
- delete m_nr; m_nr = 0;
- }
-
- if (m_cam->device()) {
- m_nr = new QtCamNoiseReduction(m_cam->device(), this);
- QObject::connect(m_nr, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
- }
-
- emit valueChanged();
-}
NoiseReduction::NoiseReductionMode NoiseReduction::value() {
- return m_nr ? (NoiseReductionMode)m_nr->value() : NoiseReduction::None;
+ return (NoiseReductionMode)m_nr->value();
}
void NoiseReduction::setValue(const NoiseReduction::NoiseReductionMode& mode) {
- if (m_nr) {
- m_nr->setValue((QtCamNoiseReduction::NoiseReductionMode)mode);
- }
+ m_nr->setValue((QtCamNoiseReduction::NoiseReductionMode)mode);
}
#ifndef NOISE_REDUCTION_H
#define NOISE_REDUCTION_H
-#include "capability.h"
+#include <QObject>
#include "qtcamnoisereduction.h"
-class NoiseReduction : public Capability {
+class QtCamDevice;
+
+class NoiseReduction : public QObject {
Q_OBJECT
Q_PROPERTY(NoiseReductionMode value READ value WRITE setValue NOTIFY valueChanged);
Extra = QtCamNoiseReduction::Extra
} NoiseReductionMode;
- NoiseReduction(QObject *parent = 0);
+ NoiseReduction(QtCamDevice *dev, QObject *parent = 0);
~NoiseReduction();
NoiseReductionMode value();
void valueChanged();
private:
- virtual void deviceChanged();
-
QtCamNoiseReduction *m_nr;
};
#include "videomode.h"
#include "camera.h"
#include "previewprovider.h"
-#include "capability.h"
#include "zoom.h"
#include "flash.h"
#include "scene.h"
qmlRegisterType<Camera>(URI, MAJOR, MINOR, "Camera");
qmlRegisterType<ImageMode>(URI, MAJOR, MINOR, "ImageMode");
qmlRegisterType<VideoMode>(URI, MAJOR, MINOR, "VideoMode");
- qmlRegisterType<Zoom>(URI, MAJOR, MINOR, "Zoom");
- qmlRegisterType<Flash>(URI, MAJOR, MINOR, "Flash");
- qmlRegisterType<Scene>(URI, MAJOR, MINOR, "Scene");
- qmlRegisterType<EvComp>(URI, MAJOR, MINOR, "EvComp");
- qmlRegisterType<VideoTorch>(URI, MAJOR, MINOR, "VideoTorch");
- qmlRegisterType<WhiteBalance>(URI, MAJOR, MINOR, "WhiteBalance");
- qmlRegisterType<ColorTone>(URI, MAJOR, MINOR, "ColorTone");
- qmlRegisterType<Exposure>(URI, MAJOR, MINOR, "Exposure");
- qmlRegisterType<Aperture>(URI, MAJOR, MINOR, "Aperture");
- 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<AutoFocus>(URI, MAJOR, MINOR, "AutoFocus");
+
+ qmlRegisterUncreatableType<Zoom>(URI, MAJOR, MINOR, "Zoom", QObject::tr("Cannot create separate instance of Zoom"));
+ qmlRegisterUncreatableType<Flash>(URI, MAJOR, MINOR, "Flash", QObject::tr("Cannot create separate instance of Flash"));
+ qmlRegisterUncreatableType<Scene>(URI, MAJOR, MINOR, "Scene", QObject::tr("Cannot create separate instance of Scene"));
+ qmlRegisterUncreatableType<EvComp>(URI, MAJOR, MINOR, "EvComp", QObject::tr("Cannot create separate instance of EvComp"));
+ qmlRegisterUncreatableType<WhiteBalance>(URI, MAJOR, MINOR, "WhiteBalance", QObject::tr("Cannot create separate instance of WhiteBalance"));
+ qmlRegisterUncreatableType<ColorTone>(URI, MAJOR, MINOR, "ColorTone", QObject::tr("Cannot create separate instance of ColorTone"));
+ qmlRegisterUncreatableType<Exposure>(URI, MAJOR, MINOR, "Exposure", QObject::tr("Cannot create separate instance of Exposure"));
+ qmlRegisterUncreatableType<Aperture>(URI, MAJOR, MINOR, "Aperture", QObject::tr("Cannot create separate instance of Iso"));
+ qmlRegisterUncreatableType<Iso>(URI, MAJOR, MINOR, "Iso", QObject::tr("Cannot create separate instance of Iso"));
+ qmlRegisterUncreatableType<NoiseReduction>(URI, MAJOR, MINOR, "NoiseReduction", QObject::tr("Cannot create separate instance of NoiseReduction"));
+ qmlRegisterUncreatableType<FlickerReduction>(URI, MAJOR, MINOR, "FlickerReduction", QObject::tr("Cannot create separate instance of FlickerReduction"));
+ qmlRegisterUncreatableType<Focus>(URI, MAJOR, MINOR, "Focus", QObject::tr("Cannot create separate instance of Focus"));
+ qmlRegisterUncreatableType<AutoFocus>(URI, MAJOR, MINOR, "AutoFocus", QObject::tr("Cannot create separate instance of AutoFocus"));
+
qmlRegisterType<Mute>(URI, MAJOR, MINOR, "Mute");
+ qmlRegisterType<VideoTorch>(URI, MAJOR, MINOR, "VideoTorch");
+
qmlRegisterType<MetaData>(URI, MAJOR, MINOR, "MetaData");
qmlRegisterType<ImageSettings>(URI, MAJOR, MINOR, "ImageSettings");
qmlRegisterType<VideoSettings>(URI, MAJOR, MINOR, "VideoSettings");
"VideoResolutionModel can be obtained from VideoSettings");
qmlRegisterType<Mode>();
- qmlRegisterType<Capability>();
engine->addImageProvider("preview", new PreviewProvider);
}
*/
#include "scene.h"
-#include "camera.h"
-#include <QDebug>
-Scene::Scene(QObject *parent) :
- Capability(parent),
- m_scene(0) {
+Scene::Scene(QtCamDevice *dev, QObject *parent) :
+ QObject(parent),
+ m_scene(new QtCamScene(dev, this)) {
+ QObject::connect(m_scene, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
}
Scene::~Scene() {
- if (m_scene) {
- delete m_scene; m_scene = 0;
- }
+ delete m_scene; m_scene = 0;
}
-void Scene::deviceChanged() {
- if (m_scene) {
- delete m_scene; m_scene = 0;
- }
-
- if (m_cam->device()) {
- m_scene = new QtCamScene(m_cam->device(), this);
- QObject::connect(m_scene, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
- }
-
- emit valueChanged();
-}
-
-Scene::SceneMode Scene::value() {
- return m_scene ? (SceneMode)m_scene->value() : Scene::Auto;
+Scene::SceneMode Scene::value() const {
+ return (SceneMode)m_scene->value();
}
void Scene::setValue(const Scene::SceneMode& mode) {
- if (m_scene) {
- m_scene->setValue((QtCamScene::SceneMode)mode);
- }
+ m_scene->setValue((QtCamScene::SceneMode)mode);
}
#ifndef SCENE_H
#define SCENE_H
-#include "capability.h"
+#include <QObject>
#include "qtcamscene.h"
-class Scene : public Capability {
+class QtCamDevice;
+
+class Scene : public QObject {
Q_OBJECT
Q_PROPERTY(SceneMode value READ value WRITE setValue NOTIFY valueChanged);
Auto = QtCamScene::Auto
} SceneMode;
- Scene(QObject *parent = 0);
+ Scene(QtCamDevice *dev, QObject *parent = 0);
~Scene();
- SceneMode value();
+ SceneMode value() const;
void setValue(const SceneMode& mode);
signals:
void valueChanged();
private:
- virtual void deviceChanged();
-
QtCamScene *m_scene;
};
*/
#include "whitebalance.h"
-#include "camera.h"
-#include <QDebug>
-WhiteBalance::WhiteBalance(QObject *parent) :
- Capability(parent),
- m_wb(0) {
+WhiteBalance::WhiteBalance(QtCamDevice *dev, QObject *parent) :
+ QObject(parent),
+ m_wb(new QtCamWhiteBalance(dev, this)) {
+ QObject::connect(m_wb, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
}
WhiteBalance::~WhiteBalance() {
- if (m_wb) {
- delete m_wb; m_wb = 0;
- }
-}
-
-void WhiteBalance::deviceChanged() {
- if (m_wb) {
- delete m_wb; m_wb = 0;
- }
-
- if (m_cam->device()) {
- m_wb = new QtCamWhiteBalance(m_cam->device(), this);
- QObject::connect(m_wb, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
- }
-
- emit valueChanged();
+ delete m_wb; m_wb = 0;
}
WhiteBalance::WhiteBalanceMode WhiteBalance::value() {
- return m_wb ? (WhiteBalanceMode)m_wb->value() : WhiteBalance::Auto;
+ return (WhiteBalanceMode)m_wb->value();
}
void WhiteBalance::setValue(const WhiteBalance::WhiteBalanceMode& mode) {
- if (m_wb) {
- m_wb->setValue((QtCamWhiteBalance::WhiteBalanceMode)mode);
- }
+ m_wb->setValue((QtCamWhiteBalance::WhiteBalanceMode)mode);
}
#ifndef WHITE_BALANCE_H
#define WHITE_BALANCE_H
-#include "capability.h"
+#include <QObject>
#include "qtcamwhitebalance.h"
-class WhiteBalance : public Capability {
+class QtCamDevice;
+
+class WhiteBalance : public QObject {
Q_OBJECT
Q_PROPERTY(WhiteBalanceMode value READ value WRITE setValue NOTIFY valueChanged);
Flourescent = QtCamWhiteBalance::Flourescent
} WhiteBalanceMode;
- WhiteBalance(QObject *parent = 0);
+ WhiteBalance(QtCamDevice *dev, QObject *parent = 0);
~WhiteBalance();
WhiteBalanceMode value();
void valueChanged();
private:
- virtual void deviceChanged();
-
QtCamWhiteBalance *m_wb;
};
*/
#include "zoom.h"
-#include "camera.h"
#include "qtcamzoom.h"
-Zoom::Zoom(QObject *parent) :
- Capability(parent),
- m_zoom(0) {
+Zoom::Zoom(QtCamDevice *dev, QObject *parent) :
+ QObject(parent),
+ m_zoom(new QtCamZoom(dev, this)) {
+ QObject::connect(m_zoom, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
+ QObject::connect(m_zoom, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
+ QObject::connect(m_zoom, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
}
Zoom::~Zoom() {
- if (m_zoom) {
- delete m_zoom; m_zoom = 0;
- }
-}
-
-void Zoom::deviceChanged() {
- if (m_zoom) {
- delete m_zoom; m_zoom = 0;
- }
-
- if (m_cam->device()) {
- m_zoom = new QtCamZoom(m_cam->device(), this);
- QObject::connect(m_zoom, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
- QObject::connect(m_zoom, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
- QObject::connect(m_zoom, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
- }
-
- emit valueChanged();
- emit minimumChanged();
- emit maximunmChanged();
+ delete m_zoom; m_zoom = 0;
}
qreal Zoom::value() {
- return m_zoom ? m_zoom->value() : 1.0;
+ return m_zoom->value();
}
void Zoom::setValue(qreal val) {
- if (m_zoom) {
- m_zoom->setValue(val);
- }
+ m_zoom->setValue(val);
}
qreal Zoom::minimum() {
- return m_zoom ? m_zoom->minimumValue() : 1.0;
+ return m_zoom->minimumValue();
}
qreal Zoom::maximum() {
- return m_zoom ? m_zoom->maximumValue() : 1.0;
+ return m_zoom->maximumValue();
}
#ifndef ZOOM_H
#define ZOOM_H
-#include "capability.h"
+#include <QObject>
class QtCamZoom;
+class QtCamDevice;
-class Zoom : public Capability {
+class Zoom : public QObject {
Q_OBJECT
Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged);
Q_PROPERTY(qreal maximum READ maximum NOTIFY maximunmChanged);
public:
- Zoom(QObject *parent = 0);
+ Zoom(QtCamDevice *dev, QObject *parent = 0);
~Zoom();
qreal value();
void maximunmChanged();
private:
- virtual void deviceChanged();
-
QtCamZoom *m_zoom;
};
Selector {
id: button
- property alias value: flash.value
-
iconSource: "image://theme/" + Data.flashIcon(settings.imageFlashMode)
title: qsTr("Flash mode");
- Flash {
- // TODO: move this out of here.
- id: flash
- camera: cam
- value: settings.imageFlashMode
- // TODO: scene modes can change flash value. what to do here ?
- onValueChanged: settings.imageFlashMode = value;
- }
-
widget: Row {
id: row
height: button.checked ? 64 : 0
Selector {
id: button
- property alias value: evComp.value
-
- iconSource: evComp.value == 0 ? "image://theme/icon-m-camera-manual-exposure" : ""
- text: evComp.value == 0 ? "" : evComp.value.toFixed(1);
+ iconSource: settings.imageEvComp == 0 ? "image://theme/icon-m-camera-manual-exposure" : ""
+ text: settings.imageEvComp == 0 ? "" : settings.imageEvComp.toFixed(1);
font.pixelSize: 19
timerConstraints: slider.pressed
title: qsTr("Exposure compensation");
- EvComp {
- id: evComp
- camera: cam
-
- // TODO: hardcoding
- value: slider.value
- }
-
widget: Slider {
id: slider
width: 500
orientation: Qt.Horizontal
- minimumValue: evComp.minimum
- maximumValue: evComp.maximum
- value: evComp.value
+ minimumValue: cam.evComp.minimum
+ maximumValue: cam.evComp.maximum
+ value: settings.imageEvComp
stepSize: 0.1
- Component.onCompleted: { slider.value = evComp.value; }
+ onValueChanged: settings.imageEvComp = value;
+ Component.onCompleted: { slider.value = settings.imageEvComp; }
}
}
anchors.leftMargin: 20
}
- EvCompButton {
+ ImageEvCompButton {
id: evComp
visible: controlsVisible
anchors.top: scene.bottom
Selector {
id: button
- property int value: settings.imageSceneMode
-
- iconSource: "image://theme/" + Data.ismIcon(scene.value);
+ iconSource: "image://theme/" + Data.ismIcon(settings.imageSceneMode);
title: qsTr("Scene mode");
+// -*- qml -*-
+
/*!
* This file is part of CameraPlus.
*
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "capability.h"
-#include "camera.h"
-
-Capability::Capability(QObject *parent) :
- QObject(parent),
- m_cam(0) {
-
-}
-
-Capability::~Capability() {
-
-}
-
-Camera *Capability::camera() {
- return m_cam;
-}
-
-void Capability::setCamera(Camera *cam) {
- if (cam == m_cam) {
- return;
- }
-
- if (m_cam) {
- QObject::disconnect(m_cam, SIGNAL(deviceChanged()), this, SLOT(deviceChanged()));
- QObject::disconnect(m_cam, SIGNAL(deviceChanged()), this, SIGNAL(isReadyChanged()));
- }
-
- m_cam = cam;
-
- if (m_cam) {
- QObject::connect(m_cam, SIGNAL(deviceChanged()), this, SLOT(deviceChanged()));
- QObject::connect(m_cam, SIGNAL(deviceChanged()), this, SIGNAL(isReadyChanged()));
- }
-
- emit cameraChanged();
-
- deviceChanged();
-
- emit isReadyChanged();
-}
-
-bool Capability::isReady() const {
- return m_cam && m_cam->device();
+import QtQuick 1.1
+import com.nokia.meego 1.1
+import QtCamera 1.0
+
+Selector {
+ id: button
+
+ iconSource: settings.videoEvComp == 0 ? "image://theme/icon-m-camera-manual-exposure" : ""
+ text: settings.videoEvComp == 0 ? "" : settings.videoEvComp.toFixed(1);
+ font.pixelSize: 19
+ timerConstraints: slider.pressed
+
+ title: qsTr("Exposure compensation");
+
+ widget: Slider {
+ id: slider
+ width: 500
+ orientation: Qt.Horizontal
+ minimumValue: cam.evComp.minimum
+ maximumValue: cam.evComp.maximum
+ value: settings.videoEvComp
+ stepSize: 0.1
+ onValueChanged: settings.videoEvComp = value;
+ Component.onCompleted: { slider.value = settings.videoEvComp; }
+ }
}
anchors.leftMargin: 20
}
- EvCompButton {
+ VideoEvCompButton {
id: evComp
visible: videoControlsVisible
anchors.top: scene.bottom
Selector {
id: button
- property int value: settings.videoSceneMode
-
- iconSource: sceneIcon(scene.value);
+ iconSource: sceneIcon(settings.videoSceneMode);
title: qsTr("Scene mode");
Slider {
id: slider
- property alias camera: zoom.camera
+ property Camera camera: null
+
platformStyle: SliderStyle {
// HACK
handleBackground: " "
handleBackgroundPressed: " "
}
- Zoom {
- id: zoom
+ Binding {
+ target: camera.zoom
+ property: "value"
value: slider.value
}
Connections {
target: camera
- onModeChanged: slider.value = zoom.minimum;
+ onModeChanged: slider.value = camera.zoom.minimum;
}
orientation: Qt.Horizontal
width: 500
height: 50
stepSize:0.1
- minimumValue: zoom.minimum
- maximumValue: zoom.maximum
+ minimumValue: camera.zoom.minimum
+ maximumValue: camera.zoom.maximum
state: "hidden"
states: [
// TODO: disable debug builds.
// TODO: a way to get buffers to the application
// TODO: fcam like functionality (precise control over capture parameters).
-// TODO: changing scene mode doesn't affect the existing properties ?
-// TODO: upon startup all properties don't load correct values.
PageStackWindow {
id: root
id: sounds
mute: !settings.soundEnabled
}
+
}
- Scene {
- id: sceneController
- camera: cam
- value: ready ? camera.mode == Camera.VideoMode ? settings.videoSceneMode : settings.imageSceneMode : 0
- onValueChanged: console.log("New scene value " + value);
+ Binding {
+ target: cam.flash
+ property: "value"
+ when: cam.mode == Camera.ImageMode
+ value: settings.imageFlashMode
}
- ColorTone {
- id: colorToneController
- camera: cam
- value: ready ? camera.mode == Camera.VideoMode ? settings.videoColorFilter : settings.imageColorFilter : 0
+ Binding {
+ target: settings
+ property: "imageFlashMode"
+ when: cam.mode == Camera.ImageMode
+ value: cam.flash.value
}
- WhiteBalance {
- id: whiteBalanceController
- camera: cam
- value: ready ? camera.mode == Camera.VideoMode ? settings.videoWhiteBalance : settings.imageWhiteBalance : 0
+ Binding {
+ target: cam.scene
+ property: "value"
+ when: cam.mode == Camera.VideoMode
+ value: settings.videoSceneMode
+ }
+
+ Binding {
+ target: cam.scene
+ property: "value"
+ when: cam.mode == Camera.ImageMode
+ value: settings.imageSceneMode
+ }
+
+ Binding {
+ target: cam.evComp
+ property: "value"
+ when: cam.mode == Camera.ImageMode
+ value: settings.imageEvComp
+ }
+
+ Binding {
+ target: cam.evComp
+ property: "value"
+ when: cam.mode == Camera.VideoMode
+ value: settings.videoEvComp
+ }
+
+ Binding {
+ target: settings
+ property: "imageEvComp"
+ when: cam.mode == Camera.ImageMode
+ value: cam.evComp.value
+ }
+
+ Binding {
+ target: settings
+ property: "videoEvComp"
+ when: cam.mode == Camera.VideoMode
+ value: cam.evComp.value
+ }
+
+ Binding {
+ target: cam.whiteBalance
+ property: "value"
+ when: cam.mode == Camera.ImageMode
+ value: settings.imageWhiteBalance
+ }
+
+ Binding {
+ target: cam.whiteBalance
+ property: "value"
+ when: cam.mode == Camera.VideoMode
+ value: settings.videoWhiteBalance
+ }
+
+ Binding {
+ target: cam.colorTone
+ property: "value"
+ when: cam.mode == Camera.ImageMode
+ value: settings.imageColorFilter
+ }
+
+ Binding {
+ target: cam.colorTone
+ property: "value"
+ when: cam.mode == Camera.VideoMode
+ value: settings.videoColorFilter
+ }
+
+ Binding {
+ target: cam.iso
+ property: "value"
+ when: cam.mode == Camera.ImageMode
+ value: settings.imageIso
+ }
+
+ Binding {
+ target: settings
+ property: "imageIso"
+ when: cam.mode == Camera.ImageMode
+ value: cam.iso.value
}
ModeController {
dimmer: root.dimmer
}
- Iso {
- id: iso
- camera: cam
- value: ready ? settings.imageIso : 0
- }
-
Connections {
target: cam
onModeChanged: {