~smartboyhw/ubuntu/raring/calligra/2.6.0-0ubuntu1

« back to all changes in this revision

Viewing changes to plan/libs/ui/reports/reportdata.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-10-23 21:09:16 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20121023210916-m82w6zxnxhaxz7va
Tags: 1:2.5.90-0ubuntu1
* New upstream alpha release (LP: #1070436)
  - Add libkactivities-dev and libopenimageio-dev to build-depends
  - Add kubuntu_build_calligraactive.diff to build calligraactive by default
  - Add package for calligraauthor and move files that are shared between
    calligrawords and calligraauthor to calligrawords-common
* Document the patches
* Remove numbers from patches so they follow the same naming scheme as
  the rest of our patches.
* calligra-data breaks replaces krita-data (<< 1:2.5.3) (LP: #1071686)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <KoReportData.h>
27
27
 
28
28
#include "kptitemmodelbase.h"
 
29
#include "kptnodechartmodel.h"
29
30
#include "kptproject.h"
30
31
 
31
32
#include <QSortFilterProxyModel>
37
38
{
38
39
 
39
40
class ScheduleManager;
 
41
class ReportData;
 
42
class ChartItemModel;
 
43
 
 
44
namespace Report
 
45
{
 
46
    KPLATOUI_EXPORT QList<ReportData*> createBaseReportDataModels( QObject *parent = 0 );
 
47
    KPLATOUI_EXPORT ReportData *findReportData( const QList<ReportData*> &lst, const QString &type );
 
48
}
40
49
 
41
50
class KPLATOUI_EXPORT ReportData : public QObject, public KoReportData
42
51
{
43
52
    Q_OBJECT
44
53
public:
45
 
    explicit ReportData();
 
54
    explicit ReportData( QObject *parent = 0 );
 
55
    ReportData( const ReportData &other );
46
56
    virtual ~ReportData();
47
57
 
 
58
    /// Re-implement this to create a clone of your report data object
 
59
    /// Returns 0 by default
 
60
    virtual ReportData *clone() const { return 0; }
 
61
 
48
62
    /// Set the @p role that shall be used when fetching data for @p column
49
63
    /// Default is Qt::DisplayRole
50
64
    void setColumnRole( int column, int role );
108
122
    void setModel( QAbstractItemModel *model );
109
123
    QAbstractItemModel *model() const;
110
124
    ItemModelBase *itemModel() const;
111
 
    
 
125
 
112
126
    Project *project() const { return m_project; }
113
127
    ScheduleManager *scheduleManager() const { return m_schedulemanager; }
114
 
    
 
128
 
 
129
    virtual bool loadXml( const KoXmlElement &/*element*/ ) { return true; }
 
130
    virtual void saveXml( QDomElement &/*element*/ ) const {}
 
131
 
 
132
    bool isMainDataSource() const { return m_maindatasource; }
 
133
    bool isSubDataSource() const { return m_subdatasource; }
 
134
    void setSubDataSources( QList<ReportData*> &lst ) { m_subdatasources = lst; }
 
135
 
115
136
public slots:
116
 
    void setProject( Project *project );
 
137
    virtual void setProject( Project *project );
117
138
    void setScheduleManager( ScheduleManager *sm );
118
 
    void setDataSource( ReportData *source );
119
139
 
120
140
signals:
121
141
    void scheduleManagerChanged( ScheduleManager *sm );
122
142
    void createReportData( const QString &type, ReportData *rd );
123
143
 
124
144
protected:
 
145
    /// Re-implement this to create data models
 
146
    virtual void createModels() {}
 
147
 
 
148
protected:
125
149
    QSortFilterProxyModel m_model;
126
150
    long m_row;
127
151
    Project *m_project;
128
152
    ScheduleManager *m_schedulemanager;
129
 
    
130
 
    ReportData *m_datasource;
 
153
 
131
154
    QMap<QString, QVariant> m_expressions;
132
155
 
133
156
    QMap<int, int> m_columnroles;
 
157
    QString m_name;
 
158
    QList<SortedField> m_sortlist;
 
159
    QList<QAbstractItemModel*> m_sortmodels;
 
160
    bool m_maindatasource;
 
161
    bool m_subdatasource;
 
162
    QList<ReportData*> m_subdatasources;
 
163
};
 
164
 
 
165
class KPLATOUI_EXPORT TaskReportData : public ReportData
 
166
{
 
167
    Q_OBJECT
 
168
public:
 
169
    explicit TaskReportData( QObject *parent = 0 );
 
170
    TaskReportData( const TaskReportData &other );
 
171
 
 
172
    bool loadXml( const KoXmlElement &element );
 
173
    void saveXml( QDomElement &element ) const;
 
174
 
 
175
    ReportData *clone() const;
 
176
 
 
177
protected:
 
178
    void createModels();
 
179
};
 
180
 
 
181
class KPLATOUI_EXPORT TaskStatusReportData : public ReportData
 
182
{
 
183
    Q_OBJECT
 
184
public:
 
185
    explicit TaskStatusReportData( QObject *parent = 0 );
 
186
    TaskStatusReportData( const TaskStatusReportData &other );
 
187
 
 
188
    bool loadXml( const KoXmlElement &element );
 
189
    void saveXml( QDomElement &element ) const;
 
190
 
 
191
    ReportData *clone() const;
 
192
 
 
193
protected:
 
194
    void createModels();
 
195
};
 
196
 
 
197
class KPLATOUI_EXPORT ResourceReportData : public ReportData
 
198
{
 
199
    Q_OBJECT
 
200
public:
 
201
    explicit ResourceReportData( QObject *parent = 0 );
 
202
    ResourceReportData( const ResourceReportData &other );
 
203
 
 
204
    bool loadXml( const KoXmlElement &element );
 
205
    void saveXml( QDomElement &element ) const;
 
206
 
 
207
    ReportData *clone() const;
 
208
 
 
209
protected:
 
210
    void createModels();
 
211
};
 
212
 
 
213
class KPLATOUI_EXPORT ResourceAssignmentReportData : public ReportData
 
214
{
 
215
    Q_OBJECT
 
216
public:
 
217
    explicit ResourceAssignmentReportData( QObject *parent = 0 );
 
218
    ResourceAssignmentReportData( const ResourceAssignmentReportData &other );
 
219
 
 
220
    bool loadXml( const KoXmlElement &element );
 
221
    void saveXml( QDomElement &element ) const;
 
222
 
 
223
    ReportData *clone() const;
 
224
 
 
225
protected:
 
226
    void createModels();
134
227
};
135
228
 
136
229
class KPLATOUI_EXPORT ChartReportData : public ReportData
137
230
{
 
231
    Q_OBJECT
138
232
public:
139
 
    explicit ChartReportData();
 
233
    explicit ChartReportData( QObject *parent = 0 );
 
234
    ChartReportData( const ChartReportData &other );
140
235
 
141
236
    /// Prepare the data for access
142
237
    virtual bool open();
160
255
    virtual QVariant value(unsigned int) const;
161
256
    //!Return the value of the field named @p name
162
257
    QVariant value( const QString &name ) const;
163
 
    
 
258
 
164
259
    //!Return the list of field names, used for legends in a chart
165
260
    virtual QStringList fieldNames() const;
166
261
 
168
263
 
169
264
    bool cbs;
170
265
 
 
266
    bool loadXml( const KoXmlElement &element );
 
267
    void saveXml( QDomElement &element ) const;
 
268
 
171
269
protected:
172
270
    int firstRow();
173
271
    int lastRow() const;
176
274
    int m_lastrow;
177
275
    QDate m_startdate;
178
276
    QStringList m_keywords;
179
 
};
 
277
    bool m_fakedata;
 
278
};
 
279
 
 
280
class KPLATOUI_EXPORT CostPerformanceReportData : public ChartReportData
 
281
{
 
282
    Q_OBJECT
 
283
public:
 
284
    explicit CostPerformanceReportData( QObject *parent = 0 );
 
285
    CostPerformanceReportData( const CostPerformanceReportData &other );
 
286
 
 
287
    ReportData *clone() const;
 
288
 
 
289
    virtual bool open();
 
290
 
 
291
protected:
 
292
    void createModels();
 
293
 
 
294
private:
 
295
    ChartItemModel *m_chartmodel;
 
296
};
 
297
 
 
298
class KPLATOUI_EXPORT EffortPerformanceReportData : public ChartReportData
 
299
{
 
300
    Q_OBJECT
 
301
public:
 
302
    explicit EffortPerformanceReportData( QObject *parent = 0 );
 
303
    EffortPerformanceReportData( const EffortPerformanceReportData &other );
 
304
 
 
305
    ReportData *clone() const;
 
306
 
 
307
    virtual bool open();
 
308
 
 
309
protected:
 
310
    void createModels();
 
311
 
 
312
private:
 
313
    ChartItemModel *m_chartmodel;
 
314
};
 
315
 
 
316
class KPLATOUI_EXPORT CostBreakdownReportData : public ChartReportData
 
317
{
 
318
    Q_OBJECT
 
319
public:
 
320
    explicit CostBreakdownReportData( QObject *parent = 0 );
 
321
    CostBreakdownReportData( const CostBreakdownReportData &other );
 
322
 
 
323
    ReportData *clone() const;
 
324
 
 
325
    bool open();
 
326
 
 
327
protected:
 
328
    void createModels();
 
329
};
 
330
 
180
331
 
181
332
} //namespace KPlato
182
333