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