-
Notifications
You must be signed in to change notification settings - Fork 3
/
Report.h
94 lines (62 loc) · 2.35 KB
/
Report.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef REPORT_H
#define REPORT_H
#include <QDateTime>
#include <QWidget>
#include <QMultiHash>
#include <QHash>
#include <QMap>
#include <QStringList>
#include <stdint.h>
class QTextEdit;
/***********************************************************************************/
/*********************** ProjectReport *********************************************/
/***********************************************************************************/
struct ProjectReport {
int64_t prj_id,
parent_id;
int decihours() const;
int busySecs;
int run(int64_t project_id, const QDateTime &begin, const QDateTime &end);
};
/***********************************************************************************/
/************************ ClientReport *********************************************/
/***********************************************************************************/
struct ClientReport {
ClientReport(int64_t client_id, const QDateTime &begin, const QDateTime &end)
{ run(client_id, begin, end);}
// int cumulativeProjectSecs(int64_t prj_id) const;
int cumulativeProjectDecihours(int64_t prj_id) const;
// int projectSecs(int64_t prj_id) const;
int projectDecihours(int64_t prj_id) const;
void activeProjectIds(QMap<QString,ProjectReport*> &prjMap) const;
// int cumulativeSecs() const;
int cumulativeDecihours() const;
int64_t client_id;
QDateTime begin_dt,
end_dt;
QMultiHash<int64_t, int64_t> child_hash;
QHash <int64_t, ProjectReport*> rpt_hash;
int run(int64_t client_id, const QDateTime &begin, const QDateTime &end);
};
/***********************************************************************************/
/***************************** ReportWidget ****************************************/
/***********************************************************************************/
class ReportWidget : public QWidget {
Q_OBJECT
public:
ReportWidget(ClientReport &rpt, QWidget *parent=0);
~ReportWidget();
/* Eliminate default copy constructor and assignment operator */
ReportWidget(const ReportWidget&)= delete;
ReportWidget& operator=(const ReportWidget&)= delete;
int showReport(ClientReport &rpt);
private slots:
void storeSettings();
void saveToDisk();
protected:
void closeEvent(QCloseEvent *event);
private:
QTextEdit *_te;
QStringList _html;
};
#endif