diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2016-01-07 16:01:24 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-08 08:04:44 -0800 |
commit | 25aa80846b84c0b3cd3e0b0256a046e1e92fb1db (patch) | |
tree | c9934f39f2e039e5877af7ee0d3b0d96c5a1debf /subsurface-core/subsurface-qt/DiveObjectHelper.h | |
parent | c022f5c4f71f3e7670ed458d714d96fd6e88c55b (diff) | |
download | subsurface-25aa80846b84c0b3cd3e0b0256a046e1e92fb1db.tar.gz |
Move Dive class from qthelper.h/cpp to it's own file
and rename it to DiveObjectHelper, since it should be an QObject
based class to make it easier on the QML, grantlee and widgets
side to display the dive's internal data.
each Q_PROPERTY defined in the DiveObjectHelper.h file
can be acessed directly via it's name.
So, if you are on a model that returns a dive, acess it's name
by dive.name
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/subsurface-qt/DiveObjectHelper.h')
-rw-r--r-- | subsurface-core/subsurface-qt/DiveObjectHelper.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h new file mode 100644 index 000000000..5e7858b24 --- /dev/null +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -0,0 +1,92 @@ +#ifndef DIVE_QOBJECT_H +#define DIVE_QOBJECT_H + +#include "../dive.h" +#include <QObject> +#include <QString> + +class DiveObjectHelper : public QObject { + Q_OBJECT + Q_PROPERTY(int number READ number CONSTANT) + Q_PROPERTY(int id READ id CONSTANT) + Q_PROPERTY(int rating READ rating CONSTANT) + Q_PROPERTY(QString date READ date CONSTANT) + Q_PROPERTY(QString time READ time CONSTANT) + Q_PROPERTY(QString location READ location CONSTANT) + Q_PROPERTY(QString gps READ gps CONSTANT) + Q_PROPERTY(QString duration READ duration CONSTANT) + Q_PROPERTY(QString depth READ depth CONSTANT) + Q_PROPERTY(QString divemaster READ divemaster CONSTANT) + Q_PROPERTY(QString buddy READ buddy CONSTANT) + Q_PROPERTY(QString airTemp READ airTemp CONSTANT) + Q_PROPERTY(QString waterTemp READ waterTemp CONSTANT) + Q_PROPERTY(QString notes READ notes CONSTANT) + Q_PROPERTY(QString tags READ tags CONSTANT) + Q_PROPERTY(QString gas READ gas CONSTANT) + Q_PROPERTY(QString sac READ sac CONSTANT) + Q_PROPERTY(QStringList weights READ weights CONSTANT) + Q_PROPERTY(QString suit READ suit CONSTANT) + Q_PROPERTY(QStringList cylinders READ cylinders CONSTANT) + Q_PROPERTY(QString trip READ trip CONSTANT) + Q_PROPERTY(QString maxcns READ maxcns CONSTANT) + Q_PROPERTY(QString otu READ otu CONSTANT) +public: + DiveObjectHelper(struct dive *dive = NULL); + ~DiveObjectHelper(); + int number() const; + int id() const; + int rating() const; + QString date() const; + timestamp_t timestamp() const; + QString time() const; + QString location() const; + QString gps() const; + QString duration() const; + QString depth() const; + QString divemaster() const; + QString buddy() const; + QString airTemp() const; + QString waterTemp() const; + QString notes() const; + QString tags() const; + QString gas() const; + QString sac() const; + QStringList weights() const; + QString weight(int idx) const; + QString suit() const; + QStringList cylinders() const; + QString cylinder(int idx) const; + QString trip() const; + QString maxcns() const; + QString otu() const; +private: + int m_number; + int m_id; + int m_rating; + QString m_date; + timestamp_t m_timestamp; + QString m_time; + QString m_location; + QString m_gps; + QString m_duration; + QString m_depth; + QString m_divemaster; + QString m_buddy; + QString m_airTemp; + QString m_waterTemp; + QString m_notes; + QString m_tags; + QString m_gas; + QString m_sac; + QStringList m_weights; + QString m_suit; + QStringList m_cylinders; + QString m_trip; + QString m_maxcns; + QString m_otu; + struct dive *m_dive; + +}; +Q_DECLARE_METATYPE(DiveObjectHelper*) + +#endif
\ No newline at end of file |