Added NoFaceDetection quirk
[harmattan/cameraplus] / declarative / imageresolution.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 "imageresolution.h"
24
25 ImageResolution::ImageResolution(QObject *parent) :
26   QObject(parent),
27   m_fps(-1),
28   m_nightFps(-1),
29   m_megaPixels(-1) {
30
31 }
32
33 ImageResolution::ImageResolution(const QtCamImageResolution& resolution, QObject *parent) :
34   QObject(parent),
35   m_resolutionId(resolution.id()),
36   m_name(resolution.name()),
37   m_aspectRatio(resolution.aspectRatio()),
38   m_capture(resolution.captureResolution()),
39   m_preview(resolution.previewResolution()),
40   m_viewfinder(resolution.viewfinderResolution()),
41   m_fps(resolution.frameRate()),
42   m_nightFps(resolution.nightFrameRate()),
43   m_megaPixels(resolution.megaPixels()) {
44
45 }
46
47 ImageResolution::~ImageResolution() {
48
49 }
50
51 QtCamImageResolution ImageResolution::resolution() {
52   return QtCamImageResolution(m_resolutionId, m_name, m_capture,
53                               m_preview, m_viewfinder, m_fps,
54                               m_nightFps, m_megaPixels, m_aspectRatio);
55 }
56
57 QString ImageResolution::resolutionId() const {
58   return m_resolutionId;
59 }
60
61 void ImageResolution::setResolutionId(const QString& resolutionId) {
62   if (m_resolutionId != resolutionId) {
63     m_resolutionId = resolutionId;
64
65     emit resolutionIdChanged();
66   }
67 }
68
69 QString ImageResolution::name() const {
70   return m_name;
71 }
72
73 void ImageResolution::setName(const QString& name) {
74   if (m_name != name) {
75     m_name = name;
76
77     emit nameChanged();
78   }
79 }
80
81 QString ImageResolution::aspectRatio() const {
82   return m_aspectRatio;
83 }
84
85 void ImageResolution::setAspectRatio(const QString& aspectRatio) {
86   if (m_aspectRatio != aspectRatio) {
87     m_aspectRatio = aspectRatio;
88
89     emit aspectRatioChanged();
90   }
91 }
92
93 QSize ImageResolution::capture() const {
94   return m_capture;
95 }
96
97 void ImageResolution::setCapture(const QSize& capture) {
98   if (m_capture != capture) {
99     m_capture = capture;
100
101     emit captureChanged();
102   }
103 }
104
105 QSize ImageResolution::preview() const {
106   return m_preview;
107 }
108
109 void ImageResolution::setPreview(const QSize& preview) {
110   if (m_preview != preview) {
111     m_preview = preview;
112
113     emit previewChanged();
114   }
115 }
116
117 QSize ImageResolution::viewfinder() const {
118   return m_viewfinder;
119 }
120
121 void ImageResolution::setViewfinder(const QSize& viewfinder) {
122   if (m_viewfinder != viewfinder) {
123     m_viewfinder = viewfinder;
124
125     emit viewfinderChanged();
126   }
127 }
128
129 int ImageResolution::fps() const {
130   return m_fps;
131 }
132
133 void ImageResolution::setFps(int fps) {
134   if (m_fps != fps) {
135     m_fps = fps;
136
137     emit fpsChanged();
138   }
139 }
140
141 int ImageResolution::nightFps() const {
142   return m_nightFps;
143 }
144
145 void ImageResolution::setNightFps(int nightFps) {
146   if (m_nightFps != nightFps) {
147     m_nightFps = nightFps;
148
149     emit nightFpsChanged();
150   }
151 }
152
153 int ImageResolution::megaPixels() const {
154   return m_megaPixels;
155 }
156
157 void ImageResolution::setMegaPixels(int megaPixels) {
158   if (m_megaPixels != megaPixels) {
159     m_megaPixels = megaPixels;
160
161     emit megaPixelsChanged();
162   }
163 }