1 #ifndef SERVICEWINDOW_H
2 #define SERVICEWINDOW_H
7 #include <QtXmlPatterns>
8 #include "departurewidget.h"
15 class ServiceWindow : public QMainWindow
19 ServiceWindow(QWidget *parent = 0);
22 void sendRequest(); //Send the network request
23 void show(QString serviceID);
26 void changeEvent(QEvent *e);
29 void readResponse(QNetworkReply*); //Read the network response & extract the required data
30 void networkError(QNetworkReply::NetworkError);
32 void downloadProgress(qint64 rec, qint64 total);
33 void uploadProgress(qint64 rec, qint64 total);
35 void ensureConnection(); //Used to wait for a network connection
36 void cancel(); //Cancel the current request for the departure board
39 Ui::ServiceWindow *ui;
43 QNetworkAccessManager * manager;
44 QNetworkReply * m_reply;
46 ServiceWindow * serviceWindow;
54 QNetworkRequest request;
57 inline QString queryOne(QXmlQuery & q, QString query);
58 inline QStringList queryList(QXmlQuery & q, QString query);
60 QVector<DepartureWidget *> departureWidgets;
62 QDialog * dialog; //Dialog with progress bar for the network request
64 QProgressBar * progress;
65 QPushButton * cancelButton;
71 #endif // SERVICEWINDOW_H