Added NoTouchFocus quirk
[harmattan/cameraplus] / declarative / videoresolution.cpp
1 // -*- c++ -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22
23 #include "videoresolution.h"
24
25 VideoResolution::VideoResolution(QObject *parent) :
26   QObject(parent),
27   m_fps(-1),
28   m_nightFps(-1) {
29
30 }
31
32 VideoResolution::VideoResolution(const QtCamVideoResolution& resolution, QObject *parent) :
33   QObject(parent),
34   m_resolutionId(resolution.id()),
35   m_name(resolution.name()),
36   m_aspectRatio(resolution.aspectRatio()),
37   m_commonName(resolution.resolution()),
38   m_capture(resolution.captureResolution()),
39   m_preview(resolution.previewResolution()),
40   m_fps(resolution.frameRate()),
41   m_nightFps(resolution.nightFrameRate()) {
42
43 }
44
45 VideoResolution::~VideoResolution() {
46
47 }
48
49 QtCamVideoResolution VideoResolution::resolution() {
50   return QtCamVideoResolution(m_resolutionId, m_name, m_capture,
51                               m_preview, m_fps, m_nightFps,
52                               m_aspectRatio, m_commonName);
53 }
54
55 QString VideoResolution::resolutionId() const {
56   return m_resolutionId;
57 }
58
59 void VideoResolution::setResolutionId(const QString& resolutionId) {
60   if (m_resolutionId != resolutionId) {
61     m_resolutionId = resolutionId;
62
63     emit resolutionIdChanged();
64   }
65 }
66
67 QString VideoResolution::name() const {
68   return m_name;
69 }
70
71 void VideoResolution::setName(const QString& name) {
72   if (m_name != name) {
73     m_name = name;
74
75     emit nameChanged();
76   }
77 }
78
79 QString VideoResolution::aspectRatio() const {
80   return m_aspectRatio;
81 }
82
83 void VideoResolution::setAspectRatio(const QString& aspectRatio) {
84   if (m_aspectRatio != aspectRatio) {
85     m_aspectRatio = aspectRatio;
86
87     emit aspectRatioChanged();
88   }
89 }
90
91 QSize VideoResolution::capture() const {
92   return m_capture;
93 }
94
95 void VideoResolution::setCapture(const QSize& capture) {
96   if (m_capture != capture) {
97     m_capture = capture;
98
99     emit captureChanged();
100   }
101 }
102
103 QSize VideoResolution::preview() const {
104   return m_preview;
105 }
106
107 void VideoResolution::setPreview(const QSize& preview) {
108   if (m_preview != preview) {
109     m_preview = preview;
110
111     emit previewChanged();
112   }
113 }
114
115 int VideoResolution::fps() const {
116   return m_fps;
117 }
118
119 void VideoResolution::setFps(int fps) {
120   if (m_fps != fps) {
121     m_fps = fps;
122
123     emit fpsChanged();
124   }
125 }
126
127 int VideoResolution::nightFps() const {
128   return m_nightFps;
129 }
130
131 void VideoResolution::setNightFps(int nightFps) {
132   if (m_nightFps != nightFps) {
133     m_nightFps = nightFps;
134
135     emit nightFpsChanged();
136   }
137 }
138
139 QString VideoResolution::commonName() const {
140   return m_commonName;
141 }
142
143 void VideoResolution::setCommonName(const QString& commonName) {
144   if (m_commonName != commonName) {
145     m_commonName = commonName;
146
147     emit commonNameChanged();
148   }
149 }