Added error handling to listing of users and showing of user information.
[speedfreak] / Client / xmlreader.h
1 /*
2  * Parse xml file
3  *
4  * @author     Toni Jussila <toni.jussila@fudeco.com>
5  * @author     Tiina Kivilinna-Korhola <tiina.kivilinna-korhola@fudeco.com>
6  * @copyright  (c) 2010 Speed Freak team
7  * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
8  */
9
10 #ifndef XMLREADER_H
11 #define XMLREADER_H
12
13 #include <QXmlStreamReader>
14 #include <QStringList>
15 #include <QNetworkReply>
16 #include "categorylist.h"
17
18 class ProfileDialog;
19
20 class XmlReader : public QObject {
21     Q_OBJECT
22 public:
23     XmlReader();
24     ~XmlReader();
25     CategoryList *myCategoryList;
26     void xmlReadProfile(QIODevice *device, ProfileDialog *profileDialog);
27     QStringList *usersList;
28
29 private:
30     QXmlStreamReader xmlreader;
31     QXmlStreamAttributes attr;
32     ProfileDialog *profile;
33     QString category;
34     QString unit;
35     QString date;
36     QString position;
37     QString user;
38     QString value;
39     QString description;
40     QStringList *usersInfo;
41
42 signals:
43     void receivedCategoryList();
44     void receivedTop10List();
45     void userInfo(QStringList *userInfo);
46
47 public slots:
48     void xmlReadTop10Results(QNetworkReply *device, QString userName);
49     void xmlReadCategories(QNetworkReply *device);
50     //void xmlReadCategories(QIODevice *device);
51     void xmlShow();
52
53     //void xmlReadUserInfo(QIODevice *device);
54     void xmlReadUserInfo(QNetworkReply *device);
55     void xmlReadUsers(QNetworkReply *device);
56     //void xmlReadUsers(QIODevice *device);
57 };
58
59 #endif // XMLREADER_H