VirtualBox

source: vbox/trunk/src/VBox/Debugger/VBoxDbgStatsQt4.h@ 31510

Last change on this file since 31510 was 31510, checked in by vboxsync, 15 years ago

The debugger is back in the OSE.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.9 KB
Line 
1/* $Id: VBoxDbgStatsQt4.h 31510 2010-08-10 08:48:11Z vboxsync $ */
2/** @file
3 * VBox Debugger GUI - Statistics.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Oracle Corporation
8 *
9 * Oracle Corporation confidential
10 * All rights reserved
11 */
12
13#ifndef ___Debugger_VBoxDbgStats_h
14#define ___Debugger_VBoxDbgStats_h
15
16#include "VBoxDbgBase.h"
17
18#include <QTreeView>
19#include <QTimer>
20#include <QComboBox>
21#include <QMenu>
22
23class VBoxDbgStats;
24class VBoxDbgStatsModel;
25
26/** Pointer to a statistics sample. */
27typedef struct DBGGUISTATSNODE *PDBGGUISTATSNODE;
28/** Pointer to a const statistics sample. */
29typedef struct DBGGUISTATSNODE const *PCDBGGUISTATSNODE;
30
31
32/**
33 * The VM statistics tree view.
34 *
35 * A tree represenation of the STAM statistics.
36 */
37class VBoxDbgStatsView : public QTreeView, public VBoxDbgBase
38{
39 Q_OBJECT;
40
41public:
42 /**
43 * Creates a VM statistics list view widget.
44 *
45 * @param a_pDbgGui Pointer to the debugger gui object.
46 * @param a_pModel The model. Will take ownership of this and delete it together
47 * with the view later
48 * @param a_pParent Parent widget.
49 */
50 VBoxDbgStatsView(VBoxDbgGui *a_pDbgGui, VBoxDbgStatsModel *a_pModel, VBoxDbgStats *a_pParent = NULL);
51
52 /** Destructor. */
53 virtual ~VBoxDbgStatsView();
54
55 /**
56 * Updates the view with current information from STAM.
57 * This will indirectly update the m_PatStr.
58 *
59 * @param rPatStr Selection pattern. NULL means everything, see STAM for further details.
60 */
61 void updateStats(const QString &rPatStr);
62
63 /**
64 * Resets the stats items matching the specified pattern.
65 * This pattern doesn't have to be the one used for update, thus m_PatStr isn't updated.
66 *
67 * @param rPatStr Selection pattern. NULL means everything, see STAM for further details.
68 */
69 void resetStats(const QString &rPatStr);
70
71protected:
72 /**
73 * Expands or collapses a sub-tree.
74 *
75 * @param a_rIndex The root of the sub-tree.
76 * @param a_fExpanded Expand/collapse.
77 */
78 void setSubTreeExpanded(QModelIndex const &a_rIndex, bool a_fExpanded);
79
80 /**
81 * Popup context menu.
82 *
83 * @param a_pEvt The event.
84 */
85 virtual void contextMenuEvent(QContextMenuEvent *a_pEvt);
86
87protected slots:
88 /**
89 * Slot for handling the view/header context menu.
90 * @param a_rPos The mouse location.
91 */
92 void headerContextMenuRequested(const QPoint &a_rPos);
93
94 /** @name Action signal slots.
95 * @{ */
96 void actExpand();
97 void actCollapse();
98 void actRefresh();
99 void actReset();
100 void actCopy();
101 void actToLog();
102 void actToRelLog();
103 /** @} */
104
105
106protected:
107 /** Pointer to the data model. */
108 VBoxDbgStatsModel *m_pModel;
109 /** The current selection pattern. */
110 QString m_PatStr;
111 /** The parent widget. */
112 VBoxDbgStats *m_pParent;
113
114 /** Leaf item menu. */
115 QMenu *m_pLeafMenu;
116 /** Branch item menu. */
117 QMenu *m_pBranchMenu;
118 /** View menu. */
119 QMenu *m_pViewMenu;
120
121 /** The menu that's currently being executed. */
122 QMenu *m_pCurMenu;
123 /** The current index relating to the context menu.
124 * Considered invalid if m_pCurMenu is NULL. */
125 QModelIndex m_CurIndex;
126
127 /** Expand Tree action. */
128 QAction *m_pExpandAct;
129 /** Collapse Tree action. */
130 QAction *m_pCollapseAct;
131 /** Refresh Tree action. */
132 QAction *m_pRefreshAct;
133 /** Reset Tree action. */
134 QAction *m_pResetAct;
135 /** Copy (to clipboard) action. */
136 QAction *m_pCopyAct;
137 /** To Log action. */
138 QAction *m_pToLogAct;
139 /** To Release Log action. */
140 QAction *m_pToRelLogAct;
141#if 0
142 /** Save Tree (to file) action. */
143 QAction *m_SaveFileAct;
144 /** Load Tree (from file) action. */
145 QAction *m_LoadFileAct;
146 /** Take Snapshot action. */
147 QAction *m_TakeSnapshotAct;
148 /** Load Snapshot action. */
149 QAction *m_LoadSnapshotAct;
150 /** Diff With Snapshot action. */
151 QAction *m_DiffSnapshotAct;
152#endif
153};
154
155
156
157/**
158 * The VM statistics window.
159 *
160 * This class displays the statistics of a VM. The UI contains
161 * a entry field for the selection pattern, a refresh interval
162 * spinbutton, and the tree view with the statistics.
163 */
164class VBoxDbgStats : public VBoxDbgBaseWindow
165{
166 Q_OBJECT;
167
168public:
169 /**
170 * Creates a VM statistics list view widget.
171 *
172 * @param a_pDbgGui Pointer to the debugger gui object.
173 * @param pszPat Initial selection pattern. NULL means everything. (See STAM for details.)
174 * @param uRefreshRate The refresh rate. 0 means not to refresh and is the default.
175 * @param pParent Parent widget.
176 */
177 VBoxDbgStats(VBoxDbgGui *a_pDbgGui, const char *pszPat = NULL, unsigned uRefreshRate= 0, QWidget *pParent = NULL);
178
179 /** Destructor. */
180 virtual ~VBoxDbgStats();
181
182protected:
183 /**
184 * Destroy the widget on close.
185 *
186 * @param a_pCloseEvt The close event.
187 */
188 virtual void closeEvent(QCloseEvent *a_pCloseEvt);
189
190protected slots:
191 /** Apply the activated combobox pattern. */
192 void apply(const QString &Str);
193 /** The "All" button was pressed. */
194 void applyAll();
195 /** Refresh the data on timer tick and pattern changed. */
196 void refresh();
197 /**
198 * Set the refresh rate.
199 *
200 * @param iRefresh The refresh interval in seconds.
201 */
202 void setRefresh(int iRefresh);
203
204 /**
205 * Change the focus to the pattern combo box.
206 */
207 void actFocusToPat();
208
209protected:
210
211 /** The current selection pattern. */
212 QString m_PatStr;
213 /** The pattern combo box. */
214 QComboBox *m_pPatCB;
215 /** The refresh rate in seconds.
216 * 0 means not to refresh. */
217 unsigned m_uRefreshRate;
218 /** The refresh timer .*/
219 QTimer *m_pTimer;
220 /** The tree view widget. */
221 VBoxDbgStatsView *m_pView;
222
223 /** Move to pattern field action. */
224 QAction *m_pFocusToPat;
225};
226
227
228#endif
229
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette