06f561d8be93df4b821232f931b43ea06ac23507
[harmattan/cameraplus] / lib / qtcamvideosettings.cpp
1 /*!
2  * This file is part of CameraPlus.
3  *
4  * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20
21 #include "qtcamvideosettings.h"
22
23 class QtCamVideoSettingsPrivate {
24 public:
25   QString id;
26   QString name;
27   QSize capture;
28   QSize preview;
29   int fps;
30   int nightFps;
31 };
32
33 QtCamVideoSettings::QtCamVideoSettings(const QString& id, const QString& name,
34                                        const QSize& capture, const QSize& preview,
35                                        int fps, int nightFps) :
36   d_ptr(new QtCamVideoSettingsPrivate) {
37
38   d_ptr->id = id;
39   d_ptr->name = name;
40   d_ptr->capture = capture;
41   d_ptr->preview = preview;
42   d_ptr->fps = fps;
43   d_ptr->nightFps = nightFps;
44 }
45
46 QtCamVideoSettings::QtCamVideoSettings(const QtCamVideoSettings& other) :
47   d_ptr(new QtCamVideoSettingsPrivate) {
48
49   d_ptr->id = other.d_ptr->id;
50   d_ptr->name = other.d_ptr->name;
51   d_ptr->capture = other.d_ptr->capture;
52   d_ptr->preview = other.d_ptr->preview;
53   d_ptr->fps = other.d_ptr->fps;
54   d_ptr->nightFps = other.d_ptr->nightFps;
55 }
56
57 QtCamVideoSettings::~QtCamVideoSettings() {
58   delete d_ptr;
59 }
60
61 QtCamVideoSettings& QtCamVideoSettings::operator=(const QtCamVideoSettings&
62                                                                 other) {
63   d_ptr->id = other.d_ptr->id;
64   d_ptr->name = other.d_ptr->name;
65   d_ptr->capture = other.d_ptr->capture;
66   d_ptr->preview = other.d_ptr->preview;
67   d_ptr->fps = other.d_ptr->fps;
68   d_ptr->nightFps = other.d_ptr->nightFps;
69
70   return *this;
71 }
72
73 QString QtCamVideoSettings::id() const {
74   return d_ptr->id;
75 }
76
77 QString QtCamVideoSettings::name() const {
78   return d_ptr->name;
79 }
80
81 QSize QtCamVideoSettings::captureResolution() const {
82   return d_ptr->capture;
83 }
84
85 QSize QtCamVideoSettings::previewResolution() const {
86   return d_ptr->preview;
87 }
88
89 int QtCamVideoSettings::frameRate() const {
90   return d_ptr->fps;
91 }
92
93 int QtCamVideoSettings::nightFrameRate() const {
94   return d_ptr->nightFps;
95 }