Added copyright headers and COPYING file.
[harmattan/cameraplus] / lib / qtcamimagesettings.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 "qtcamimagesettings.h"
22
23 class QtCamImageSettingsPrivate {
24 public:
25   QString id;
26   QString name;
27   QSize capture;
28   QSize preview;
29   QSize viewfinder;
30   int fps;
31   int nightFps;
32 };
33
34 QtCamImageSettings::QtCamImageSettings(const QString& id, const QString& name,
35                                        const QSize& capture, const QSize& preview,
36                                        const QSize& viewfinder,
37                                        int fps, int nightFps) :
38   d_ptr(new QtCamImageSettingsPrivate) {
39
40   d_ptr->id = id;
41   d_ptr->name = name;
42   d_ptr->capture = capture;
43   d_ptr->preview = preview;
44   d_ptr->viewfinder = viewfinder;
45   d_ptr->fps = fps;
46   d_ptr->nightFps = nightFps;
47 }
48
49 QtCamImageSettings::QtCamImageSettings(const QtCamImageSettings& other) :
50   d_ptr(new QtCamImageSettingsPrivate) {
51
52   d_ptr->id = other.d_ptr->id;
53   d_ptr->name = other.d_ptr->name;
54   d_ptr->capture = other.d_ptr->capture;
55   d_ptr->preview = other.d_ptr->preview;
56   d_ptr->viewfinder = other.d_ptr->viewfinder;
57   d_ptr->fps = other.d_ptr->fps;
58   d_ptr->nightFps = other.d_ptr->nightFps;
59 }
60
61 QtCamImageSettings::~QtCamImageSettings() {
62   delete d_ptr;
63 }
64
65 QtCamImageSettings& QtCamImageSettings::operator=(const QtCamImageSettings&
66                                                                 other) {
67   d_ptr->id = other.d_ptr->id;
68   d_ptr->name = other.d_ptr->name;
69   d_ptr->capture = other.d_ptr->capture;
70   d_ptr->preview = other.d_ptr->preview;
71   d_ptr->viewfinder = other.d_ptr->viewfinder;
72   d_ptr->fps = other.d_ptr->fps;
73   d_ptr->nightFps = other.d_ptr->nightFps;
74
75   return *this;
76 }
77
78 QString QtCamImageSettings::id() const {
79   return d_ptr->id;
80 }
81
82 QString QtCamImageSettings::name() const {
83   return d_ptr->name;
84 }
85
86 QSize QtCamImageSettings::captureResolution() const {
87   return d_ptr->capture;
88 }
89
90 QSize QtCamImageSettings::viewfinderResolution() const {
91   return d_ptr->viewfinder;
92 }
93
94 QSize QtCamImageSettings::previewResolution() const {
95   return d_ptr->preview;
96 }
97
98 int QtCamImageSettings::frameRate() const {
99   return d_ptr->fps;
100 }
101
102 int QtCamImageSettings::nightFrameRate() const {
103   return d_ptr->nightFps;
104 }