13
13
You should have received a copy of the GNU General Public License
14
14
along with this program; see the file COPYING. If not, write to
15
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
Boston, MA 02111-1307, USA.
15
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16
Boston, MA 02110-1301, USA.
69
68
// a TraceItemView can have a position in a parent container
70
69
enum Position { Hidden, Top, Right, Left, Bottom };
72
TraceItemView(TraceItemView* parentView, TopLevel* top = 0);
71
explicit TraceItemView(TraceItemView* parentView, TopLevel* top = 0);
73
72
virtual ~TraceItemView() {}
75
74
virtual QString whatsThis() const;
77
static KConfigGroup* configGroup(KConfig*, QString prefix, QString postfix);
78
static void writeConfigEntry(KConfigBase*, const char* pKey, QString value,
76
static KConfigGroup configGroup(KConfig*, const QString& prefix, const QString& postfix);
77
static void writeConfigEntry(KConfigGroup&, const char* pKey, const QString& value,
79
78
const char* def, bool bNLS = false);
80
static void writeConfigEntry(KConfigBase*, const char* pKey,
79
static void writeConfigEntry(KConfigGroup&, const char* pKey,
81
80
int value, int def);
82
static void writeConfigEntry(KConfigBase*, const char* pKey,
81
static void writeConfigEntry(KConfigGroup&, const char* pKey,
83
82
bool value, bool def);
84
static void writeConfigEntry(KConfigBase*, const char* pKey,
83
static void writeConfigEntry(KConfigGroup&, const char* pKey,
85
84
double value, double def);
86
virtual void readViewConfig(KConfig*, QString prefix, QString postfix,
85
virtual void readViewConfig(KConfig*, const QString& prefix, const QString& postfix,
88
virtual void saveViewConfig(KConfig*, QString prefix, QString postfix,
87
virtual void saveViewConfig(KConfig*, const QString& prefix, const QString& postfix,
91
90
// Immediate remove all references to old data, and set the new.
95
94
virtual void setData(TraceData* d);
97
96
// change from parent, call updateView() to update lazily (only if visible)
98
void setCostType(TraceCostType* t) { _newCostType = t; }
99
void setCostType2(TraceCostType* t) { _newCostType2 = t; }
97
void setEventType(TraceEventType* t) { _newEventType = t; }
98
void setEventType2(TraceEventType* t) { _newEventType2 = t; }
100
99
void set(TraceItem::CostType g) { _newGroupType = g; }
101
100
void set(const TracePartList& l) { _newPartList = l; }
102
101
// returns false if nothing can be shown for this trace item
104
103
void select(TraceItem* i);
105
104
void notifyChange(int changeType) { _status |= changeType; }
107
bool set(int, TraceData*, TraceCostType*, TraceCostType*,
106
bool set(int, TraceData*, TraceEventType*, TraceEventType*,
108
107
TraceItem::CostType, const TracePartList&,
109
108
TraceItem*, TraceItem*);
116
115
* Default implementation notifies parent
118
117
virtual void selected(TraceItemView* sender, TraceItem*);
119
virtual void selected(TraceItemView* sender, const TracePartList&);
120
virtual void activated(TraceItemView* sender, Direction);
121
virtual void selectedCostType(TraceItemView* sender, TraceCostType*);
122
virtual void selectedCostType2(TraceItemView* sender, TraceCostType*);
118
virtual void partsSelected(TraceItemView* sender, const TracePartList&);
119
virtual void directionActivated(TraceItemView* sender, Direction);
120
virtual void selectedEventType(TraceItemView* sender, TraceEventType*);
121
virtual void selectedEventType2(TraceItemView* sender, TraceEventType*);
123
122
virtual void activated(TraceItemView* sender, TraceItem*);
127
126
TraceData* data() const { return _newData; }
128
127
TraceItem* activeItem() const { return _newActiveItem; }
129
128
TraceItem* selectedItem() const { return _newSelectedItem; }
130
TraceCostType* costType() const { return _newCostType; }
131
TraceCostType* costType2() const { return _newCostType2; }
129
TraceEventType* eventType() const { return _newEventType; }
130
TraceEventType* eventType2() const { return _newEventType2; }
132
131
TraceItem::CostType groupType() const { return _newGroupType; }
133
132
const TracePartList& partList() const { return _newPartList; }
161
160
virtual TraceItem* canShow(TraceItem* i) { return i; }
163
162
/* convenience functions for often used context menu items */
164
void addCostMenu(QPopupMenu*,bool withCost2 = true);
165
void addGoMenu(QPopupMenu*);
163
void addEventTypeMenu(QMenu*,bool withCost2 = true);
164
void addGoMenu(QMenu*);
168
167
// helpers to call selected()/activated() of parentView
169
168
void selected(TraceItem*);
170
void selected(const TracePartList&);
169
void partsSelected(const TracePartList&);
171
170
void activated(TraceItem*);
172
void selectedCostType(TraceCostType*);
173
void selectedCostType2(TraceCostType*);
174
void activated(Direction);
171
void selectedEventType(TraceEventType*);
172
void selectedEventType2(TraceEventType*);
173
void directionActivated(TraceItemView::Direction);
176
175
/* Is this view visible?
177
* if not, doUpdate() won't be called by updateView()
176
* if not, doUpdate() will not be called by updateView()
179
178
virtual bool isViewVisible();
187
186
TraceData* _data;
188
187
TracePartList _partList;
189
188
TraceItem *_activeItem, *_selectedItem;
190
TraceCostType *_costType, *_costType2;
189
TraceEventType *_eventType, *_eventType2;
191
190
TraceItem::CostType _groupType;
194
193
TraceData* _newData;
195
194
TracePartList _newPartList;
196
195
TraceItem *_newActiveItem, *_newSelectedItem;
197
TraceCostType *_newCostType, *_newCostType2;
196
TraceEventType *_newEventType, *_newEventType2;
198
197
TraceItem::CostType _newGroupType;