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 "videoresolution.h"
25 VideoResolution::VideoResolution(QObject *parent) :
32 VideoResolution::VideoResolution(const QtCamVideoResolution& resolution, 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()) {
45 VideoResolution::~VideoResolution() {
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);
55 QString VideoResolution::resolutionId() const {
56 return m_resolutionId;
59 void VideoResolution::setResolutionId(const QString& resolutionId) {
60 if (m_resolutionId != resolutionId) {
61 m_resolutionId = resolutionId;
63 emit resolutionIdChanged();
67 QString VideoResolution::name() const {
71 void VideoResolution::setName(const QString& name) {
79 QString VideoResolution::aspectRatio() const {
83 void VideoResolution::setAspectRatio(const QString& aspectRatio) {
84 if (m_aspectRatio != aspectRatio) {
85 m_aspectRatio = aspectRatio;
87 emit aspectRatioChanged();
91 QSize VideoResolution::capture() const {
95 void VideoResolution::setCapture(const QSize& capture) {
96 if (m_capture != capture) {
99 emit captureChanged();
103 QSize VideoResolution::preview() const {
107 void VideoResolution::setPreview(const QSize& preview) {
108 if (m_preview != preview) {
111 emit previewChanged();
115 int VideoResolution::fps() const {
119 void VideoResolution::setFps(int fps) {
127 int VideoResolution::nightFps() const {
131 void VideoResolution::setNightFps(int nightFps) {
132 if (m_nightFps != nightFps) {
133 m_nightFps = nightFps;
135 emit nightFpsChanged();
139 QString VideoResolution::commonName() const {
143 void VideoResolution::setCommonName(const QString& commonName) {
144 if (m_commonName != commonName) {
145 m_commonName = commonName;
147 emit commonNameChanged();