Changeset 89093 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 17, 2021 11:35:46 AM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r89036 r89093 952 952 src/manager/chooser/UIChooserAbstractModel.cpp \ 953 953 src/activity/overview/UIVMActivityOverviewWidget.cpp \ 954 src/activity/overview/UIVMActivityToolWidget.cpp \955 954 src/networkmanager/UINetworkManager.cpp \ 956 955 src/snapshots/UISnapshotDetailsWidget.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/activity/overview/UIVMActivityToolWidget.cpp
r89080 r89093 60 60 61 61 62 class UIVMActivityListWidget : public QWidget63 {64 65 Q_OBJECT;66 public:67 68 UIVMActivityListWidget(QWidget *pParent = 0)69 : QWidget(pParent)70 {71 }72 };73 62 /********************************************************************************************************************************* 74 63 * Class UIVMActivityToolWidget implementation. * … … 82 71 , m_fShowToolbar(fShowToolbar) 83 72 , m_pToolBar(0) 73 , m_pExportToFileAction(0) 84 74 { 85 75 prepare(); 76 prepareActions(); 77 prepareToolBar(); 78 sltCurrentTabChanged(0); 86 79 } 87 80 … … 113 106 { 114 107 setTabBarAutoHide(true); 108 setLayout(new QHBoxLayout); 109 110 connect(this, &UIVMActivityToolWidget::currentChanged, 111 this, &UIVMActivityToolWidget::sltCurrentTabChanged); 115 112 } 116 113 … … 148 145 } 149 146 150 151 147 void UIVMActivityToolWidget::prepareActions() 152 148 { … … 156 152 connect(pToResourcesAction, &QAction::triggered, this, &UIVMActivityToolWidget::sigSwitchToResourcesPane); 157 153 154 m_pExportToFileAction = 155 m_pActionPool->action(UIActionIndex_M_Activity_S_Export); 156 if (m_pExportToFileAction) 157 connect(m_pExportToFileAction, &QAction::triggered, this, &UIVMActivityToolWidget::sltExportToFile); 158 158 } 159 159 … … 187 187 } 188 188 189 void UIVMActivityToolWidget::showVMActivityMonitor(CMachine &comMachine)190 {191 if (comMachine.isNull())192 return;193 // if (!m_pActivityMonitor)194 // {195 // m_pActivityMonitor = new UIVMActivityMonitor(m_enmEmbedding, this,196 // comMachine, m_pActionPool, false /* Show toolbar */);197 // addWidget(m_pActivityMonitor);198 // }199 // else200 // m_pActivityMonitor->setMachine(comMachine);201 202 // setCurrentWidget(m_pActivityMonitor);203 }204 205 void UIVMActivityToolWidget::showVMActivityList()206 {207 // if (!m_pActivityList)208 // {209 // m_pActivityList = new UIVMActivityListWidget(this);210 // addWidget(m_pActivityList);211 // }212 // setCurrentWidget(m_pActivityList);213 }214 215 189 void UIVMActivityToolWidget::removeTabs(const QVector<QUuid> &machineIdsToRemove) 216 190 { … … 241 215 if (comMachine.isNull()) 242 216 continue; 243 addTab(new UIVMActivityMonitor(m_enmEmbedding, this, comMachine, m_pActionPool), comMachine.GetName()); 244 } 245 } 246 247 #include "UIVMActivityToolWidget.moc" 217 addTab(new UIVMActivityMonitor(m_enmEmbedding, this, comMachine), comMachine.GetName()); 218 } 219 } 220 221 void UIVMActivityToolWidget::sltExportToFile() 222 { 223 UIVMActivityMonitor *pActivityMonitor = qobject_cast<UIVMActivityMonitor*>(currentWidget()); 224 if (pActivityMonitor) 225 pActivityMonitor->sltExportMetricsToFile(); 226 } 227 228 void UIVMActivityToolWidget::sltCurrentTabChanged(int iIndex) 229 { 230 Q_UNUSED(iIndex); 231 UIVMActivityMonitor *pActivityMonitor = qobject_cast<UIVMActivityMonitor*>(currentWidget()); 232 if (pActivityMonitor) 233 { 234 CMachine comMachine = uiCommon().virtualBox().FindMachine(pActivityMonitor->machineId().toString()); 235 if (!comMachine.isNull()) 236 { 237 setExportActionEnabled(comMachine.GetState() == KMachineState_Running); 238 } 239 } 240 } 241 242 void UIVMActivityToolWidget::setExportActionEnabled(bool fEnabled) 243 { 244 if (m_pExportToFileAction) 245 m_pExportToFileAction->setEnabled(fEnabled); 246 } -
trunk/src/VBox/Frontends/VirtualBox/src/activity/overview/UIVMActivityToolWidget.h
r89080 r89093 72 72 private slots: 73 73 74 void sltExportToFile(); 75 void sltCurrentTabChanged(int iIndex); 74 76 75 77 private: … … 86 88 /** @} */ 87 89 88 void showVMActivityMonitor(CMachine &comMachine);89 void showVMActivityList();90 90 /** Remove tabs conaining machine monitors with ids @machineIdsToRemove. */ 91 91 void removeTabs(const QVector<QUuid> &machineIdsToRemove); 92 92 /** Add new tabs for each QUuid in @machineIdsToAdd. Does not check for duplicates. */ 93 93 void addTabs(const QVector<QUuid> &machineIdsToAdd); 94 94 void setExportActionEnabled(bool fEnabled); 95 95 96 96 /** @name General variables. … … 106 106 bool m_fIsCurrentTool; 107 107 QVector<QUuid> m_machineIds; 108 QAction *m_pExportToFileAction; 108 109 }; 109 110 -
trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.cpp
r89041 r89093 30 30 /* GUI includes: */ 31 31 #include "QIFileDialog.h" 32 #include "UIActionPool.h"33 32 #include "UICommon.h" 34 33 #include "UIIconPool.h" … … 880 879 881 880 UIVMActivityMonitor::UIVMActivityMonitor(EmbedTo enmEmbedding, QWidget *pParent, 882 const CMachine &machine , UIActionPool *pActionPool)881 const CMachine &machine) 883 882 : QIWithRetranslateUI<QWidget>(pParent) 884 883 , m_fGuestAdditionsAvailable(false) … … 893 892 , m_iTimeStep(0) 894 893 , m_enmEmbedding(enmEmbedding) 895 , m_pActionPool(pActionPool)896 894 { 897 895 prepareMetrics(); … … 1267 1265 void UIVMActivityMonitor::prepareActions() 1268 1266 { 1269 QAction *pExportAction =1270 m_pActionPool->action(UIActionIndex_M_Activity_S_Export);1271 if (pExportAction)1272 connect(pExportAction, &QAction::triggered, this, &UIVMActivityMonitor::sltExportMetricsToFile);1273 1267 } 1274 1268 -
trunk/src/VBox/Frontends/VirtualBox/src/activity/vmactivity/UIVMActivityMonitor.h
r89041 r89093 45 45 class QVBoxLayout; 46 46 class QLabel; 47 class UIActionPool;48 47 class UIChart; 49 48 class UISession; … … 127 126 /** Constructs information-tab passing @a pParent to the QWidget base-class constructor. 128 127 * @param machine is machine reference. */ 129 UIVMActivityMonitor(EmbedTo enmEmbedding, QWidget *pParent, const CMachine &machine, 130 UIActionPool *pActionPool); 128 UIVMActivityMonitor(EmbedTo enmEmbedding, QWidget *pParent, const CMachine &machine); 131 129 ~UIVMActivityMonitor(); 132 130 void setMachine(const CMachine &machine); … … 140 138 void sltGuestAdditionsStateChange(); 141 139 /** @} */ 140 void sltExportMetricsToFile(); 142 141 143 142 protected: … … 152 151 /** Stop updating the charts if/when the machine state changes something other than KMachineState_Running. */ 153 152 void sltMachineStateChange(const QUuid &uId); 154 void sltExportMetricsToFile();155 153 void sltCreateContextMenu(const QPoint &point); 156 154 void sltClearCOMData(); … … 251 249 quint64 m_iTimeStep; 252 250 EmbedTo m_enmEmbedding; 253 UIActionPool *m_pActionPool;254 251 }; 255 252 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp
r88834 r89093 2311 2311 }; 2312 2312 2313 /** Simple action extension, used as 'To VM Activity Ove view' action class. */2313 /** Simple action extension, used as 'To VM Activity Overview' action class. */ 2314 2314 class UIActionMenuSelectorActivityToVMActivityOverview : public UIActionSimple 2315 2315 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp
r89046 r89093 228 228 /* Create Performance Monitor tab: */ 229 229 UIVMActivityMonitor *pVMActivityMonitorWidget = 230 new UIVMActivityMonitor(EmbedTo_Dialog, this, m_pMachineWindow->machine(), 231 m_pMachineWindow->uisession()->actionPool()); 230 new UIVMActivityMonitor(EmbedTo_Dialog, this, m_pMachineWindow->machine()); 232 231 if (pVMActivityMonitorWidget) 233 232 {
Note:
See TracChangeset
for help on using the changeset viewer.