1
/* ---------------------------------------------------------------------
2
* Definition of VgLogView vglogview.h
3
* Links VgLog elements with qlistview elements
4
* ---------------------------------------------------------------------
5
* This file is part of Valkyrie, a front-end for Valgrind
6
* Copyright (C) 2000-2008, OpenWorks LLP <info@open-works.co.uk>
7
* This program is released under the terms of the GNU GPL v.2
8
* See the file COPYING for the full license details.
11
#ifndef __VK_VGLOGVIEW_H
12
#define __VK_VGLOGVIEW_H
16
#include <qlistview.h>
18
#include <qdatetime.h>
21
/**********************************************************************/
22
/* VgOutputItem: base class
23
item classes set up their own state and text in their construtors,
24
and item->setOpen() sets up item's children.
25
- only spends time populating an item when seen
26
- no item opened before setup (inc. children's) finished.
27
only a couple of sub-classes currently implement different
28
looks/functionality, but more future proof to have them separated.
30
class VgOutputItem : public QListViewItem
33
VgOutputItem( QListView* parent, VgElement );
34
VgOutputItem( QListViewItem* parent, VgElement );
35
VgOutputItem( QListViewItem* parent, QListViewItem* after, VgElement );
38
void setText( QString str );
40
/* some make-life-simpler stuff */
41
VgOutputItem* firstChild();
42
VgOutputItem* nextSibling();
43
VgOutputItem* parent();
44
void paintCell( QPainter* p, const QColorGroup& cg,
45
int col, int width, int align );
46
void setOpen( bool open );
48
VgElement::ElemType elemType() { return elem.elemType(); }
51
bool isReadable, isWriteable;
52
VgElement elem; /* associated element */
55
/**********************************************************************/
56
class TopStatusItem : public VgOutputItem
59
TopStatusItem( QListView* parent, VgStatus status,
60
VgElement args, QString protocol );
61
void updateStatus( VgStatus s );
62
void updateErrorCounts( VgErrCounts ec );
63
void updateLeakCounts( VgError leak );
66
int num_errs, num_bytes, num_blocks;
67
QString status_tmplt, status_str, errcounts_tmplt;
72
/**********************************************************************/
73
class InfoItem : public VgOutputItem
76
InfoItem( VgOutputItem* parent, VgElement root );
77
void setOpen( bool open );
80
/**********************************************************************/
81
class LogQualItem : public VgOutputItem
84
LogQualItem( VgOutputItem* parent, VgElement logqual );
85
void setOpen( bool open );
88
/**********************************************************************/
89
class CommentItem : public VgOutputItem
92
CommentItem( VgOutputItem* parent, QListViewItem* after,
94
void setOpen( bool open );
97
/**********************************************************************/
98
class ArgsItem : public VgOutputItem
101
ArgsItem( VgOutputItem* parent, QListViewItem* after,
103
void setOpen( bool open );
106
/**********************************************************************/
107
class PreambleItem : public VgOutputItem
110
PreambleItem( VgOutputItem* parent, QListViewItem* after,
111
VgPreamble preamble );
112
void setOpen( bool open );
115
/**********************************************************************/
116
class ErrorItem : public VgOutputItem
119
ErrorItem( VgOutputItem* parent, QListViewItem* after,
121
void setOpen( bool open );
122
void updateCount( QString count );
123
bool isLeak() { return ((VgError*)&elem)->isLeak(); }
125
/* mapping of error::kind to 3-letter acronyms */
126
typedef QMap<QString, QString> AcronymMap;
127
static AcronymMap acronymMap;
130
QString errorAcronym( QString kind );
134
/**********************************************************************/
135
class StackItem : public VgOutputItem
138
StackItem( VgOutputItem* parent, QListViewItem* after,
140
void setOpen( bool open );
143
/**********************************************************************/
144
class FrameItem : public VgOutputItem
147
FrameItem( VgOutputItem* parent, QListViewItem* after,
149
void setOpen( bool open );
152
/**********************************************************************/
153
/* class SrcItem (error::stack::frame::dir/file/line)
154
- pale gray background colour.
155
- 'read'/'write' pixmap to denote user perms for src file.
156
- click item => source file opened in an editor, at lineno. */
157
class SrcItem : public VgOutputItem
160
SrcItem( VgOutputItem* parent, VgElement line, QString path );
163
void setPixmap( const char* pix_xpm[] );
164
const QPixmap* pixmap( int i ) const;
165
void paintCell( QPainter* p, const QColorGroup& cg,
166
int col, int width, int align );
172
/**********************************************************************/
173
class SuppCountsItem : public VgOutputItem
176
SuppCountsItem( VgOutputItem* parent, QListViewItem* after,
178
void setOpen( bool open );
184
/**********************************************************************/
185
/* VgLogView: inherits VgLog
186
- takes qlistview in constructor, and populates it at the same
187
time the underlying vglog is populated
188
- associates each listview item with a VgLog element,
189
which is used to set the text of the item, and is intended for
190
future use of accessing/editing the underlying log
191
(e.g. generating a suppression by clicking on an error item)
193
class VgLogView : public VgLog
196
VgLogView( QListView* lv );
199
bool appendNode( QDomNode node );
202
void updateErrorItems( VgErrCounts ec );
205
QListView* lview; /* we don't own this: don't delete it */
206
VgOutputItem* lastChild;
207
TopStatusItem* topStatus;
211
#endif // #ifndef __VK_VGLOGVIEW_H