Added support for Geographical sorting
[quandoparte] / application / stationlistmodel.h
1 #ifndef STATIONLISTMODEL_H
2 #define STATIONLISTMODEL_H
3
4 #include <QStandardItemModel>
5 #include <QXmlStreamReader>
6
7 class QStandardItem;
8 class StationListModel;
9
10 class StationListModel : public QStandardItemModel
11 {
12     Q_OBJECT
13
14 public:
15     enum StationListRole {
16         PositionRole = Qt::UserRole + 1, //< QGeoCoordinate - Station coordinate
17         StationIdRole, //< QString - Station Id (Precise name if the Display name is known to fail)
18         RecentIndicatorRole //<bool - If the station has been recently looked up
19     };
20
21     explicit StationListModel(QObject *parent = 0);
22
23     bool load(const QString &filename);
24
25 signals:
26
27 public slots:
28
29 private:
30     void readStationsElement();
31     void readStationElement();
32     void readPosElement(QStandardItem *item);
33     void readNameElement(QStandardItem *item);
34     void skipUnknownElement();
35
36     QXmlStreamReader m_reader;
37 };
38
39 #endif // STATIONLISTMODEL_H