2 * Report.h - TaskJuggler
4 * Copyright (c) 2001, 2002 by Chris Schlaeger <cs@suse.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
21 #include <qstringlist.h>
24 #include <qtextstream.h>
37 #include "CoreAttributes.h"
40 * @short The base class for all report generating classes.
41 * @author Chris Schlaeger <cs@suse.de>
46 Report(Project* p, const QString& f, time_t s, time_t e,
47 const QString& df, int dl);
50 void setWeekStartsMonday(bool wsm) { weekStartsMonday = wsm; }
52 void setShowActual(bool s) { showActual = s; }
53 bool getShowActual() const { return showActual; }
55 void setHidePlan(bool s) { hidePlan = s; }
56 void setShowPIDs(bool s) { showPIDs = s; }
58 void addReportColumn(const QString& c) { columns.append(c); }
59 const QString& columnsAt(uint idx) { return columns[idx]; }
60 void clearColumns() { columns.clear(); }
62 void setStart(time_t s) { start = s; }
63 time_t getStart() const { return start; }
65 void setEnd(time_t e) { end = e; }
66 time_t getEnd() const { return end; }
68 void setHeadline(const QString& hl) { headline = hl; }
69 void setCaption(const QString& c) { caption = c; }
71 bool isHidden(CoreAttributes* c, ExpressionTree* et);
72 bool isRolledUp(CoreAttributes* c, ExpressionTree* et);
74 void setHideTask(ExpressionTree* et);
76 void setRollUpTask(ExpressionTree* et);
77 bool isTaskRolledUp(Task* t);
79 void setHideResource(ExpressionTree* et);
81 void setHideAccount(ExpressionTree* et);
83 void setRollUpResource(ExpressionTree* et);
84 bool isResourceRolledUp(Resource* t);
86 void setRollUpAccount(ExpressionTree* et);
88 bool setTaskSorting(int sc, int level);
89 bool setResourceSorting(int sc, int level);
90 bool setAccountSorting(int sc, int level);
92 void setTaskRoot(const QString& root) { taskRoot = root; }
93 const QString& getTaskRoot() const { return taskRoot; }
95 enum LoadUnit { minutes, hours, days, weeks, months, years, shortAuto,
98 bool setLoadUnit(const QString& u);
100 void setTimeFormat(const QString& tf) { timeFormat = tf; }
101 void setShortTimeFormat(const QString& tf) { shortTimeFormat = tf; }
107 void filterTaskList(TaskList& filteredList, Resource* r);
108 void sortTaskList(TaskList& filteredList);
110 void filterResourceList(ResourceList& filteredList, Task* t = 0);
111 void sortResourceList(ResourceList& filteredList);
113 void filterAccountList(AccountList& filteredList, Account::AccountType at);
114 void sortAccountList(AccountList& filteredList);
116 QString scaledLoad(double t);
118 void warningMsg(const char* msg, ... );
121 * This utility function removes the path that matches the taskRoot
122 * variable from the passed taskId.
124 QString stripTaskRoot(QString taskId) const;
127 bool weekStartsMonday;
134 QString shortTimeFormat;
136 /* We store the location of the report definition in case we need it
137 * for error reporting. */
144 int taskSortCriteria[CoreAttributesList::maxSortingLevel];
145 int resourceSortCriteria[CoreAttributesList::maxSortingLevel];
146 int accountSortCriteria[CoreAttributesList::maxSortingLevel];
150 ExpressionTree* hideTask;
151 ExpressionTree* hideResource;
152 ExpressionTree* hideAccount;
153 ExpressionTree* rollUpTask;
154 ExpressionTree* rollUpResource;
155 ExpressionTree* rollUpAccount;
157 /* A report can be limited to the sub-tasks of a certain task. The
158 * taskRoot specifies this task. If set it always ends with a '.'. */
163 /* The maximum of the tree that we have to report in tree-sorting mode. */
164 uint maxDepthTaskList;
165 uint maxDepthResourceList;
166 uint maxDepthAccountList;