tools/*: remove bcc and as86 as they are no longer required to compile the system...
[virtualbox.git] / src / VBox / Debugger / VBoxDbgStatsQt4.h
blob83ac8594171966b37ac559c183ef59007ef497a3
1 /* $Id$ */
2 /** @file
3 * VBox Debugger GUI - Statistics.
4 */
6 /*
7 * Copyright (C) 2006-2010 Oracle Corporation
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 #ifndef ___Debugger_VBoxDbgStats_h
19 #define ___Debugger_VBoxDbgStats_h
21 #include "VBoxDbgBase.h"
23 #include <QTreeView>
24 #include <QTimer>
25 #include <QComboBox>
26 #include <QMenu>
28 class VBoxDbgStats;
29 class VBoxDbgStatsModel;
31 /** Pointer to a statistics sample. */
32 typedef struct DBGGUISTATSNODE *PDBGGUISTATSNODE;
33 /** Pointer to a const statistics sample. */
34 typedef struct DBGGUISTATSNODE const *PCDBGGUISTATSNODE;
37 /**
38 * The VM statistics tree view.
40 * A tree representation of the STAM statistics.
42 class VBoxDbgStatsView : public QTreeView, public VBoxDbgBase
44 Q_OBJECT;
46 public:
47 /**
48 * Creates a VM statistics list view widget.
50 * @param a_pDbgGui Pointer to the debugger gui object.
51 * @param a_pModel The model. Will take ownership of this and delete it together
52 * with the view later
53 * @param a_pParent Parent widget.
55 VBoxDbgStatsView(VBoxDbgGui *a_pDbgGui, VBoxDbgStatsModel *a_pModel, VBoxDbgStats *a_pParent = NULL);
57 /** Destructor. */
58 virtual ~VBoxDbgStatsView();
60 /**
61 * Updates the view with current information from STAM.
62 * This will indirectly update the m_PatStr.
64 * @param rPatStr Selection pattern. NULL means everything, see STAM for further details.
66 void updateStats(const QString &rPatStr);
68 /**
69 * Resets the stats items matching the specified pattern.
70 * This pattern doesn't have to be the one used for update, thus m_PatStr isn't updated.
72 * @param rPatStr Selection pattern. NULL means everything, see STAM for further details.
74 void resetStats(const QString &rPatStr);
76 /**
77 * Resizes the columns to fit the content.
79 void resizeColumnsToContent();
81 protected:
82 /**
83 * Expands or collapses a sub-tree.
85 * @param a_rIndex The root of the sub-tree.
86 * @param a_fExpanded Expand/collapse.
88 void setSubTreeExpanded(QModelIndex const &a_rIndex, bool a_fExpanded);
90 /**
91 * Popup context menu.
93 * @param a_pEvt The event.
95 virtual void contextMenuEvent(QContextMenuEvent *a_pEvt);
97 protected slots:
98 /**
99 * Slot for handling the view/header context menu.
100 * @param a_rPos The mouse location.
102 void headerContextMenuRequested(const QPoint &a_rPos);
104 /** @name Action signal slots.
105 * @{ */
106 void actExpand();
107 void actCollapse();
108 void actRefresh();
109 void actReset();
110 void actCopy();
111 void actToLog();
112 void actToRelLog();
113 void actAdjColumns();
114 /** @} */
117 protected:
118 /** Pointer to the data model. */
119 VBoxDbgStatsModel *m_pModel;
120 /** The current selection pattern. */
121 QString m_PatStr;
122 /** The parent widget. */
123 VBoxDbgStats *m_pParent;
125 /** Leaf item menu. */
126 QMenu *m_pLeafMenu;
127 /** Branch item menu. */
128 QMenu *m_pBranchMenu;
129 /** View menu. */
130 QMenu *m_pViewMenu;
132 /** The menu that's currently being executed. */
133 QMenu *m_pCurMenu;
134 /** The current index relating to the context menu.
135 * Considered invalid if m_pCurMenu is NULL. */
136 QModelIndex m_CurIndex;
138 /** Expand Tree action. */
139 QAction *m_pExpandAct;
140 /** Collapse Tree action. */
141 QAction *m_pCollapseAct;
142 /** Refresh Tree action. */
143 QAction *m_pRefreshAct;
144 /** Reset Tree action. */
145 QAction *m_pResetAct;
146 /** Copy (to clipboard) action. */
147 QAction *m_pCopyAct;
148 /** To Log action. */
149 QAction *m_pToLogAct;
150 /** To Release Log action. */
151 QAction *m_pToRelLogAct;
152 /** Adjust the columns. */
153 QAction *m_pAdjColumns;
154 #if 0
155 /** Save Tree (to file) action. */
156 QAction *m_SaveFileAct;
157 /** Load Tree (from file) action. */
158 QAction *m_LoadFileAct;
159 /** Take Snapshot action. */
160 QAction *m_TakeSnapshotAct;
161 /** Load Snapshot action. */
162 QAction *m_LoadSnapshotAct;
163 /** Diff With Snapshot action. */
164 QAction *m_DiffSnapshotAct;
165 #endif
171 * The VM statistics window.
173 * This class displays the statistics of a VM. The UI contains
174 * a entry field for the selection pattern, a refresh interval
175 * spinbutton, and the tree view with the statistics.
177 class VBoxDbgStats : public VBoxDbgBaseWindow
179 Q_OBJECT;
181 public:
183 * Creates a VM statistics list view widget.
185 * @param a_pDbgGui Pointer to the debugger gui object.
186 * @param pszPat Initial selection pattern. NULL means everything. (See STAM for details.)
187 * @param uRefreshRate The refresh rate. 0 means not to refresh and is the default.
188 * @param pParent Parent widget.
190 VBoxDbgStats(VBoxDbgGui *a_pDbgGui, const char *pszPat = NULL, unsigned uRefreshRate= 0, QWidget *pParent = NULL);
192 /** Destructor. */
193 virtual ~VBoxDbgStats();
195 protected:
197 * Destroy the widget on close.
199 * @param a_pCloseEvt The close event.
201 virtual void closeEvent(QCloseEvent *a_pCloseEvt);
203 protected slots:
204 /** Apply the activated combobox pattern. */
205 void apply(const QString &Str);
206 /** The "All" button was pressed. */
207 void applyAll();
208 /** Refresh the data on timer tick and pattern changed. */
209 void refresh();
211 * Set the refresh rate.
213 * @param iRefresh The refresh interval in seconds.
215 void setRefresh(int iRefresh);
218 * Change the focus to the pattern combo box.
220 void actFocusToPat();
222 protected:
224 /** The current selection pattern. */
225 QString m_PatStr;
226 /** The pattern combo box. */
227 QComboBox *m_pPatCB;
228 /** The refresh rate in seconds.
229 * 0 means not to refresh. */
230 unsigned m_uRefreshRate;
231 /** The refresh timer .*/
232 QTimer *m_pTimer;
233 /** The tree view widget. */
234 VBoxDbgStatsView *m_pView;
236 /** Move to pattern field action. */
237 QAction *m_pFocusToPat;
241 #endif