Modify changelog
[evehomescreen] / src / eveskilltraining.h
1 // Copyright (C) 2010 Jaakko Kyro <jkyro@korjaussarja.net>
2 // This file is licenced under GPL, see COPYING
3 // for full licence information
4 #ifndef EVESKILLTRAINING_H
5 #define EVESKILLTRAINING_H
6
7 #include <QObject>
8 #include <QDateTime>
9 #include <QString>
10 #include <QXmlStreamReader>
11 #include <QNetworkAccessManager>
12 #include <QtDebug>
13
14 class EveCharacter;
15 class EveModel;
16
17 class TrainingEntry {
18 public:
19     QDateTime startTime;
20     QDateTime endTime;
21     int typeId;
22     int startSkillpoints;
23     int destSkillpoints;
24     int level;
25 };
26
27 QDebug operator<<(QDebug, const TrainingEntry &);
28
29 class EveSkillTraining : public QObject
30 {
31     Q_OBJECT
32 public:
33     explicit EveSkillTraining(QObject *parent = 0);
34     bool fromXml(QXmlStreamReader &xml);
35     void setCharacter(EveCharacter *character) { m_character = character; }
36     void setAccount(EveModel *aModel) { m_account = aModel; }
37     bool isTraining() { return !m_trainingQueue.isEmpty(); }
38     const TrainingEntry &firstTraining() const { return m_trainingQueue.first(); }
39     const TrainingEntry &lastTraining() const { return m_trainingQueue.last(); }
40     bool isLoading() { return m_loading; }
41 signals:
42     void finished();
43
44 public slots:
45     void fetchInfo();
46     void infoReady();
47 public:
48     bool training;
49     QDateTime cachedUntil;
50     QDateTime currentTime;
51 private:
52     EveCharacter *m_character;
53     EveModel *m_account;
54     QNetworkAccessManager m_mgr;
55     QNetworkReply *m_reply;
56     QList<TrainingEntry> m_trainingQueue;
57     bool m_loading;
58 };
59
60
61
62 #endif // EVESKILLTRAINING_H