Made the view a sublcass of QDeclarativeView
[quandoparte] / application / stationlistmodel.cpp
index 4c3bc54..01083d8 100644 (file)
@@ -1,6 +1,7 @@
 #include "stationlistmodel.h"
 
 #include <QFile>
+#include <QFileInfo>
 #include <QDebug>
 #include <QStandardItem>
 #include <QGeoCoordinate>
@@ -18,8 +19,9 @@ StationListModel::StationListModel(QObject *parent) :
 bool StationListModel::load(const QString &filename)
 {
     QFile file(filename);
+    QFileInfo fi(file);
 
-    qDebug() << "loading filename:" << filename;
+    qDebug() << "loading file:" << fi.absoluteFilePath();
 
     if (!file.open(QFile::ReadOnly | QFile::Text)) {
         qDebug() << "cannot open file:" << filename;
@@ -51,8 +53,6 @@ bool StationListModel::load(const QString &filename)
 
 void StationListModel::readStationsElement()
 {
-    qDebug() << "reading stations element";
-
     m_reader.readNext();
     while (!m_reader.atEnd()) {
         if (m_reader.isEndElement()) {
@@ -72,8 +72,6 @@ void StationListModel::readStationsElement()
 
 void StationListModel::readStationElement()
 {
-    qDebug() << "reading station element";
-
     QStandardItem *item = new QStandardItem;
     m_reader.readNext();
     while (!m_reader.atEnd()) {
@@ -97,8 +95,6 @@ void StationListModel::readStationElement()
 
 void StationListModel::readPosElement(QStandardItem *item)
 {
-    qDebug() << "reading pos element";
-
     QStringList coordinates = m_reader.readElementText().split(",");
     QGeoCoordinate pos = QGeoCoordinate(coordinates[0].toDouble(), coordinates[1].toDouble());
     item->setData(QVariant::fromValue(pos), PositionRole);
@@ -111,8 +107,6 @@ void StationListModel::readPosElement(QStandardItem *item)
 
 void StationListModel::readNameElement(QStandardItem *item)
 {
-    qDebug() << "reading name element";
-
     item->setText(m_reader.readElementText());
     qDebug() << "name:" << item->text();
     if (m_reader.isEndElement()) {