- Timestamp:
- Jul 28, 2020 5:56:08 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.cpp
r85405 r85493 199 199 m_pLayout->addWidget(m_pPaneResourceMonitor); 200 200 m_pLayout->setCurrentWidget(m_pPaneResourceMonitor); 201 connect(m_pPaneResourceMonitor, &UIResourceMonitorWidget::sigSwitchMachinePerformancePane, 202 this, &UIToolPaneGlobal::sigSwitchMachinePerformancePane); 201 203 } 202 204 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.h
r83482 r85493 51 51 /** Notifies listeners about Cloud Profile Manager change. */ 52 52 void sigCloudProfileManagerChange(); 53 void sigSwitchMachinePerformancePane(const QUuid &machineUid); 53 54 54 55 public: -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r85439 r85493 28 28 #include "UIExtraDataManager.h" 29 29 #include "UIChooser.h" 30 #include "UICommon.h" 30 31 #include "UIVirtualBoxManager.h" 31 32 #include "UIVirtualBoxManagerWidget.h" … … 459 460 } 460 461 462 void UIVirtualBoxManagerWidget::sltSwitchMachinePerformancePane(const QUuid &machineUid) 463 { 464 if (!m_pPaneToolsMachine) 465 return; 466 CVirtualBox comVBox = uiCommon().virtualBox(); 467 468 CMachine comMachine = comVBox.FindMachine(machineUid.toString()); 469 if (comMachine.isNull()) 470 return; 471 m_pPaneToolsMachine->setActive(true); 472 m_pPaneToolsGlobal->setActive(false); 473 m_pPaneToolsMachine->setMachine(comMachine); 474 switchToMachineTool(UIToolType_Performance); 475 } 476 461 477 void UIVirtualBoxManagerWidget::prepare() 462 478 { … … 556 572 connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigCloudProfileManagerChange, 557 573 this, &UIVirtualBoxManagerWidget::sigCloudProfileManagerChange); 574 connect(m_pPaneToolsGlobal, &UIToolPaneGlobal::sigSwitchMachinePerformancePane, 575 this, &UIVirtualBoxManagerWidget::sltSwitchMachinePerformancePane); 558 576 559 577 /* Add into stack: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h
r85439 r85493 248 248 void sltHandleToolMenuRequested(UIToolClass enmClass, const QPoint &position); 249 249 250 /** Handles signal abou rTools-pane index change. */250 /** Handles signal about Tools-pane index change. */ 251 251 void sltHandleToolsPaneIndexChange(); 252 253 /** Handles signal requesting performance pane switch. */ 254 void sltSwitchMachinePerformancePane(const QUuid &machineUid); 252 255 /** @} */ 253 256 -
trunk/src/VBox/Frontends/VirtualBox/src/monitor/performance/UIPerformanceMonitor.cpp
r85485 r85493 560 560 font.setPixelSize(iFontSize); 561 561 --iFontSize; 562 }while(QFontMetrics(font).width(m_strGAWarning) >= m_lineChartRect.width());562 }while(QFontMetrics(font).width(m_strGAWarning) >= 0.8 * m_lineChartRect.width()); 563 563 font.setBold(true); 564 564 painter.setFont(font); -
trunk/src/VBox/Frontends/VirtualBox/src/monitor/resource/UIResourceMonitor.cpp
r85303 r85493 184 184 void setMinimumColumnWidths(const QMap<int, int>& widths); 185 185 void updateColumVisibility(); 186 int selectedItemIndex() const; 186 187 187 188 protected: … … 248 249 void setupPerformanceCollector(); 249 250 }; 251 252 Q_DECLARE_METATYPE(UIResourceMonitorItem); 250 253 251 254 … … 289 292 void setShouldUpdate(bool fShouldUpdate); 290 293 const QMap<int, int> dataLengths() const; 294 QUuid itemUid(int iIndex); 291 295 292 296 private slots: … … 667 671 } 668 672 673 int UIVMResourceMonitorTableView::selectedItemIndex() const 674 { 675 UIResourceMonitorProxyModel *pModel = qobject_cast<UIResourceMonitorProxyModel*>(model()); 676 if (!pModel) 677 return -1; 678 679 QItemSelectionModel *pSelectionModel = selectionModel(); 680 if (!pSelectionModel) 681 return -1; 682 QModelIndexList selectedItemIndices = pSelectionModel->selectedRows(); 683 if (selectedItemIndices.isEmpty()) 684 return -1; 685 686 /* just use the the 1st index: */ 687 QModelIndex modelIndex = pModel->mapToSource(selectedItemIndices[0]); 688 689 if (!modelIndex.isValid()) 690 return -1; 691 return modelIndex.row(); 692 } 693 669 694 void UIVMResourceMonitorTableView::resizeEvent(QResizeEvent *pEvent) 670 695 { … … 860 885 { 861 886 return m_columnDataMaxLength; 887 } 888 889 QUuid UIResourceMonitorModel::itemUid(int iIndex) 890 { 891 if (iIndex >= m_itemList.size()) 892 return QUuid(); 893 return m_itemList[iIndex].m_VMuid; 862 894 } 863 895 … … 1198 1230 , m_pColumnVisibilityToggleMenu(0) 1199 1231 , m_pHostStatsWidget(0) 1232 , m_pShowPerformanceMonitorAction(0) 1200 1233 , m_fIsCurrentTool(true) 1201 1234 , m_iSortIndicatorWidth(0) … … 1247 1280 m_columnTitles[VMResourceMonitorColumn_DiskIOWriteTotal] = UIResourceMonitorWidget::tr("Disk Write Total"); 1248 1281 m_columnTitles[VMResourceMonitorColumn_VMExits] = UIResourceMonitorWidget::tr("VM Exits"); 1282 if (m_pShowPerformanceMonitorAction) 1283 m_pShowPerformanceMonitorAction->setText(tr("Show Performance Monitor")); 1249 1284 if (m_pModel) 1250 1285 m_pModel->setColumnCaptions(m_columnTitles); 1251 1286 computeMinimumColumnWidths(); 1252 }1253 1254 void UIResourceMonitorWidget::resizeEvent(QResizeEvent *pEvent)1255 {1256 QIWithRetranslateUI<QWidget>::resizeEvent(pEvent);1257 }1258 1259 void UIResourceMonitorWidget::showEvent(QShowEvent *pEvent)1260 {1261 QIWithRetranslateUI<QWidget>::showEvent(pEvent);1262 }1263 1264 void UIResourceMonitorWidget::paintEvent(QPaintEvent *pEvent)1265 {1266 QIWithRetranslateUI<QWidget>::paintEvent(pEvent);1267 1287 } 1268 1288 … … 1282 1302 prepareWidgets(); 1283 1303 loadSettings(); 1304 prepareActions(); 1284 1305 retranslateUi(); 1285 prepareActions();1286 1306 updateModelColumVisibilityCache(); 1287 1307 } … … 1318 1338 m_pTableView->setModel(m_pProxyModel); 1319 1339 m_pTableView->setItemDelegate(new UIVMResourceMonitorDelegate); 1320 m_pTableView->setSelectionMode(QAbstractItemView::NoSelection); 1340 m_pTableView->setSelectionMode(QAbstractItemView::SingleSelection); 1341 m_pTableView->setSelectionBehavior(QAbstractItemView::SelectRows); 1321 1342 m_pTableView->setShowGrid(false); 1343 m_pTableView->setContextMenuPolicy(Qt::CustomContextMenu); 1322 1344 m_pTableView->horizontalHeader()->setHighlightSections(false); 1323 1345 m_pTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed); … … 1329 1351 m_pTableView->setSortingEnabled(true); 1330 1352 m_pTableView->sortByColumn(0, Qt::AscendingOrder); 1331 connect(m_pModel, &UIResourceMonitorModel::sigDataUpdate, this, &UIResourceMonitorWidget::sltHandleDataUpdate); 1332 connect(m_pModel, &UIResourceMonitorModel::sigHostStatsUpdate, this, &UIResourceMonitorWidget::sltHandleHostStatsUpdate); 1353 connect(m_pModel, &UIResourceMonitorModel::sigDataUpdate, 1354 this, &UIResourceMonitorWidget::sltHandleDataUpdate); 1355 connect(m_pModel, &UIResourceMonitorModel::sigHostStatsUpdate, 1356 this, &UIResourceMonitorWidget::sltHandleHostStatsUpdate); 1357 connect(m_pTableView, &UIVMResourceMonitorTableView::customContextMenuRequested, 1358 this, &UIResourceMonitorWidget::sltHandleTableContextMenuRequest); 1359 1333 1360 updateModelColumVisibilityCache(); 1334 1361 } … … 1353 1380 connect(pAction, &QAction::toggled, this, &UIResourceMonitorWidget::sltHandleColumnAction); 1354 1381 } 1355 return; 1382 m_pShowPerformanceMonitorAction = new QAction(this); 1383 connect(m_pShowPerformanceMonitorAction, &QAction::triggered, this, &UIResourceMonitorWidget::sltHandleShowPerformanceMonitor); 1356 1384 } 1357 1385 … … 1434 1462 } 1435 1463 1464 void UIResourceMonitorWidget::sltHandleTableContextMenuRequest(const QPoint &pos) 1465 { 1466 if (!m_pTableView) 1467 return; 1468 1469 QMenu menu; 1470 if (m_pShowPerformanceMonitorAction) 1471 menu.addAction(m_pShowPerformanceMonitorAction); 1472 1473 menu.exec(m_pTableView->mapToGlobal(pos)); 1474 } 1475 1476 void UIResourceMonitorWidget::sltHandleShowPerformanceMonitor() 1477 { 1478 if (!m_pTableView || !m_pModel) 1479 return; 1480 QUuid machineId = m_pModel->itemUid(m_pTableView->selectedItemIndex()); 1481 if (machineId.isNull()) 1482 return; 1483 emit sigSwitchMachinePerformancePane(machineId); 1484 } 1485 1436 1486 void UIResourceMonitorWidget::setColumnVisible(int iColumnId, bool fVisible) 1437 1487 { -
trunk/src/VBox/Frontends/VirtualBox/src/monitor/resource/UIResourceMonitor.h
r85303 r85493 49 49 Q_OBJECT; 50 50 51 signals: 52 53 void sigSwitchMachinePerformancePane(const QUuid &machineId); 54 51 55 public: 52 56 … … 69 73 * @{ */ 70 74 virtual void retranslateUi() /* override */; 71 virtual void resizeEvent(QResizeEvent *pEvent) /* override */;72 virtual void showEvent(QShowEvent *pEvent) /* override */;73 virtual void paintEvent(QPaintEvent *pEvent) /* override */;74 75 /** @} */ 75 76 … … 80 81 void sltHandleColumnAction(bool fChecked); 81 82 void sltHandleHostStatsUpdate(const UIVMResourceMonitorHostStats &stats); 83 void sltHandleTableContextMenuRequest(const QPoint &pos); 84 void sltHandleShowPerformanceMonitor(); 82 85 83 86 private: … … 119 122 QMap<int, bool> m_columnVisible; 120 123 UIVMResourceMonitorHostStatsWidget *m_pHostStatsWidget; 124 QAction *m_pShowPerformanceMonitorAction; 121 125 /** @} */ 122 126 /** Indicates if this widget's host tool is current tool. */
Note:
See TracChangeset
for help on using the changeset viewer.