Added QML components for aperture, exposure, iso, noise reduction and flicker reduction
[harmattan/cameraplus] / imports / aperture.cpp
1 #include "aperture.h"
2 #include "camera.h"
3 #include "qtcamaperture.h"
4
5 Aperture::Aperture(QObject *parent) :
6   Capability(parent),
7   m_aperture(0) {
8
9 }
10
11 Aperture::~Aperture() {
12   if (m_aperture) {
13     delete m_aperture; m_aperture = 0;
14   }
15 }
16
17 void Aperture::deviceChanged() {
18   if (m_aperture) {
19     delete m_aperture; m_aperture = 0;
20   }
21
22   if (m_cam->device()) {
23     m_aperture = new QtCamAperture(m_cam->device(), this);
24     QObject::connect(m_aperture, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
25     QObject::connect(m_aperture, SIGNAL(minimumValueChanged()), this, SIGNAL(minimumChanged()));
26     QObject::connect(m_aperture, SIGNAL(maximumValueChanged()), this, SIGNAL(maximunmChanged()));
27   }
28
29   emit valueChanged();
30   emit minimumChanged();
31   emit maximunmChanged();
32 }
33
34 unsigned int Aperture::value() {
35   return m_aperture ? m_aperture->value() : 0;
36 }
37
38 void Aperture::setValue(unsigned int val) {
39   if (m_aperture) {
40     m_aperture->setValue(val);
41   }
42 }
43
44 unsigned int Aperture::minimum() {
45   return m_aperture ? m_aperture->minimumValue() : 0;
46 }
47
48 unsigned int Aperture::maximum() {
49   return m_aperture ? m_aperture->maximumValue() : 0;
50 }