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
;
41 QColor bgColor
, fgColor
;
42 QHash
< QString
, SubTask
> subTasks
;
43 QHash
< QString
, QList
< Hit
> > hits
; // hits for each subtask
46 void updateSubTasks();
47 double totHours
, totOverestimation
;
48 double workedHours(const QDateTime
& from
, const QDateTime
& to
) const;
50 bool checkConsistency();
51 // get hours from value
52 static double hours(int v
) { return (double)v
/60.0; }
55 static inline bool operator == (const Task::Hit
& h1
, const Task::Hit
& h2
) {
56 return h1
.timestamp
== h2
.timestamp
&& h1
.duration
== h2
.duration
;
67 HitElement(Task
* t
= 0, const QString
& subtask
= QString(), const QDateTime
& tt
= QDateTime(), int d
=0, bool edit
=true)
73 static double overestimations(const QList
<HitElement
>&, QVector
<double>&, double&);
74 bool operator<(const HitElement
& o
) const {
75 return timestamp
< o
.timestamp
;
78 Q_DECLARE_METATYPE(HitElement
)
81 inline QDebug
& operator << (QDebug
& out
, Task::Hit
& taskHit
)
83 out
<< taskHit
.timestamp
<< ":" << taskHit
.duration
;
87 QDataStream
& operator<< ( QDataStream
& out
, const Task
& task
);
88 QDataStream
& operator>> ( QDataStream
& in
, Task
& task
);
91 QDataStream
& operator<< ( QDataStream
& out
, const Task::Hit
& hit
);
92 QDataStream
& operator>> ( QDataStream
& in
, Task::Hit
& hit
);
95 QXmlStreamWriter
& operator<< ( QXmlStreamWriter
& out
, const Task
& task
);
96 QXmlStreamReader
& operator>> ( QXmlStreamReader
& in
, Task
& task
);