1 | /* $Id: UIVMActivityOverviewWidget.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIVMActivityOverviewWidget class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_activity_overview_UIVMActivityOverviewWidget_h
|
---|
29 | #define FEQT_INCLUDED_SRC_activity_overview_UIVMActivityOverviewWidget_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QMainWindow>
|
---|
36 |
|
---|
37 | /* GUI includes: */
|
---|
38 | #include "QIManagerDialog.h"
|
---|
39 |
|
---|
40 | /* Forward declarations: */
|
---|
41 | class QAbstractButton;
|
---|
42 | class QFrame;
|
---|
43 | class QItemSelection;
|
---|
44 | class QLabel;
|
---|
45 | class QTableView;
|
---|
46 | class QTreeWidgetItem;
|
---|
47 | class QIDialogButtonBox;
|
---|
48 | class UIActionPool;
|
---|
49 | class QIToolBar;
|
---|
50 | class UIVMActivityOverviewProxyModel;
|
---|
51 | class UIVMActivityOverviewModel;
|
---|
52 | class UIVirtualMachineItemCloud;
|
---|
53 | class UIVMActivityOverviewHostStats;
|
---|
54 | class UIVMActivityOverviewHostStatsWidget;
|
---|
55 | class UIVMActivityOverviewTableView;
|
---|
56 | class UIVMActivityOverviewTableView;
|
---|
57 | class UIVMActivityOverviewModel;
|
---|
58 | class UIVMActivityOverviewProxyModel;
|
---|
59 |
|
---|
60 | /** QWidget extension to display a Linux top like utility that sort running vm wrt. resource allocations. */
|
---|
61 | class UIVMActivityOverviewWidget : public QWidget
|
---|
62 | {
|
---|
63 | Q_OBJECT;
|
---|
64 |
|
---|
65 | signals:
|
---|
66 |
|
---|
67 | void sigSwitchToMachineActivityPane(const QUuid &uMachineId);
|
---|
68 |
|
---|
69 | public:
|
---|
70 |
|
---|
71 | UIVMActivityOverviewWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool,
|
---|
72 | bool fShowToolbar = true, QWidget *pParent = 0);
|
---|
73 | QMenu *columnVisiblityToggleMenu() const;
|
---|
74 | QMenu *menu() const;
|
---|
75 |
|
---|
76 | bool isCurrentTool() const;
|
---|
77 | void setIsCurrentTool(bool fIsCurrentTool);
|
---|
78 | void setCloudMachineItems(const QList<UIVirtualMachineItemCloud*> &cloudItems);
|
---|
79 |
|
---|
80 | #ifdef VBOX_WS_MAC
|
---|
81 | QIToolBar *toolbar() const { return m_pToolBar; }
|
---|
82 | #endif
|
---|
83 |
|
---|
84 | protected:
|
---|
85 |
|
---|
86 | /** @name Event-handling stuff.
|
---|
87 | * @{ */
|
---|
88 | virtual void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
|
---|
89 | /** @} */
|
---|
90 |
|
---|
91 | private slots:
|
---|
92 |
|
---|
93 | void sltHandleDataUpdate();
|
---|
94 | void sltToggleColumnSelectionMenu(bool fChecked);
|
---|
95 | void sltHandleColumnAction(bool fChecked);
|
---|
96 | void sltHandleHostStatsUpdate(const UIVMActivityOverviewHostStats &stats);
|
---|
97 | void sltHandleTableContextMenuRequest(const QPoint &pos);
|
---|
98 | void sltHandleShowVMActivityMonitor();
|
---|
99 | void sltHandleTableSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
---|
100 | void sltNotRunningVMVisibility(bool fShow);
|
---|
101 | void sltCloudVMVisibility(bool fShow);
|
---|
102 | void sltSaveSettings();
|
---|
103 | void sltClearCOMData();
|
---|
104 | void sltRetranslateUI();
|
---|
105 |
|
---|
106 | private:
|
---|
107 |
|
---|
108 | void setColumnVisible(int iColumnId, bool fVisible);
|
---|
109 | bool columnVisible(int iColumnId) const;
|
---|
110 | void updateModelColumVisibilityCache();
|
---|
111 | void computeMinimumColumnWidths();
|
---|
112 |
|
---|
113 | /** @name Prepare/cleanup cascade.
|
---|
114 | * @{ */
|
---|
115 | void prepare();
|
---|
116 | void prepareWidgets();
|
---|
117 | void prepareHostStatsWidgets();
|
---|
118 | void prepareToolBar();
|
---|
119 | void prepareActions();
|
---|
120 | void updateColumnsMenu();
|
---|
121 | void loadSettings();
|
---|
122 | /** @} */
|
---|
123 |
|
---|
124 | /** @name General variables.
|
---|
125 | * @{ */
|
---|
126 | const EmbedTo m_enmEmbedding;
|
---|
127 | UIActionPool *m_pActionPool;
|
---|
128 | const bool m_fShowToolbar;
|
---|
129 | /** @} */
|
---|
130 |
|
---|
131 | /** @name Misc members.
|
---|
132 | * @{ */
|
---|
133 | QIToolBar *m_pToolBar;
|
---|
134 | UIVMActivityOverviewTableView *m_pTableView;
|
---|
135 | UIVMActivityOverviewProxyModel *m_pProxyModel;
|
---|
136 | UIVMActivityOverviewModel *m_pModel;
|
---|
137 | QMenu *m_pColumnVisibilityToggleMenu;
|
---|
138 | /* The key is the column id (VMActivityOverviewColumn) and value is column title. */
|
---|
139 | QMap<int, QString> m_columnTitles;
|
---|
140 | /* The key is the column id (VMActivityOverviewColumn) and value is true if the column is visible. */
|
---|
141 | QMap<int, bool> m_columnVisible;
|
---|
142 | UIVMActivityOverviewHostStatsWidget *m_pHostStatsWidget;
|
---|
143 | QAction *m_pVMActivityMonitorAction;
|
---|
144 | /** @} */
|
---|
145 | /** Indicates if this widget's host tool is current tool. */
|
---|
146 | bool m_fIsCurrentTool;
|
---|
147 | int m_iSortIndicatorWidth;
|
---|
148 | bool m_fShowNotRunningVMs;
|
---|
149 | bool m_fShowCloudVMs;
|
---|
150 | };
|
---|
151 |
|
---|
152 | #endif /* !FEQT_INCLUDED_SRC_activity_overview_UIVMActivityOverviewWidget_h */
|
---|