Dirk asked for a reworked set of patches, here they are.

around 200 lines removed by using QObject properties in a single class, yey.



On Thu, Jan 7, 2016 at 7:53 PM, Tomaz Canabrava <[email protected]> wrote:

> I'm trying to cleanup how we interact from QML to C++
> those patches are cleaning a bunch of code and makign sure things continue
> working as they should.
>
> Mostly:
> - Clean the DiveListModel to only give what we need (the Dive)
> - Move a bit of things around
> - Remove unecessary methods / calls
> - speed up the printing dialog (by lazy loading a QPrinter)
>
> I also wanna merge the DiveListModel with the DiveTripModel in the near
> future, we don't need two different models that does the same thing, but
> that will be a tiny more complex.
>
> Tomaz
>
From 1ec0903fc9bbdd2ff862d37dd23ecfebedcc4e5f Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Fri, 8 Jan 2016 11:59:34 -0200
Subject: [PATCH 5/5] Removed grantlee template code to deal with non-Qobject

Since we alreday have a Q_PROPERTY on the DiveObjectHelper,
grantlee introspection can use that directly to access it's
data, so there's no need for us to redeclare everything.

More QObject Introspection, Less handmade boilerplate for
Grantlee, QML, and a few other things.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 desktop-widgets/templatelayout.h | 54 ----------------------------------------
 1 file changed, 54 deletions(-)

diff --git a/desktop-widgets/templatelayout.h b/desktop-widgets/templatelayout.h
index 6f4478a..9e420f3 100644
--- a/desktop-widgets/templatelayout.h
+++ b/desktop-widgets/templatelayout.h
@@ -49,60 +49,6 @@ Q_DECLARE_METATYPE(template_options)
 Q_DECLARE_METATYPE(print_options)
 Q_DECLARE_METATYPE(YearInfo)
 
-#define _CONC_STR(prop, idx)   _CONC_STR1(prop, idx)
-#define _CONC_STR1(prop, idx)  _CONC_STR2(prop ## idx)
-#define _CONC_STR2(prop)       #prop
-
-#define _RETURN_DIVE_PROPERTY(prop) \
-	if (property == #prop) return object.prop()
-
-#define _RETURN_DIVE_PROPERTY_IDX(prop, idx) \
-	if (property == _CONC_STR(prop, idx)) return object.prop(idx)
-
-GRANTLEE_BEGIN_LOOKUP(DiveObjectHelper)
-_RETURN_DIVE_PROPERTY(number);
-else _RETURN_DIVE_PROPERTY(id);
-else _RETURN_DIVE_PROPERTY(date);
-else _RETURN_DIVE_PROPERTY(time);
-else _RETURN_DIVE_PROPERTY(location);
-else _RETURN_DIVE_PROPERTY(duration);
-else _RETURN_DIVE_PROPERTY(depth);
-else _RETURN_DIVE_PROPERTY(buddy);
-else _RETURN_DIVE_PROPERTY(divemaster);
-else _RETURN_DIVE_PROPERTY(airTemp);
-else _RETURN_DIVE_PROPERTY(waterTemp);
-else _RETURN_DIVE_PROPERTY(notes);
-else _RETURN_DIVE_PROPERTY(rating);
-else _RETURN_DIVE_PROPERTY(sac);
-else _RETURN_DIVE_PROPERTY(tags);
-else _RETURN_DIVE_PROPERTY(gas);
-else _RETURN_DIVE_PROPERTY(suit);
-else _RETURN_DIVE_PROPERTY(cylinders);
-else _RETURN_DIVE_PROPERTY_IDX(cylinder, 0);
-else _RETURN_DIVE_PROPERTY_IDX(cylinder, 1);
-else _RETURN_DIVE_PROPERTY_IDX(cylinder, 2);
-else _RETURN_DIVE_PROPERTY_IDX(cylinder, 3);
-else _RETURN_DIVE_PROPERTY_IDX(cylinder, 4);
-else _RETURN_DIVE_PROPERTY_IDX(cylinder, 5);
-else _RETURN_DIVE_PROPERTY_IDX(cylinder, 6);
-else _RETURN_DIVE_PROPERTY_IDX(cylinder, 7);
-else _RETURN_DIVE_PROPERTY(weights);
-else _RETURN_DIVE_PROPERTY_IDX(weight, 0);
-else _RETURN_DIVE_PROPERTY_IDX(weight, 1);
-else _RETURN_DIVE_PROPERTY_IDX(weight, 2);
-else _RETURN_DIVE_PROPERTY_IDX(weight, 3);
-else _RETURN_DIVE_PROPERTY_IDX(weight, 4);
-else _RETURN_DIVE_PROPERTY_IDX(weight, 5);
-else _RETURN_DIVE_PROPERTY(maxcns);
-else _RETURN_DIVE_PROPERTY(otu);
-GRANTLEE_END_LOOKUP
-
-#undef _RETURN_DIVE_PROPERTY
-#undef _RETURN_DIVE_PROPERTY_IDX
-#undef _CONC_STR
-#undef _CONC_STR1
-#undef _CONC_STR2
-
 GRANTLEE_BEGIN_LOOKUP(template_options)
 if (property == "font") {
 	switch (object.font_index) {
-- 
2.7.0

From 0d3bd02bd47a77ee51fc50cf237825efb9b48767 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 7 Jan 2016 19:33:58 -0200
Subject: [PATCH 4/5] Lazy Initialize QPrinter

it was taking 3 - 4 segs here to open the print dialog,
first I tougth it was a bug in our side, but it looks like
it's a Qt bug, and by lazy initializing it we don't actually
solve this, since it will still take 3 - 4 segs for the printer
to start, but the dialog will appear much quicker.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 desktop-widgets/printdialog.cpp | 32 +++++++++++++++++++++++++-------
 desktop-widgets/printdialog.h   |  4 +++-
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/desktop-widgets/printdialog.cpp b/desktop-widgets/printdialog.cpp
index cf08062..d10e679 100644
--- a/desktop-widgets/printdialog.cpp
+++ b/desktop-widgets/printdialog.cpp
@@ -14,7 +14,10 @@
 
 template_options::color_palette_struct ssrf_colors, almond_colors, blueshades_colors, custom_colors;
 
-PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
+PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) :
+	QDialog(parent, f),
+	printer(NULL),
+	qprinter(NULL)
 {
 	// initialize const colors
 	ssrf_colors.color1 = QColor::fromRgb(0xff, 0xff, 0xff);
@@ -57,7 +60,6 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
 		printOptions.color_selected = s.value("color_selected").toBool();
 		printOptions.landscape = s.value("landscape").toBool();
 		printOptions.p_template = s.value("template_selected").toString();
-		qprinter.setOrientation((QPrinter::Orientation)printOptions.landscape);
 		templateOptions.font_index = s.value("font").toInt();
 		templateOptions.font_size = s.value("font_size").toDouble();
 		templateOptions.color_palette_index = s.value("color_palette").toInt();
@@ -95,9 +97,6 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
 	// create a print options object and pass our options struct
 	optionsWidget = new PrintOptions(this, &printOptions, &templateOptions);
 
-	// create a new printer object
-	printer = new Printer(&qprinter, &printOptions, &templateOptions, Printer::PRINT);
-
 	QVBoxLayout *layout = new QVBoxLayout(this);
 	setLayout(layout);
 
@@ -140,6 +139,12 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
 	connect(this, SIGNAL(finished(int)), this, SLOT(onFinished()));
 }
 
+PrintDialog::~PrintDialog()
+{
+	delete qprinter;
+	delete printer;
+}
+
 void PrintDialog::onFinished()
 {
 	QSettings s;
@@ -165,9 +170,20 @@ void PrintDialog::onFinished()
 	s.setValue("custom_color_5", custom_colors.color5.name());
 }
 
+void PrintDialog::createPrinterObj()
+{
+	// create a new printer object
+	if (!printer) {
+		qprinter = new QPrinter();
+		qprinter->setOrientation((QPrinter::Orientation)printOptions.landscape);
+		printer = new Printer(qprinter, &printOptions, &templateOptions, Printer::PRINT);
+	}
+}
+
 void PrintDialog::previewClicked(void)
 {
-	QPrintPreviewDialog previewDialog(&qprinter, this, Qt::Window
+	createPrinterObj();
+	QPrintPreviewDialog previewDialog(qprinter, this, Qt::Window
 		| Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint
 		| Qt::WindowTitleHint);
 	connect(&previewDialog, SIGNAL(paintRequested(QPrinter *)), this, SLOT(onPaintRequested(QPrinter *)));
@@ -176,7 +192,8 @@ void PrintDialog::previewClicked(void)
 
 void PrintDialog::printClicked(void)
 {
-	QPrintDialog printDialog(&qprinter, this);
+	createPrinterObj();
+	QPrintDialog printDialog(qprinter, this);
 	if (printDialog.exec() == QDialog::Accepted) {
 		connect(printer, SIGNAL(progessUpdated(int)), progressBar, SLOT(setValue(int)));
 		printer->print();
@@ -186,6 +203,7 @@ void PrintDialog::printClicked(void)
 
 void PrintDialog::onPaintRequested(QPrinter *printerPtr)
 {
+	createPrinterObj();
 	connect(printer, SIGNAL(progessUpdated(int)), progressBar, SLOT(setValue(int)));
 	printer->print();
 	progressBar->setValue(0);
diff --git a/desktop-widgets/printdialog.h b/desktop-widgets/printdialog.h
index a00c4c5..c615744 100644
--- a/desktop-widgets/printdialog.h
+++ b/desktop-widgets/printdialog.h
@@ -18,12 +18,13 @@ class PrintDialog : public QDialog {
 
 public:
 	explicit PrintDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
+	virtual ~PrintDialog();
 
 private:
 	PrintOptions *optionsWidget;
 	QProgressBar *progressBar;
 	Printer *printer;
-	QPrinter qprinter;
+	QPrinter *qprinter;
 	struct print_options printOptions;
 	struct template_options templateOptions;
 
@@ -33,6 +34,7 @@ slots:
 	void previewClicked();
 	void printClicked();
 	void onPaintRequested(QPrinter *);
+	void createPrinterObj();
 };
 #endif
 #endif // PRINTDIALOG_H
-- 
2.7.0

From dc7dcfbe249e2903a26a4ad979b60d34219df652 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 7 Jan 2016 16:01:24 -0200
Subject: [PATCH 3/5] 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 <[email protected]>
---
 desktop-widgets/templatelayout.cpp                 |   3 +-
 desktop-widgets/templatelayout.h                   |   4 +-
 qt-mobile/qml/DiveList.qml                         |  43 ++-
 qt-models/divelistmodel.cpp                        |  81 +----
 qt-models/divelistmodel.h                          |  27 +-
 subsurface-core/CMakeLists.txt                     |   3 +
 subsurface-core/qthelper.cpp                       | 347 ---------------------
 subsurface-core/qthelper.h                         | 104 ------
 subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 263 ++++++++++++++++
 subsurface-core/subsurface-qt/DiveObjectHelper.h   |  92 ++++++
 10 files changed, 403 insertions(+), 564 deletions(-)
 create mode 100644 subsurface-core/subsurface-qt/DiveObjectHelper.cpp
 create mode 100644 subsurface-core/subsurface-qt/DiveObjectHelper.h

diff --git a/desktop-widgets/templatelayout.cpp b/desktop-widgets/templatelayout.cpp
index a376459..5976803 100644
--- a/desktop-widgets/templatelayout.cpp
+++ b/desktop-widgets/templatelayout.cpp
@@ -69,7 +69,6 @@ QString TemplateLayout::generate()
 	m_templateLoader->setTemplateDirs(QStringList() << getPrintingTemplatePathUser());
 	m_engine->addTemplateLoader(m_templateLoader);
 
-	Grantlee::registerMetaType<Dive>();
 	Grantlee::registerMetaType<template_options>();
 	Grantlee::registerMetaType<print_options>();
 
@@ -81,7 +80,7 @@ QString TemplateLayout::generate()
 		//TODO check for exporting selected dives only
 		if (!dive->selected && PrintOptions->print_selected)
 			continue;
-		Dive d(dive);
+		DiveObjectHelper *d = new DiveObjectHelper(dive);
 		diveList.append(QVariant::fromValue(d));
 		progress++;
 		emit progressUpdated(progress * 100.0 / totalWork);
diff --git a/desktop-widgets/templatelayout.h b/desktop-widgets/templatelayout.h
index 1ef9b58..6f4478a 100644
--- a/desktop-widgets/templatelayout.h
+++ b/desktop-widgets/templatelayout.h
@@ -7,6 +7,7 @@
 #include "statistics.h"
 #include "qthelper.h"
 #include "helpers.h"
+#include "subsurface-core/subsurface-qt/DiveObjectHelper.h"
 
 int getTotalWork(print_options *printOptions);
 void find_all_templates();
@@ -44,7 +45,6 @@ public:
 	~YearInfo();
 };
 
-Q_DECLARE_METATYPE(Dive)
 Q_DECLARE_METATYPE(template_options)
 Q_DECLARE_METATYPE(print_options)
 Q_DECLARE_METATYPE(YearInfo)
@@ -59,7 +59,7 @@ Q_DECLARE_METATYPE(YearInfo)
 #define _RETURN_DIVE_PROPERTY_IDX(prop, idx) \
 	if (property == _CONC_STR(prop, idx)) return object.prop(idx)
 
-GRANTLEE_BEGIN_LOOKUP(Dive)
+GRANTLEE_BEGIN_LOOKUP(DiveObjectHelper)
 _RETURN_DIVE_PROPERTY(number);
 else _RETURN_DIVE_PROPERTY(id);
 else _RETURN_DIVE_PROPERTY(date);
diff --git a/qt-mobile/qml/DiveList.qml b/qt-mobile/qml/DiveList.qml
index 6d8f492..1a49db2 100644
--- a/qt-mobile/qml/DiveList.qml
+++ b/qt-mobile/qml/DiveList.qml
@@ -14,7 +14,6 @@ MobileComponents.Page {
 	Component {
 		id: diveDelegate
 		MobileComponents.ListItem {
-			id: dive
 			enabled: true
 			checked: diveListView.currentIndex == model.index
 			width: parent.width
@@ -27,22 +26,22 @@ MobileComponents.Page {
 			onClicked: {
 				diveListView.currentIndex = model.index
 				detailsWindow.width = parent.width
-				detailsWindow.location = location
-				detailsWindow.gps = gps
-				detailsWindow.dive_id = id
-				detailsWindow.diveNumber = diveNumber
-				detailsWindow.duration = duration
-				detailsWindow.depth = depth
-				detailsWindow.rating = rating
-				detailsWindow.buddy = buddy
-				detailsWindow.suit = suit
-				detailsWindow.airtemp = airtemp
-				detailsWindow.watertemp = watertemp
-				detailsWindow.divemaster = divemaster
-				detailsWindow.notes = notes
-				detailsWindow.number = diveNumber
-				detailsWindow.date = date
-				detailsWindow.weight = weight
+				detailsWindow.location = dive.location
+				detailsWindow.gps = dive.gps
+				detailsWindow.dive_id = dive.id
+				detailsWindow.diveNumber = dive.number
+				detailsWindow.duration = dive.duration
+				detailsWindow.depth = dive.depth
+				detailsWindow.rating = dive.rating
+				detailsWindow.buddy = dive.buddy
+				detailsWindow.suit = dive.suit
+				detailsWindow.airtemp = dive.airTemp
+				detailsWindow.watertemp = dive.waterTemp
+				detailsWindow.divemaster = dive.divemaster
+				detailsWindow.notes = dive.notes
+				detailsWindow.number = dive.number
+				detailsWindow.date = dive.date
+		//		detailsWindow.weight = dive.weights
 				stackView.push(detailsWindow)
 			}
 
@@ -52,7 +51,7 @@ MobileComponents.Page {
 
 				MobileComponents.Label {
 					id: locationText
-					text: location
+					text: dive.location
 					font.weight: Font.Light
 					elide: Text.ElideRight
 					maximumLineCount: 1 // needed for elide to work at all
@@ -65,7 +64,7 @@ MobileComponents.Page {
 				}
 				MobileComponents.Label {
 					id: dateLabel
-					text: date
+					text: dive.date
 					opacity: 0.6
 					font.pointSize: subsurfaceTheme.smallPointSize
 					anchors {
@@ -87,7 +86,7 @@ MobileComponents.Page {
 						font.pointSize: subsurfaceTheme.smallPointSize
 					}
 					MobileComponents.Label {
-						text: depth
+						text: dive.depth
 						width: Math.max(MobileComponents.Units.gridUnit * 3, paintedWidth) // helps vertical alignment throughout listview
 						font.pointSize: subsurfaceTheme.smallPointSize
 					}
@@ -97,13 +96,13 @@ MobileComponents.Page {
 						font.pointSize: subsurfaceTheme.smallPointSize
 					}
 					MobileComponents.Label {
-						text: duration
+						text: dive.duration
 						font.pointSize: subsurfaceTheme.smallPointSize
 					}
 				}
 				MobileComponents.Label {
 					id: numberText
-					text: "#" + diveNumber
+					text: "#" + dive.location
 					color: MobileComponents.Theme.textColor
 					font.pointSize: subsurfaceTheme.smallPointSize
 					opacity: 0.6
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp
index e812f3d..e651406 100644
--- a/qt-models/divelistmodel.cpp
+++ b/qt-models/divelistmodel.cpp
@@ -12,15 +12,15 @@ DiveListModel::DiveListModel(QObject *parent) : QAbstractListModel(parent)
 void DiveListModel::addDive(dive *d)
 {
 	beginInsertRows(QModelIndex(), rowCount(), rowCount());
-	m_dives.append(Dive(d));
+	m_dives.append(new DiveObjectHelper(d));
 	endInsertRows();
 }
 
 void DiveListModel::updateDive(dive *d)
 {
 	for (int i = 0; i < m_dives.count(); i++) {
-		if (m_dives.at(i).id() == d->id) {
-			Dive newDive(d);
+		if (m_dives.at(i)->id() == d->id) {
+			DiveObjectHelper *newDive = new DiveObjectHelper(d);
 			m_dives.replace(i, newDive);
 			break;
 		}
@@ -31,6 +31,7 @@ void DiveListModel::clear()
 {
 	if (m_dives.count()) {
 		beginRemoveRows(QModelIndex(), 0, m_dives.count() - 1);
+		qDeleteAll(m_dives);
 		m_dives.clear();
 		endRemoveRows();
 	}
@@ -46,76 +47,20 @@ QVariant DiveListModel::data(const QModelIndex &index, int role) const
 	if(index.row() < 0 || index.row() > m_dives.count())
 		return QVariant();
 
-	const Dive &dive = m_dives[index.row()];
-
-	if (role == DiveNumberRole)
-		return dive.number();
-	else if (role == DiveTripRole)
-		return dive.trip();
-	else if (role == DiveDateRole)
-		return (qlonglong)dive.timestamp();
-	else if (role == DiveDateStringRole)
-		return dive.date() + " " + dive.time();
-	else if (role == DiveRatingRole)
-		return QString::number(dive.rating());
-	else if (role == DiveDepthRole)
-		return dive.depth();
-	else if (role == DiveDurationRole)
-		return dive.duration();
-	else if (role == DiveAirTemperatureRole)
-		return dive.airTemp();
-	else if (role == DiveWaterTemperatureRole)
-		return dive.waterTemp();
-	else if (role == DiveWeightRole)
-		return dive.weight(0);
-	else if (role == DiveSuitRole)
-		return dive.suit();
-	else if (role == DiveCylinderRole)
-		return dive.cylinder(0);
-	else if (role == DiveGasRole)
-		return dive.gas();
-	else if (role == DiveSacRole)
-		return dive.sac();
-	else if (role == DiveLocationRole)
-		return dive.location();
-	else if (role == DiveGPSRole)
-		return dive.gps();
-	else if (role == DiveNotesRole)
-		return dive.notes();
-	else if (role == DiveBuddyRole)
-		return dive.buddy();
-	else if (role == DiveMasterRole)
-		return dive.divemaster();
-	else if (role == DiveIdRole)
-		return QString::number(dive.id());
+	DiveObjectHelper *curr_dive = m_dives[index.row()];
+	switch(role) {
+	case DiveRole: return QVariant::fromValue<QObject*>(curr_dive);
+	case DiveDateRole: return (qlonglong)curr_dive->timestamp();
+	}
 	return QVariant();
 
-
 }
 
 QHash<int, QByteArray> DiveListModel::roleNames() const
 {
 	QHash<int, QByteArray> roles;
-	roles[DiveNumberRole] = "diveNumber";
-	roles[DiveTripRole] = "trip";
-	roles[DiveDateStringRole] = "date";
-	roles[DiveRatingRole] = "rating";
-	roles[DiveDepthRole] = "depth";
-	roles[DiveDurationRole] = "duration";
-	roles[DiveAirTemperatureRole] = "airtemp";
-	roles[DiveWaterTemperatureRole] = "watertemp";
-	roles[DiveWeightRole] = "weight";
-	roles[DiveSuitRole] = "suit";
-	roles[DiveCylinderRole] = "cylinder";
-	roles[DiveGasRole] = "gas";
-	roles[DiveSacRole] = "sac";
-	roles[DiveLocationRole] = "location";
-	roles[DiveGPSRole] = "gps";
-	roles[DiveNotesRole] = "notes";
-	roles[DiveBuddyRole] = "buddy";
-	roles[DiveMasterRole] = "divemaster";
-	roles[DiveIdRole] = "id";
-
+	roles[DiveRole] = "dive";
+	roles[DiveDateRole] = "date";
 	return roles;
 }
 
@@ -140,3 +85,7 @@ DiveListModel *DiveListModel::instance()
 {
 	return m_instance;
 }
+
+DiveObjectHelper* DiveListModel::at(int i){
+	return m_dives.at(i);
+}
\ No newline at end of file
diff --git a/qt-models/divelistmodel.h b/qt-models/divelistmodel.h
index f050faa..5265cd1 100644
--- a/qt-models/divelistmodel.h
+++ b/qt-models/divelistmodel.h
@@ -2,8 +2,10 @@
 #define DIVELISTMODEL_H
 
 #include <QAbstractListModel>
+
 #include "dive.h"
 #include "helpers.h"
+#include "subsurface-qt/DiveObjectHelper.h"
 
 class DiveListModel : public QAbstractListModel
 {
@@ -11,26 +13,8 @@ class DiveListModel : public QAbstractListModel
 public:
 
 	enum DiveListRoles {
-		DiveNumberRole = Qt::UserRole + 1,
-		DiveTripRole,
-		DiveDateRole,
-		DiveDateStringRole,
-		DiveRatingRole,
-		DiveDepthRole,
-		DiveDurationRole,
-		DiveWaterTemperatureRole,
-		DiveAirTemperatureRole,
-		DiveWeightRole,
-		DiveSuitRole,
-		DiveCylinderRole,
-		DiveGasRole,
-		DiveSacRole,
-		DiveLocationRole,
-		DiveGPSRole,
-		DiveNotesRole,
-		DiveBuddyRole,
-		DiveMasterRole,
-		DiveIdRole
+		DiveRole = Qt::UserRole + 1,
+		DiveDateRole
 	};
 
 	static DiveListModel *instance();
@@ -42,8 +26,9 @@ public:
 	QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
 	QHash<int, QByteArray> roleNames() const;
 	QString startAddDive();
+	Q_INVOKABLE DiveObjectHelper* at(int i);
 private:
-	QList<Dive> m_dives;
+	QList<DiveObjectHelper*> m_dives;
 	static DiveListModel *m_instance;
 };
 
diff --git a/subsurface-core/CMakeLists.txt b/subsurface-core/CMakeLists.txt
index b8c3ed8..decc94d 100644
--- a/subsurface-core/CMakeLists.txt
+++ b/subsurface-core/CMakeLists.txt
@@ -81,6 +81,9 @@ set(SUBSURFACE_CORE_LIB_SRCS
 	imagedownloader.cpp
 	isocialnetworkintegration.cpp
 	gpslocation.cpp
+
+	#Subsurface Qt have the Subsurface structs QObjectified for easy access via QML.
+	subsurface-qt/DiveObjectHelper.cpp
 	${SERIAL_FTDI}
 	${PLATFORM_SRC}
 	${BT_CORE_SRC_FILES}
diff --git a/subsurface-core/qthelper.cpp b/subsurface-core/qthelper.cpp
index b89fac4..4efe57b 100644
--- a/subsurface-core/qthelper.cpp
+++ b/subsurface-core/qthelper.cpp
@@ -38,353 +38,6 @@ static QLocale loc;
 #define translate(_context, arg) trGettext(arg)
 static const QString DEGREE_SIGNS("dD" UTF8_DEGREE);
 
-#define EMPTY_DIVE_STRING "--"
-
-Dive::Dive() :
-	m_number(-1),
-	dive(NULL)
-{
-}
-
-Dive::~Dive()
-{
-}
-
-int Dive::number() const
-{
-	return m_number;
-}
-
-int Dive::id() const
-{
-	return m_id;
-}
-
-QString Dive::date() const
-{
-	return m_date;
-}
-
-timestamp_t Dive::timestamp() const
-{
-	return m_timestamp;
-}
-
-QString Dive::time() const
-{
-	return m_time;
-}
-
-QString Dive::location() const
-{
-	return m_location;
-}
-
-QString Dive::gps() const
-{
-	return m_gps;
-}
-QString Dive::duration() const
-{
-	return m_duration;
-}
-
-QString Dive::depth() const
-{
-	return m_depth;
-}
-
-QString Dive::divemaster() const
-{
-	return m_divemaster;
-}
-
-QString Dive::buddy() const
-{
-	return m_buddy;
-}
-
-QString Dive::airTemp() const
-{
-	return m_airTemp;
-}
-
-QString Dive::waterTemp() const
-{
-	return m_waterTemp;
-}
-
-QString Dive::notes() const
-{
-	return m_notes;
-}
-
-QString Dive::tags() const
-{
-	return m_tags;
-}
-
-QString Dive::gas() const
-{
-	return m_gas;
-}
-
-QString Dive::sac() const
-{
-	return m_sac;
-}
-
-QString Dive::weights() const
-{
-	QString str = "";
-	for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) {
-		QString entry = m_weights.at(i);
-		if (entry == EMPTY_DIVE_STRING)
-			continue;
-		str += QObject::tr("Weight %1: ").arg(i + 1) + entry + "; ";
-	}
-	return str;
-}
-
-QString Dive::weight(int idx) const
-{
-	if (idx < 0 || idx > m_weights.size() - 1)
-		return QString(EMPTY_DIVE_STRING);
-	return m_weights.at(idx);
-}
-
-QString Dive::suit() const
-{
-	return m_suit;
-}
-
-QString Dive::cylinders() const
-{
-	QString str = "";
-	for (int i = 0; i < MAX_CYLINDERS; i++) {
-		QString entry = m_cylinders.at(i);
-		if (entry == EMPTY_DIVE_STRING)
-			continue;
-		str += QObject::tr("Cylinder %1: ").arg(i + 1) + entry + "; ";
-	}
-	return str;
-}
-
-QString Dive::cylinder(int idx) const
-{
-	if (idx < 0 || idx > m_cylinders.size() - 1)
-		return QString(EMPTY_DIVE_STRING);
-	return m_cylinders.at(idx);
-}
-
-QString Dive::trip() const
-{
-	return m_trip;
-}
-
-QString Dive::maxcns() const
-{
-	return m_maxcns;
-}
-
-QString Dive::otu() const
-{
-	return m_otu;
-}
-
-int Dive::rating() const
-{
-	return m_rating;
-}
-
-void Dive::put_divemaster()
-{
-	if (!dive->divemaster)
-		m_divemaster = EMPTY_DIVE_STRING;
-	else
-		m_divemaster = dive->divemaster;
-}
-
-void Dive::put_date_time()
-{
-	QDateTime localTime = QDateTime::fromTime_t(dive->when - gettimezoneoffset(dive->when));
-	localTime.setTimeSpec(Qt::UTC);
-	m_date = localTime.date().toString(prefs.date_format);
-	m_time = localTime.time().toString(prefs.time_format);
-}
-
-void Dive::put_timestamp()
-{
-	m_timestamp = dive->when;
-}
-
-void Dive::put_location()
-{
-	m_location = QString::fromUtf8(get_dive_location(dive));
-	if (m_location.isEmpty()) {
-		m_location = EMPTY_DIVE_STRING;
-	}
-}
-
-void Dive::put_gps()
-{
-	struct dive_site *ds = get_dive_site_by_uuid(dive->dive_site_uuid);
-	if (ds)
-		m_gps = QString("%1,%2").arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0);
-	else
-		m_gps = QString();
-}
-
-void Dive::put_depth()
-{
-	m_depth = get_depth_string(dive->dc.maxdepth.mm, true, true);
-}
-
-void Dive::put_duration()
-{
-	m_duration = get_dive_duration_string(dive->duration.seconds, QObject::tr("h:"), QObject::tr("min"));
-}
-
-void Dive::put_buddy()
-{
-	if (!dive->buddy)
-		m_buddy = EMPTY_DIVE_STRING;
-	else
-		m_buddy = dive->buddy;
-}
-
-void Dive::put_temp()
-{
-	m_airTemp = get_temperature_string(dive->airtemp, true);
-	m_waterTemp = get_temperature_string(dive->watertemp, true);
-	if (m_airTemp.isEmpty()) {
-		m_airTemp = EMPTY_DIVE_STRING;
-	}
-	if (m_waterTemp.isEmpty()) {
-		m_waterTemp = EMPTY_DIVE_STRING;
-	}
-}
-
-void Dive::put_notes()
-{
-	m_notes = QString::fromUtf8(dive->notes);
-	if (m_notes.isEmpty()) {
-		m_notes = EMPTY_DIVE_STRING;
-		return;
-	}
-	if (same_string(dive->dc.model, "planned dive")) {
-		QTextDocument notes;
-		QString notesFormatted = m_notes;
-#define _NOTES_BR "&#92n"
-		notesFormatted = notesFormatted.replace("<thead>", "<thead>" _NOTES_BR);
-		notesFormatted = notesFormatted.replace("<br>", "<br>" _NOTES_BR);
-		notesFormatted = notesFormatted.replace("<tr>", "<tr>" _NOTES_BR);
-		notesFormatted = notesFormatted.replace("</tr>", "</tr>" _NOTES_BR);
-		notes.setHtml(notesFormatted);
-		m_notes = notes.toPlainText();
-		m_notes.replace(_NOTES_BR, "<br>");
-#undef _NOTES_BR
-	} else {
-		m_notes.replace("\n", "<br>");
-	}
-}
-
-void Dive::put_tags()
-{
-	char buffer[256];
-	taglist_get_tagstring(dive->tag_list, buffer, 256);
-	m_tags = QString(buffer);
-}
-
-void Dive::put_gas()
-{
-	int added = 0;
-	QString gas, gases;
-	for (int i = 0; i < MAX_CYLINDERS; i++) {
-		if (!is_cylinder_used(dive, i))
-			continue;
-		gas = dive->cylinder[i].type.description;
-		gas += QString(!gas.isEmpty() ? " " : "") + gasname(&dive->cylinder[i].gasmix);
-		// if has a description and if such gas is not already present
-		if (!gas.isEmpty() && gases.indexOf(gas) == -1) {
-			if (added > 0)
-				gases += QString(" / ");
-			gases += gas;
-			added++;
-		}
-	}
-	m_gas = gases;
-}
-
-void Dive::put_sac()
-{
-	if (dive->sac) {
-		const char *unit;
-		int decimal;
-		double value = get_volume_units(dive->sac, &decimal, &unit);
-		m_sac = QString::number(value, 'f', decimal).append(unit);
-	}
-}
-
-static QString getFormattedWeight(struct dive *dive, unsigned int idx)
-{
-	weightsystem_t *weight = &dive->weightsystem[idx];
-	if (!weight->description)
-		return QString(EMPTY_DIVE_STRING);
-	QString fmt = QString(weight->description);
-	fmt += ", " + get_weight_string(weight->weight, true);
-	return fmt;
-}
-
-void Dive::put_weight()
-{
-	for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++)
-		m_weights << getFormattedWeight(dive, i);
-}
-
-void Dive::put_suit()
-{
-	m_suit = QString(dive->suit);
-}
-
-static QString getFormattedCylinder(struct dive *dive, unsigned int idx)
-{
-	cylinder_t *cyl = &dive->cylinder[idx];
-	const char *desc = cyl->type.description;
-	if (!desc && idx > 0)
-		return QString(EMPTY_DIVE_STRING);
-	QString fmt = desc ? QString(desc) : QObject::tr("unknown");
-	fmt += ", " + get_volume_string(cyl->type.size, true, 0);
-	fmt += ", " + get_pressure_string(cyl->type.workingpressure, true);
-	fmt += ", " + get_pressure_string(cyl->start, false) + " - " + get_pressure_string(cyl->end, true);
-	fmt += ", " + get_gas_string(cyl->gasmix);
-	return fmt;
-}
-
-void Dive::put_cylinder()
-{
-	for (int i = 0; i < MAX_CYLINDERS; i++)
-		m_cylinders << getFormattedCylinder(dive, i);
-}
-
-void Dive::put_trip()
-{
-	dive_trip *trip = dive->divetrip;
-	if (trip) {
-		m_trip = QString(trip->location);
-	}
-}
-
-void Dive::put_maxcns()
-{
-	m_maxcns = QString::number(dive->maxcns);
-}
-
-void Dive::put_otu()
-{
-	m_otu = QString::number(dive->otu);
-}
-
 QString weight_string(int weight_in_grams)
 {
 	QString str;
diff --git a/subsurface-core/qthelper.h b/subsurface-core/qthelper.h
index 0049e9b..842e40c 100644
--- a/subsurface-core/qthelper.h
+++ b/subsurface-core/qthelper.h
@@ -9,110 +9,6 @@
 #include <QTranslator>
 #include <QDir>
 
-class Dive {
-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 *dive;
-	void put_date_time();
-	void put_timestamp();
-	void put_location();
-	void put_gps();
-	void put_duration();
-	void put_depth();
-	void put_divemaster();
-	void put_buddy();
-	void put_temp();
-	void put_notes();
-	void put_tags();
-	void put_gas();
-	void put_sac();
-	void put_weight();
-	void put_suit();
-	void put_cylinder();
-	void put_trip();
-	void put_maxcns();
-	void put_otu();
-
-public:
-	Dive(struct dive *dive)
-		: dive(dive)
-	{
-		m_number = dive->number;
-		m_id = dive->id;
-		m_rating = dive->rating;
-		put_date_time();
-		put_location();
-		put_gps();
-		put_duration();
-		put_depth();
-		put_divemaster();
-		put_buddy();
-		put_temp();
-		put_notes();
-		put_tags();
-		put_gas();
-		put_sac();
-		put_timestamp();
-		put_weight();
-		put_suit();
-		put_cylinder();
-		put_trip();
-		put_maxcns();
-		put_otu();
-	}
-	Dive();
-	~Dive();
-	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;
-	QString weights() const;
-	QString weight(int idx) const;
-	QString suit() const;
-	QString cylinders() const;
-	QString cylinder(int idx) const;
-	QString trip() const;
-	QString maxcns() const;
-	QString otu() const;
-};
-
 // global pointers for our translation
 extern QTranslator *qtTranslator, *ssrfTranslator;
 
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
new file mode 100644
index 0000000..03e6378
--- /dev/null
+++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp
@@ -0,0 +1,263 @@
+#include "DiveObjectHelper.h"
+
+#include <QDateTime>
+#include <QTextDocument>
+
+#include "../qthelper.h"
+#include "../helpers.h"
+
+static QString EMPTY_DIVE_STRING = QStringLiteral("--");
+
+
+static QString getFormattedWeight(struct dive *dive, unsigned int idx)
+{
+        weightsystem_t *weight = &dive->weightsystem[idx];
+        if (!weight->description)
+                return QString(EMPTY_DIVE_STRING);
+        QString fmt = QString(weight->description);
+        fmt += ", " + get_weight_string(weight->weight, true);
+        return fmt;
+}
+
+static QString getFormattedCylinder(struct dive *dive, unsigned int idx)
+{
+        cylinder_t *cyl = &dive->cylinder[idx];
+        const char *desc = cyl->type.description;
+        if (!desc && idx > 0)
+                return QString(EMPTY_DIVE_STRING);
+        QString fmt = desc ? QString(desc) : QObject::tr("unknown");
+        fmt += ", " + get_volume_string(cyl->type.size, true, 0);
+        fmt += ", " + get_pressure_string(cyl->type.workingpressure, true);
+        fmt += ", " + get_pressure_string(cyl->start, false) + " - " + get_pressure_string(cyl->end, true);
+        fmt += ", " + get_gas_string(cyl->gasmix);
+        return fmt;
+}
+
+DiveObjectHelper::DiveObjectHelper(struct dive *d) :
+	m_number(d->number),
+	m_id(d->id),
+	m_rating(d->rating),
+	m_timestamp(d->when),
+	m_location(get_dive_location(d) ? QString::fromUtf8(get_dive_location(d)) : EMPTY_DIVE_STRING),
+	m_duration(get_dive_duration_string(d->duration.seconds, QObject::tr("h:"), QObject::tr("min"))),
+	m_depth(get_depth_string(d->dc.maxdepth.mm, true, true)),
+	m_divemaster(d->divemaster ? d->divemaster : EMPTY_DIVE_STRING),
+	m_buddy(d->buddy ? d->buddy : EMPTY_DIVE_STRING),
+	m_airTemp(get_temperature_string(d->airtemp, true)),
+	m_waterTemp(get_temperature_string(d->watertemp, true)),
+	m_suit(d->suit ? d->suit : EMPTY_DIVE_STRING),
+	m_trip(d->divetrip ? d->divetrip->location : EMPTY_DIVE_STRING),
+	m_maxcns(d->maxcns),
+	m_otu(d->otu),
+	m_dive(d)
+{
+	struct dive_site *ds = get_dive_site_by_uuid(d->dive_site_uuid);
+	if (ds)
+		m_gps = QString("%1,%2").arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0);
+
+	if (m_airTemp.isEmpty()) {
+		m_airTemp = EMPTY_DIVE_STRING;
+	}
+	if (m_waterTemp.isEmpty()) {
+		m_waterTemp = EMPTY_DIVE_STRING;
+	}
+
+	m_notes = QString::fromUtf8(d->notes);
+	if (m_notes.isEmpty()) {
+		m_notes = EMPTY_DIVE_STRING;
+		return;
+	}
+	if (same_string(d->dc.model, "planned dive")) {
+		QTextDocument notes;
+		QString notesFormatted = m_notes;
+	#define _NOTES_BR "&#92n"
+		notesFormatted = notesFormatted.replace("<thead>", "<thead>" _NOTES_BR);
+		notesFormatted = notesFormatted.replace("<br>", "<br>" _NOTES_BR);
+		notesFormatted = notesFormatted.replace("<tr>", "<tr>" _NOTES_BR);
+		notesFormatted = notesFormatted.replace("</tr>", "</tr>" _NOTES_BR);
+		notes.setHtml(notesFormatted);
+		m_notes = notes.toPlainText();
+		m_notes.replace(_NOTES_BR, "<br>");
+	#undef _NOTES_BR
+	} else {
+		m_notes.replace("\n", "<br>");
+	}
+
+
+	char buffer[256];
+	taglist_get_tagstring(d->tag_list, buffer, 256);
+	m_tags = QString(buffer);
+
+
+	int added = 0;
+	QString gas, gases;
+	for (int i = 0; i < MAX_CYLINDERS; i++) {
+		if (!is_cylinder_used(d, i))
+			continue;
+		gas = d->cylinder[i].type.description;
+		gas += QString(!gas.isEmpty() ? " " : "") + gasname(&d->cylinder[i].gasmix);
+		// if has a description and if such gas is not already present
+		if (!gas.isEmpty() && gases.indexOf(gas) == -1) {
+			if (added > 0)
+				gases += QString(" / ");
+			gases += gas;
+			added++;
+		}
+	}
+	m_gas = gases;
+
+	if (d->sac) {
+		const char *unit;
+		int decimal;
+		double value = get_volume_units(d->sac, &decimal, &unit);
+		m_sac = QString::number(value, 'f', decimal).append(unit);
+	}
+
+	for (int i = 0; i < MAX_CYLINDERS; i++)
+		m_cylinders << getFormattedCylinder(d, i);
+
+	for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++)
+		m_weights << getFormattedWeight(d, i);
+
+	QDateTime localTime = QDateTime::fromTime_t(d->when - gettimezoneoffset(d->when));
+	localTime.setTimeSpec(Qt::UTC);
+	m_date = localTime.date().toString(prefs.date_format);
+	m_time = localTime.time().toString(prefs.time_format);
+}
+
+DiveObjectHelper::~DiveObjectHelper()
+{
+}
+
+int DiveObjectHelper::number() const
+{
+	return m_number;
+}
+
+int DiveObjectHelper::id() const
+{
+	return m_id;
+}
+
+QString DiveObjectHelper::date() const
+{
+	return m_date;
+}
+
+timestamp_t DiveObjectHelper::timestamp() const
+{
+	return m_timestamp;
+}
+
+QString DiveObjectHelper::time() const
+{
+	return m_time;
+}
+
+QString DiveObjectHelper::location() const
+{
+	return m_location;
+}
+
+QString DiveObjectHelper::gps() const
+{
+	return m_gps;
+}
+QString DiveObjectHelper::duration() const
+{
+	return m_duration;
+}
+
+QString DiveObjectHelper::depth() const
+{
+	return m_depth;
+}
+
+QString DiveObjectHelper::divemaster() const
+{
+	return m_divemaster;
+}
+
+QString DiveObjectHelper::buddy() const
+{
+	return m_buddy;
+}
+
+QString DiveObjectHelper::airTemp() const
+{
+	return m_airTemp;
+}
+
+QString DiveObjectHelper::waterTemp() const
+{
+	return m_waterTemp;
+}
+
+QString DiveObjectHelper::notes() const
+{
+	return m_notes;
+}
+
+QString DiveObjectHelper::tags() const
+{
+	return m_tags;
+}
+
+QString DiveObjectHelper::gas() const
+{
+	return m_gas;
+}
+
+QString DiveObjectHelper::sac() const
+{
+	return m_sac;
+}
+
+QStringList DiveObjectHelper::weights() const
+{
+return m_weights;
+}
+
+QString DiveObjectHelper::weight(int idx) const
+{
+	if (idx < 0 || idx > m_weights.size() - 1)
+		return QString(EMPTY_DIVE_STRING);
+	return m_weights.at(idx);
+}
+
+QString DiveObjectHelper::suit() const
+{
+	return m_suit;
+}
+
+QStringList DiveObjectHelper::cylinders() const
+{
+	return m_cylinders;
+}
+
+QString DiveObjectHelper::cylinder(int idx) const
+{
+	if (idx < 0 || idx > m_cylinders.size() - 1)
+		return QString(EMPTY_DIVE_STRING);
+	return m_cylinders.at(idx);
+}
+
+QString DiveObjectHelper::trip() const
+{
+	return m_trip;
+}
+
+QString DiveObjectHelper::maxcns() const
+{
+	return m_maxcns;
+}
+
+QString DiveObjectHelper::otu() const
+{
+	return m_otu;
+}
+
+int DiveObjectHelper::rating() const
+{
+	return m_rating;
+}
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h
new file mode 100644
index 0000000..5e7858b
--- /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
-- 
2.7.0

From e38ed07947e9c745daefb7b4f72033ce7ccae012 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 7 Jan 2016 15:33:28 -0200
Subject: [PATCH 2/5] Force the creation of some soft-links

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 cmake/Modules/HandleFindMarble.cmake | 2 +-
 cmake/Modules/RunOnBuildDir.cmake    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cmake/Modules/HandleFindMarble.cmake b/cmake/Modules/HandleFindMarble.cmake
index c812e25..a3ca8fb 100644
--- a/cmake/Modules/HandleFindMarble.cmake
+++ b/cmake/Modules/HandleFindMarble.cmake
@@ -15,7 +15,7 @@ if(NOT NO_MARBLE)
 			set(MARBLE_LIBRARIES "")
 		endif()
 	endif()
-	add_custom_target(link_marble_data ALL COMMAND rm -rf ./marbledata && ln -s ${CMAKE_SOURCE_DIR}/marbledata ${CMAKE_BINARY_DIR}/marbledata)
+	add_custom_target(link_marble_data ALL COMMAND rm -rf ./marbledata && ln -sf ${CMAKE_SOURCE_DIR}/marbledata ${CMAKE_BINARY_DIR}/marbledata)
 else()
 	message(STATUS "building without marble widget support")
 	add_definitions(-DNO_MARBLE)
diff --git a/cmake/Modules/RunOnBuildDir.cmake b/cmake/Modules/RunOnBuildDir.cmake
index bf674be..854578e 100644
--- a/cmake/Modules/RunOnBuildDir.cmake
+++ b/cmake/Modules/RunOnBuildDir.cmake
@@ -3,13 +3,13 @@
 add_custom_target(themeLink ALL
 	COMMAND
 	rm -f ${CMAKE_BINARY_DIR}/theme &&
-	ln -s ${CMAKE_SOURCE_DIR}/theme ${CMAKE_BINARY_DIR}/theme
+	ln -sf ${CMAKE_SOURCE_DIR}/theme ${CMAKE_BINARY_DIR}/theme
 )
 if(NOT NO_PRINTING)
 	add_custom_target(printing_templatesLink ALL
 		COMMAND
 		rm -f ${CMAKE_BINARY_DIR}/printing_templates &&
-		ln -s ${CMAKE_SOURCE_DIR}/printing_templates ${CMAKE_BINARY_DIR}/printing_templates
+		ln -sf ${CMAKE_SOURCE_DIR}/printing_templates ${CMAKE_BINARY_DIR}/printing_templates
 	)
 endif()
 if(NOT NO_DOCS)
@@ -18,7 +18,7 @@ if(NOT NO_DOCS)
 		COMMAND
 		mkdir -p ${CMAKE_BINARY_DIR}/Documentation/ &&
 		rm -rf ${CMAKE_BINARY_DIR}/Documentation/images &&
-		ln -s ${CMAKE_SOURCE_DIR}/Documentation/images ${CMAKE_BINARY_DIR}/Documentation/images
+		ln -sf ${CMAKE_SOURCE_DIR}/Documentation/images ${CMAKE_BINARY_DIR}/Documentation/images
 	)
 	add_custom_target(
 		documentation ALL
-- 
2.7.0

From 7722f3f1e0e6ff366af994cf9689fc1cfe88a207 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Thu, 7 Jan 2016 14:38:16 -0200
Subject: [PATCH 1/5] Correctly handle SubsurfaceMobile

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 CMakeLists.txt                | 13 +++++--------
 profile-widget/CMakeLists.txt |  3 ---
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 18101e0..8042aa7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -127,6 +127,7 @@ if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "DesktopExecutable")
 	else()
 		set(SUBSURFACE_TARGET subsurface)
 	endif()
+	remove_definitions(-DSUBSURFACE_MOBILE)
 elseif(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
 	if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
 		set(SUBSURFACE_TARGET Subsurface-mobile)
@@ -425,14 +426,10 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
 	install(DIRECTORY theme DESTINATION share/subsurface)
 	install(DIRECTORY printing_templates DESTINATION share/subsurface)
 	install(FILES ${TRANSLATIONS} DESTINATION share/subsurface/translations)
-	if(SUBSURFACE_MOBILE)
-		install(TARGETS ${SUBSURFACE_TARGET} DESTINATION bin)
-	else()
-		install(TARGETS ${SUBSURFACE_TARGET} DESTINATION bin)
-		if (SMARTTRAK_IMPORT)
-			install(TARGETS ${SMTK_IMPORT_TARGET} DESTINATION bin)
-		endif()
-	endif()
+        install(TARGETS ${SUBSURFACE_TARGET} DESTINATION bin)
+        if (SMARTTRAK_IMPORT)
+                install(TARGETS ${SMTK_IMPORT_TARGET} DESTINATION bin)
+        endif()
 	if(DEFINED LIBMARBLEDEVEL)
 		install(
 			CODE "file(GLOB SSRFMARBLE_SHLIBS \"${LIBMARBLEDEVEL}/lib/libssrfmarblewidget.so*\")"
diff --git a/profile-widget/CMakeLists.txt b/profile-widget/CMakeLists.txt
index 73807fb..0acc2cb 100644
--- a/profile-widget/CMakeLists.txt
+++ b/profile-widget/CMakeLists.txt
@@ -14,9 +14,6 @@ set(SUBSURFACE_PROFILE_LIB_SRCS
 	tankitem.cpp
 )
 source_group("Subsurface Profile" FILES ${SUBSURFACE_PROFILE_LIB_SRCS})
-if (SUBSURFACE_MOBILE)
-	add_definitions(-DSUBSURFACE_MOBILE=1)
-endif()
 
 add_library(subsurface_profile STATIC ${SUBSURFACE_PROFILE_LIB_SRCS})
 target_link_libraries(subsurface_profile ${QT_LIBRARIES})
-- 
2.7.0

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to