5 #include <QXmlStreamWriter>
6 #include <QXmlStreamReader>
9 #define DATETIMEFORMAT "yyyy/MM/dd hh:mm:ss"
16 SubTask(const QString
& t
=QString()) : title(t
), active(true) {}
17 QString title
, description
;
18 QColor bgColor
, fgColor
;
25 Hit(const QDateTime
& t
=QDateTime::currentDateTime(), unsigned int d
=0)
30 bool operator<(const Hit
& o
) const {
31 return timestamp
< o
.timestamp
;
35 Task() : estimatedHours(0), bgColor(Qt::white
), fgColor(Qt::black
), active(true), totHours(0) {}
36 QString title
, description
;
42 QColor bgColor
, fgColor
;
43 QHash
< QString
, SubTask
> subTasks
;
44 QHash
< QString
, QList
< Hit
> > hits
; // hits for each subtask
47 void updateSubTasks();
48 double totHours
, totOverestimation
;
49 double workedHours(const QDateTime
& from
, const QDateTime
& to
) const;
51 bool checkConsistency();
52 // get hours from value
53 static double hours(int v
) { return (double)v
/60.0; }
56 static inline bool operator == (const Task::Hit
& h1
, const Task::Hit
& h2
) {
57 return h1
.timestamp
== h2
.timestamp
&& h1
.duration
== h2
.duration
;
68 HitElement(Task
* t
= 0, const QString
& subtask
= QString(), const QDateTime
& tt
= QDateTime(), int d
=0, bool edit
=true)
74 static double overestimations(const QList
<HitElement
>&, QVector
<double>&, double&);
75 bool operator<(const HitElement
& o
) const {
76 return timestamp
< o
.timestamp
;
79 Q_DECLARE_METATYPE(HitElement
)
82 inline QDebug
& operator << (QDebug
& out
, Task::Hit
& taskHit
)
84 out
<< taskHit
.timestamp
<< ":" << taskHit
.duration
;
88 QDataStream
& operator<< ( QDataStream
& out
, const Task
& task
);
89 QDataStream
& operator>> ( QDataStream
& in
, Task
& task
);
92 QDataStream
& operator<< ( QDataStream
& out
, const Task::Hit
& hit
);
93 QDataStream
& operator>> ( QDataStream
& in
, Task::Hit
& hit
);
96 QXmlStreamWriter
& operator<< ( QXmlStreamWriter
& out
, const Task
& task
);
97 QXmlStreamReader
& operator>> ( QXmlStreamReader
& in
, Task
& task
);