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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
/*
* The TaskJuggler Project Management Software
*
* Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007
* by Chris Schlaeger <cs@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* $Id$
*/
#ifndef _TjReport_h_
#define _TjReport_h_
#include <set>
#include <map>
#include <vector>
#include <qlistview.h>
#include "TjUIReportBase.h"
#include "TaskList.h"
#include "ResourceList.h"
#include "Journal.h"
#include "ReportLayers.h"
#include "TjGanttChart.h"
#include "ltQString.h"
#include "ltstr.h"
class QSplitter;
class QCanvas;
class QCanvasView;
class QTimer;
class KListViewItem;
class KListView;
class KPrinter;
class Report;
class Task;
class Resource;
class QtReportElement;
class Interval;
class JournalIterator;
class TjPrintReport;
class TjObjPosTable;
class TableColumnInfo;
class ReportController;
class TjReport : public TjUIReportBase
{
Q_OBJECT
public:
TjReport(QWidget* p, ReportManager* m, Report* rDef,
const QString& n = QString::null);
virtual ~TjReport();
virtual bool generateReport();
virtual QtReportElement* getReportElement() const = 0;
virtual void setFocus();
void generateTaskListLine(const QtReportElement* reportElement,
const Task* t, KListViewItem* lvi,
const Resource* r = 0);
void generateResourceListLine(const QtReportElement* reportElement,
Resource* r, KListViewItem* lvi,
const Task* t = 0);
void print();
virtual TjPrintReport* newPrintReport(KPrinter* pr) = 0;
public slots:
void zoomIn();
void zoomOut();
void zoomTo(const QString& lable);
virtual void show();
virtual void hide();
private slots:
void regenerateChart();
void collapsReportItem(QListViewItem* lvi);
void expandReportItem(QListViewItem* lvi);
void listClicked(QListViewItem* lvi, const QPoint&, int column);
void listHeaderClicked(int colmun);
void doPopupMenu(QListViewItem* lvi, const QPoint& pos, int);
void syncVSlidersGantt2List(int, int);
void syncVSlidersList2Gantt(int, int);
void updateStatusBar();
void reportSearchTriggered(const QString&);
void setReportStart(const QDate& d);
void setReportEnd(const QDate& d);
protected:
virtual bool event(QEvent* ev);
virtual bool generateList() = 0;
void prepareChart();
void triggerChartRegeneration(int msDelay);
void generateListHeader(const QString& firstHeader, QtReportElement* tab);
void showTaskDetails(const Task* task);
void showResourceDetails(Resource* resource);
void generateCustomAttribute(const CoreAttributes* ca, const QString name,
QString& cellText, QPixmap& icon) const;
void handleMouseEvent(const QMouseEvent* ev);
QListViewItem* getChartItemBelowCursor(QPoint& pos);
virtual QString generateStatusBarText(const QPoint& pos,
CoreAttributes* ca,
CoreAttributes* parent) = 0;
QString indent(const QString& input, const QListViewItem* lvi,
bool right);
int treeLevel(const QListViewItem* lvi) const;
QString generateJournal(Journal::Iterator jit) const;
QString generateRTCustomAttributes(const CoreAttributes* ca) const;
void setGanttChartColors();
time_t stepLength() const;
void setBestStepUnit();
void updateZoomSelector();
QSplitter* splitter;
KListView* listView;
QWidget* canvasFrame;
QWidget* reportFrame;
ReportController* reportController;
TjObjPosTable* objPosTable;
TjGanttChart* ganttChart;
QCanvasView* ganttHeaderView;
QCanvasView* ganttChartView;
/**
* We some widgets that need to be fit into the window the first time the
* widget is rendered on the screen. We use the following variable to keep
* track of this.
*/
TjGanttChart::ScaleMode scaleMode;
/**
* We often need to find out if a CoreAttribute is in the ListView and
* find the appropriate list item. So we keep a dictionary that maps the
* CoreAttribute ID to the QListViewItem*. As the namespaces of the
* different CoreAttributes may contain duplicates we use a single
* character plus colon prefix to create a unified namespace. So
* t:mytask.subtask is a task and r:team.nick is a resource.
*/
std::map<const QString, KListViewItem*, ltQString> ca2lviDict;
/* And the same in the other direction. We use the hex-ed address of the
* LVI as key. */
std::map<const QString, CoreAttributes*, ltQString> lvi2caDict;
/* For nested lists we need to be able to map the lvi to the parent
* CoreAttributes. */
std::map<const QString, CoreAttributes*, ltQString> lvi2ParentCaDict;
/* The interactive reports don't have a 1:1 mapping between the defintion
* and the column in the widget. Some special columns are not included in
* the widget. To link a widget column back to the TCI we need this list.
*/
std::vector<TableColumnInfo*> lvCol2tci;
/**
* This is the maximum indentation of the list view. It only takes visible
* items into account. Visible means not hidden by closed parents.
*/
int maxDepth;
int scenario;
bool showGantt;
int headerHeight;
int listHeight;
int itemHeight;
int canvasWidth;
QTimer* statusBarUpdateTimer;
QTimer* delayTimer;
TaskList taskList;
ResourceList resourceList;
/* The interactive reports treat the indexes, name and gantt columns
* differently than most other reports. They provide special rendering for
* them and need to be ignored during generic column rendering. */
std::set<const char*, ltstr> indexColumns;
std::set<const char*, ltstr> specialColumns;
} ;
#endif
|