1 #include "videotorch.h"
2 #include "qtcamvideotorch.h"
4 #include "qtcamdevice.h"
5 #include "qtcamvideomode.h"
7 VideoTorch::VideoTorch(QObject *parent) :
8 QObject(parent), m_cam(0), m_torch(0) {
12 VideoTorch::~VideoTorch() {
16 Camera *VideoTorch::camera() {
20 void VideoTorch::setCamera(Camera *camera) {
21 if (camera == m_cam) {
26 QObject::disconnect(m_cam, SIGNAL(deviceChanged()), this, SLOT(deviceChanged()));
32 QObject::connect(m_cam, SIGNAL(deviceChanged()), this, SLOT(deviceChanged()));
40 bool VideoTorch::isOn() const {
41 return m_torch ? m_torch->isOn() : false;
44 void VideoTorch::setOn(bool on) {
50 void VideoTorch::deviceChanged() {
52 delete m_torch; m_torch = 0;
55 if (m_cam->device()) {
56 m_torch = new QtCamVideoTorch(m_cam->device(), this);
57 QObject::connect(m_torch, SIGNAL(stateChanged()), this, SIGNAL(stateChanged()));