ff28ca704fcb92b597b826346b21e005658702a6
[harmattan/cameraplus] / lib / qtcamvideosettings.cpp
1 #include "qtcamvideosettings.h"
2
3 class QtCamVideoSettingsPrivate {
4 public:
5   QString id;
6   QString name;
7   QSize capture;
8   QSize preview;
9   int numerator;
10   int denominator;
11   int nightNumerator;
12   int nightDenominator;
13 };
14
15 QtCamVideoSettings::QtCamVideoSettings(const QString& id, const QString& name,
16                                        const QSize& capture, const QSize& preview,
17                                        int numerator, int denominator,
18                                        int nightNumerator, int nightDenominator) :
19   d_ptr(new QtCamVideoSettingsPrivate) {
20
21   d_ptr->id = id;
22   d_ptr->name = name;
23   d_ptr->capture = capture;
24   d_ptr->preview = preview;
25   d_ptr->numerator = numerator;
26   d_ptr->denominator = denominator;
27   d_ptr->nightNumerator = nightNumerator;
28   d_ptr->nightDenominator = nightDenominator;
29 }
30
31 QtCamVideoSettings::QtCamVideoSettings(const QtCamVideoSettings& other) :
32   d_ptr(new QtCamVideoSettingsPrivate) {
33
34   d_ptr->id = other.d_ptr->id;
35   d_ptr->name = other.d_ptr->name;
36   d_ptr->capture = other.d_ptr->capture;
37   d_ptr->preview = other.d_ptr->preview;
38   d_ptr->numerator = other.d_ptr->numerator;
39   d_ptr->denominator = other.d_ptr->denominator;
40   d_ptr->nightNumerator = other.d_ptr->nightNumerator;
41   d_ptr->nightDenominator = other.d_ptr->nightDenominator;
42 }
43
44 QtCamVideoSettings::~QtCamVideoSettings() {
45   delete d_ptr;
46 }
47
48 QtCamVideoSettings& QtCamVideoSettings::operator=(const QtCamVideoSettings&
49                                                                 other) {
50   d_ptr->id = other.d_ptr->id;
51   d_ptr->name = other.d_ptr->name;
52   d_ptr->capture = other.d_ptr->capture;
53   d_ptr->preview = other.d_ptr->preview;
54   d_ptr->numerator = other.d_ptr->numerator;
55   d_ptr->denominator = other.d_ptr->denominator;
56   d_ptr->nightNumerator = other.d_ptr->nightNumerator;
57   d_ptr->nightDenominator = other.d_ptr->nightDenominator;
58
59   return *this;
60 }
61
62 QString QtCamVideoSettings::id() const {
63   return d_ptr->id;
64 }
65
66 QString QtCamVideoSettings::name() const {
67   return d_ptr->name;
68 }
69
70 QSize QtCamVideoSettings::captureResolution() const {
71   return d_ptr->capture;
72 }
73
74 QSize QtCamVideoSettings::previewResolution() const {
75   return d_ptr->preview;
76 }
77
78 QPair<int, int> QtCamVideoSettings::frameRate() const {
79   return qMakePair<int, int>(d_ptr->numerator, d_ptr->denominator);
80 }
81
82 QPair<int, int> QtCamVideoSettings::nightFrameRate() const {
83   return qMakePair<int, int>(d_ptr->nightNumerator, d_ptr->nightDenominator);
84 }