~ubuntu-branches/ubuntu/intrepid/kdesdk/intrepid-updates

« back to all changes in this revision

Viewing changes to kcachegrind/kcachegrind/traceitemview.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-28 10:11:43 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: james.westby@ubuntu.com-20080528101143-gzc3styjz1b70zxu
Tags: upstream-4.0.80
ImportĀ upstreamĀ versionĀ 4.0.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 
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.
17
17
*/
18
18
 
19
19
/*
26
26
#include "tracedata.h"
27
27
 
28
28
class QWidget;
29
 
class QPopupMenu;
 
29
class QMenu;
30
30
 
31
31
class KConfig;
32
32
class KConfigGroup;
33
 
class KConfigBase;
34
33
 
35
34
class TopLevel;
36
35
 
55
54
   * - <dataChanged> is used if e.g. cycles are recalculated
56
55
   */
57
56
  enum { nothingChanged      = 0,
58
 
         costTypeChanged     = 1,
59
 
         costType2Changed    = 2,
 
57
         eventTypeChanged     = 1,
 
58
         eventType2Changed    = 2,
60
59
         groupTypeChanged    = 4,
61
60
         partsChanged        = 8,
62
61
         activeItemChanged   = 16,
69
68
  // a TraceItemView can have a position in a parent container
70
69
  enum Position { Hidden, Top, Right, Left, Bottom };
71
70
 
72
 
  TraceItemView(TraceItemView* parentView, TopLevel* top = 0);
 
71
  explicit TraceItemView(TraceItemView* parentView, TopLevel* top = 0);
73
72
  virtual ~TraceItemView() {}
74
73
 
75
74
  virtual QString whatsThis() const;
76
75
 
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,
87
86
                              bool withOptions);
88
 
  virtual void saveViewConfig(KConfig*, QString prefix, QString postfix,
 
87
  virtual void saveViewConfig(KConfig*, const QString& prefix, const QString& postfix,
89
88
                              bool withOptions);
90
89
 
91
90
  // Immediate remove all references to old data, and set the new.
95
94
  virtual void setData(TraceData* d);
96
95
 
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; }
106
105
  // all in one
107
 
  bool set(int, TraceData*, TraceCostType*, TraceCostType*,
 
106
  bool set(int, TraceData*, TraceEventType*, TraceEventType*,
108
107
           TraceItem::CostType, const TracePartList&,
109
108
           TraceItem*, TraceItem*);
110
109
 
116
115
   * Default implementation notifies parent
117
116
   */
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*);
124
123
 
125
124
  // getters...
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; }
134
133
 
161
160
  virtual TraceItem* canShow(TraceItem* i) { return i; }
162
161
 
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*);
166
165
 
167
166
protected:
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);
175
174
 
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()
178
177
   */
179
178
  virtual bool isViewVisible();
180
179
 
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;
192
191
 
193
192
private:
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;
199
198
 
200
199
  QString _title;