4 * This file is part of CameraPlus.
6 * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
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.
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.
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
23 #include "imageresolution.h"
25 ImageResolution::ImageResolution(QObject *parent) :
33 ImageResolution::ImageResolution(const QtCamImageResolution& resolution, 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()) {
47 ImageResolution::~ImageResolution() {
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);
57 QString ImageResolution::resolutionId() const {
58 return m_resolutionId;
61 void ImageResolution::setResolutionId(const QString& resolutionId) {
62 if (m_resolutionId != resolutionId) {
63 m_resolutionId = resolutionId;
65 emit resolutionIdChanged();
69 QString ImageResolution::name() const {
73 void ImageResolution::setName(const QString& name) {
81 QString ImageResolution::aspectRatio() const {
85 void ImageResolution::setAspectRatio(const QString& aspectRatio) {
86 if (m_aspectRatio != aspectRatio) {
87 m_aspectRatio = aspectRatio;
89 emit aspectRatioChanged();
93 QSize ImageResolution::capture() const {
97 void ImageResolution::setCapture(const QSize& capture) {
98 if (m_capture != capture) {
101 emit captureChanged();
105 QSize ImageResolution::preview() const {
109 void ImageResolution::setPreview(const QSize& preview) {
110 if (m_preview != preview) {
113 emit previewChanged();
117 QSize ImageResolution::viewfinder() const {
121 void ImageResolution::setViewfinder(const QSize& viewfinder) {
122 if (m_viewfinder != viewfinder) {
123 m_viewfinder = viewfinder;
125 emit viewfinderChanged();
129 int ImageResolution::fps() const {
133 void ImageResolution::setFps(int fps) {
141 int ImageResolution::nightFps() const {
145 void ImageResolution::setNightFps(int nightFps) {
146 if (m_nightFps != nightFps) {
147 m_nightFps = nightFps;
149 emit nightFpsChanged();
153 int ImageResolution::megaPixels() const {
157 void ImageResolution::setMegaPixels(int megaPixels) {
158 if (m_megaPixels != megaPixels) {
159 m_megaPixels = megaPixels;
161 emit megaPixelsChanged();