subsurface/qt-mobile/qmlmanager.cpp
Grace Karanja e4e6e896c1 Fix bug where dives are shown twice
On the QML page, dives are repeated. Adding process_dives to
QMLManager after calling parse_file solves this.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-20 14:28:49 -07:00

40 lines
574 B
C++

#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);
}
}