aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Grace Karanja <gracie.karanja89@gmail.com>2015-06-09 22:20:44 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-20 14:26:56 -0700
commitb7e4b35cde1f1a6be01818eac94732186a1b99ab (patch)
tree4dfa16a09d9e0ec8526d05ce1b4107b8c122d81e /qt-mobile/qmlmanager.cpp
parentbf882416f92fef648f8951a55b4b06dacf56bc3b (diff)
downloadsubsurface-b7e4b35cde1f1a6be01818eac94732186a1b99ab.tar.gz
Add DiveListModel
This model will be used to show the dives in QML. This commit adds the model, and the means to link it to QML. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qmlmanager.cpp')
-rw-r--r--qt-mobile/qmlmanager.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp
index 6a770b256..0f8ccbe61 100644
--- a/qt-mobile/qmlmanager.cpp
+++ b/qt-mobile/qmlmanager.cpp
@@ -1,15 +1,15 @@
#include "qmlmanager.h"
#include <QUrl>
+#include "../qt-models/divelistmodel.h"
+
QMLManager::QMLManager()
{
-
}
QMLManager::~QMLManager()
{
-
}
QString QMLManager::filename()
@@ -20,12 +20,21 @@ QString QMLManager::filename()
void QMLManager::setFilename(const QString &f)
{
m_fileName = f;
- emit filenameChanged();
loadFile();
+ emit filenameChanged();
}
void QMLManager::loadFile()
{
QUrl url(m_fileName);
QString strippedFileName = url.toLocalFile();
+
+ parse_file(strippedFileName.toUtf8().data());
+
+ int i;
+ struct dive *d;
+
+ for_each_dive(i, d) {
+ DiveListModel::instance()->addDive(d);
+ }
}