VirtualBox

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

Last change on this file since 32083 was 31530, checked in by vboxsync, 14 years ago

Debugger: Updated the file headers.

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