01299845dbcfe9daec5e12b18f310c0db26fa811
[harmattan/cameraplus] / imports / videomode.cpp
1 #include "videomode.h"
2 #include "qtcamvideomode.h"
3 #include "qtcamdevice.h"
4 #include "camera.h"
5
6 VideoMode::VideoMode(QObject *parent) :
7   Mode(parent),
8   m_video(0) {
9
10 }
11
12 VideoMode::~VideoMode() {
13   m_video = 0;
14 }
15
16
17 bool VideoMode::startRecording(const QString& fileName) {
18   return m_video ? m_video->startRecording(fileName) : false;
19 }
20
21 void VideoMode::stopRecording() {
22   if (m_video) {
23     m_video->stopRecording();
24   }
25 }
26
27 void VideoMode::preChangeMode() {
28   if (m_video) {
29     QObject::disconnect(m_video, SIGNAL(recordingStateChanged()),
30                         this, SIGNAL(recordingStateChanged()));
31   }
32
33   m_video = 0;
34 }
35
36 void VideoMode::postChangeMode() {
37   m_video = m_cam->device()->videoMode();
38
39   if (m_video) {
40     QObject::connect(m_video, SIGNAL(recordingStateChanged()),
41                         this, SIGNAL(recordingStateChanged()));
42   }
43 }
44
45 bool VideoMode::isRecording() {
46   return m_video ? m_video->isRecording() : false;
47 }
48
49 void VideoMode::changeMode() {
50   m_mode = m_cam->device()->videoMode();
51 }