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
;
40 QColor bgColor
, fgColor
;
41 QHash
< QString
, SubTask
> subTasks
;
42 QHash
< QString
, QList
< Hit
> > hits
; // hits for each subtask
45 void updateSubTasks();
46 double totHours
, totOverestimation
;
47 double workedHours(const QDateTime
& from
, const QDateTime
& to
) const;
49 bool checkConsistency();
50 // get hours from value
51 static double hours(int v
) { return (double)v
/60.0; }
54 static inline bool operator == (const Task::Hit
& h1
, const Task::Hit
& h2
) {
55 return h1
.timestamp
== h2
.timestamp
&& h1
.duration
== h2
.duration
;
66 HitElement(Task
* t
= 0, const QString
& subtask
= QString(), const QDateTime
& tt
= QDateTime(), int d
=0, bool edit
=true)
72 static double overestimations(const QList
<HitElement
>&, QVector
<double>&, double&);
73 bool operator<(const HitElement
& o
) const {
74 return timestamp
< o
.timestamp
;
77 Q_DECLARE_METATYPE(HitElement
)
80 QDataStream
& operator<< ( QDataStream
& out
, const Task
& task
);
81 QDataStream
& operator>> ( QDataStream
& in
, Task
& task
);
84 QDataStream
& operator<< ( QDataStream
& out
, const Task::Hit
& hit
);
85 QDataStream
& operator>> ( QDataStream
& in
, Task::Hit
& hit
);
88 QXmlStreamWriter
& operator<< ( QXmlStreamWriter
& out
, const Task
& task
);
89 QXmlStreamReader
& operator>> ( QXmlStreamReader
& in
, Task
& task
);