Call parent class componentComplete()
[harmattan/cameraplus] / declarative / metadata.h
1 // -*- c++ -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
7  *
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.
12  *
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.
17  *
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
21  */
22
23 #ifndef META_DATA_H
24 #define META_DATA_H
25
26 #include <QObject>
27 #include "qtcammetadata.h"
28
29 class Camera;
30
31 class MetaData : public QObject {
32   Q_OBJECT
33
34   Q_PROPERTY(Camera* camera READ camera WRITE setCamera NOTIFY cameraChanged);
35   Q_PROPERTY(QString manufacturer READ manufacturer WRITE setManufacturer NOTIFY manufacturerChanged);
36   Q_PROPERTY(QString model READ model WRITE setModel NOTIFY modelChanged);
37   Q_PROPERTY(QString country READ country WRITE setCountry NOTIFY countryChanged);
38   Q_PROPERTY(QString city READ city WRITE setCity NOTIFY cityChanged);
39   Q_PROPERTY(QString suburb READ suburb WRITE setSuburb NOTIFY suburbChanged);
40   Q_PROPERTY(double longitude READ longitude WRITE setLongitude NOTIFY longitudeChanged);
41   Q_PROPERTY(bool longitudeValid READ isLongitudeValid WRITE setLongitudeValid NOTIFY longitudeValidChanged);
42   Q_PROPERTY(double latitude READ latitude WRITE setLatitude NOTIFY latitudeChanged);
43   Q_PROPERTY(bool latitudeValid READ isLatitudeValid WRITE setLatitudeValid NOTIFY latitudeValidChanged);
44   Q_PROPERTY(double elevation READ elevation WRITE setElevation NOTIFY elevationChanged);
45   Q_PROPERTY(bool elevationValid READ isElevationValid WRITE setElevationValid NOTIFY elevationValidChanged);
46   Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged);
47   Q_PROPERTY(QString artist READ artist WRITE setArtist NOTIFY artistChanged);
48   Q_PROPERTY(int captureDirection READ captureDirection WRITE setCaptureDirection NOTIFY captureDirectionChanged);
49   Q_PROPERTY(bool captureDirectionValid READ isCaptureDirectionValid WRITE setCaptureDirectionValid NOTIFY captureDirectionValidChanged);
50   Q_PROPERTY(double horizontalError READ horizontalError WRITE setHorizontalError NOTIFY horizontalErrorChanged);
51   Q_PROPERTY(bool horizontalErrorValid READ isHorizontalErrorValid WRITE setHorizontalErrorValid NOTIFY horizontalErrorValidChanged);
52   Q_PROPERTY(bool dateTimeEnabled READ isDateTimeEnabled WRITE setDateTimeEnabled NOTIFY dateTimeEnabledChanged);
53   Q_ENUMS(Orientation);
54
55 public:
56   typedef enum {
57     Unknown = -1,
58     Landscape = QtCamMetaData::Landscape,
59     Portrait = QtCamMetaData::Portrait,
60     InvertedLandscape = QtCamMetaData::InvertedLandscape,
61     InvertedPortrait = QtCamMetaData::InvertedPortrait
62   } Orientation;
63
64   MetaData(QObject *parent = 0);
65   ~MetaData();
66
67   Camera *camera() const;
68   void setCamera(Camera *camera);
69
70   QString manufacturer() const;
71   void setManufacturer(const QString& manufacturer);
72
73   QString model() const;
74   void setModel(const QString& model);
75
76   QString country() const;
77   void setCountry(const QString& country);
78
79   QString city() const;
80   void setCity(const QString& city);
81
82   QString suburb() const;
83   void setSuburb(const QString& suburb);
84
85   double longitude() const;
86   void setLongitude(double longitude);
87
88   double latitude() const;
89   void setLatitude(double latitude);
90
91   double elevation() const;
92   void setElevation(double elevation);
93
94   Orientation orientation() const;
95   void setOrientation(const Orientation& orientation);
96
97   QString artist() const;
98   void setArtist(const QString& artist);
99
100   int captureDirection() const;
101   void setCaptureDirection(int captureDirection);
102
103   double horizontalError() const;
104   void setHorizontalError(double horizontalError);
105
106   bool isLongitudeValid() const;
107   void setLongitudeValid(bool valid);
108
109   bool isLatitudeValid() const;
110   void setLatitudeValid(bool valid);
111
112   bool isElevationValid() const;
113   void setElevationValid(bool valid);
114
115   bool isCaptureDirectionValid() const;
116   void setCaptureDirectionValid(bool valid);
117
118   bool isHorizontalErrorValid() const;
119   void setHorizontalErrorValid(bool valid);
120
121   bool isDateTimeEnabled() const;
122   void setDateTimeEnabled(bool enabled);
123
124 public slots:
125   void setMetaData();
126
127 signals:
128   void cameraChanged();
129   void manufacturerChanged();
130   void modelChanged();
131   void countryChanged();
132   void cityChanged();
133   void suburbChanged();
134   void longitudeChanged();
135   void latitudeChanged();
136   void elevationChanged();
137   void orientationChanged();
138   void artistChanged();
139   void dateTimeChanged();
140   void captureDirectionChanged();
141   void horizontalErrorChanged();
142   void longitudeValidChanged();
143   void latitudeValidChanged();
144   void elevationValidChanged();
145   void captureDirectionValidChanged();
146   void horizontalErrorValidChanged();
147   void dateTimeEnabledChanged();
148
149 private slots:
150   void deviceChanged();
151
152 private:
153   QtCamMetaData *m_data;
154   Camera *m_cam;
155   QString m_manufacturer;
156   QString m_model;
157   QString m_country;
158   QString m_city;
159   QString m_suburb;
160   double m_longitude;
161   double m_latitude;
162   double m_elevation;
163   Orientation m_orientation;
164   QString m_artist;
165   int m_captureDirection;
166   double m_horizontalError;
167   bool m_longitudeValid;
168   bool m_latitudeValid;
169   bool m_elevationValid;
170   bool m_captureDirectionValid;
171   bool m_horizontalErrorValid;
172   bool m_dateTimeEnabled;
173 };
174
175 #endif /* META_DATA_H */