Bump version to 0.9.0
[quandoparte] / application / stationschedulemodel.h
index bead128..1f97de7 100644 (file)
@@ -32,7 +32,9 @@ class StationScheduleModel : public QAbstractListModel
 {
     Q_OBJECT
     Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+    Q_PROPERTY(QString code READ code WRITE setCode NOTIFY codeChanged)
     Q_PROPERTY(ScheduleType type READ type WRITE setType NOTIFY typeChanged)
+    Q_PROPERTY(QString error READ error WRITE setError NOTIFY errorChanged)
     Q_ENUMS(ScheduleType)
 
     enum StationRoles {
@@ -43,7 +45,9 @@ class StationScheduleModel : public QAbstractListModel
         ArrivalTimeRole,
         DetailsUrlRole,
         DelayRole,
-        DelayClassRole
+        DelayClassRole,
+        ExpectedPlatformRole,
+        ActualPlatformRole
     };
 
 public:
@@ -54,27 +58,40 @@ public:
 
     explicit StationScheduleModel(const QString &name = "", QObject *parent = 0);
 
-    QString &name();
+    const QString &name();
     void setName(const QString &name);
 
+    const QString &code();
+    void setCode(const QString &code);
+
     ScheduleType type();
     void setType(ScheduleType type);
 
     int rowCount(const QModelIndex &parent) const;
     QVariant data(const QModelIndex &index, int role) const;
 
+    const QString &error();
+    void setError(const QString &code);
+
+    QHash<int, QByteArray> roleNames() const;
+
 signals:
     void nameChanged();
+    void codeChanged();
     void typeChanged();
+    void errorChanged();
 
 public slots:
-    void fetch(const QString &name);
+    void fetch(const QString &name, const QString &code = QString());
 
 private slots:
     void parse(const QByteArray &htmlReply, const QUrl &baseUrl);
+    void onNetworkError(void);
 
 private:
     QString m_name;
+    QString m_code;
+    QString m_error;
     QList<StationScheduleItem> m_departureSchedules;
     QList<StationScheduleItem> m_arrivalSchedules;
     ScheduleType m_scheduleType;