mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
e4e6e896c1
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>
40 lines
574 B
C++
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);
|
|
}
|
|
}
|