aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile/qmlmanager.cpp
blob: eeeada3e0414b10fd3f0a135b8f96521e1c70e0e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "qmlmanager.h"
#include <QUrl>

#include "qt-models/divelistmodel.h"
#include "divelist.h"

QMLManager::QMLManager()
{
}


QMLManager::~QMLManager()
{
}

QString QMLManager::filename()
{
	return m_fileName;
}

void QMLManager::setFilename(const QString &f)
{
	m_fileName = f;
	loadFile();
}

void QMLManager::loadFile()
{
	QUrl url(m_fileName);
	QString strippedFileName = url.toLocalFile();

	parse_file(strippedFileName.toUtf8().data());
	process_dives(false, false);
	int i;
	struct dive *d;

	for_each_dive(i, d) {
		DiveListModel::instance()->addDive(d);
	}
}