1 #ifndef DEPARTUREBOARD_H
2 #define DEPARTUREBOARD_H
8 #include <QtXmlPatterns>
10 #include <src/servicewindow.h>
11 #include <src/departurewidget.h>
17 class DepartureBoard : public QMainWindow {
20 DepartureBoard(QWidget *parent = 0);
23 void sendRequest(); //Send the network request
24 void show(QString fromCode); //Show the departure board for the relevant station
27 void changeEvent(QEvent *e);
30 void readResponse(QNetworkReply*); //Read the network response & extract the required data
31 void networkError(QNetworkReply::NetworkError);
33 void departureClicked(); //Show the service window for the selected train
35 void downloadProgress(qint64 rec, qint64 total);
36 void uploadProgress(qint64 rec, qint64 total);
38 void ensureConnection(); //Used to wait for a network connection
39 void cancel(); //Cancel the current request for the departure board
42 Ui::DepartureBoard *ui;
44 QNetworkAccessManager * manager;
45 QNetworkReply * m_reply;
47 ServiceWindow * serviceWindow;
55 QNetworkRequest request;
58 inline QString queryOne(QXmlQuery & q, QString query);
59 inline QStringList queryList(QXmlQuery & q, QString query);
61 QStringList serviceID; //The service IDs for
63 QVector<DepartureWidget *> departureWidgets;
65 QDialog * dialog; //Dialog with progress bar for the network request
67 QProgressBar * progress;
68 QPushButton * cancelButton;
74 #endif // DEPARTUREBOARD_H