2015-06-04 10:29:50 +00:00
|
|
|
#include "qmlmanager.h"
|
2015-06-04 10:36:36 +00:00
|
|
|
#include <QUrl>
|
2015-06-04 10:29:50 +00:00
|
|
|
|
2015-06-11 06:56:18 +00:00
|
|
|
#include "qt-models/divelistmodel.h"
|
|
|
|
#include "divelist.h"
|
2015-06-09 19:20:44 +00:00
|
|
|
|
2015-06-04 10:29:50 +00:00
|
|
|
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();
|
2015-06-09 19:20:44 +00:00
|
|
|
|
|
|
|
parse_file(strippedFileName.toUtf8().data());
|
2015-06-11 06:56:18 +00:00
|
|
|
process_dives(false, false);
|
2015-06-09 19:20:44 +00:00
|
|
|
int i;
|
|
|
|
struct dive *d;
|
|
|
|
|
|
|
|
for_each_dive(i, d) {
|
|
|
|
DiveListModel::instance()->addDive(d);
|
|
|
|
}
|
2015-06-04 10:29:50 +00:00
|
|
|
}
|