Changeset 104970 in vbox
- Timestamp:
- Jun 20, 2024 9:03:02 AM (5 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/activity/overview
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/activity/overview/UIVMActivityOverviewModelView.cpp
r104969 r104970 56 56 #include "KMetricType.h" 57 57 58 59 58 /********************************************************************************************************************************* 60 * UI ActivityOverviewAccessibleRowdefinition. *59 * UIVMActivityOverviewCell definition. * 61 60 *********************************************************************************************************************************/ 62 61 63 class UI ActivityOverviewAccessibleRow : public QITableViewRow62 class UIVMActivityOverviewCell : public QITableViewCell 64 63 { 65 64 … … 68 67 public: 69 68 70 UIActivityOverviewAccessibleRow(QITableView *pTableView, const QUuid &uMachineId, 69 UIVMActivityOverviewCell(QITableViewRow *pRow, int iColumnIndex); 70 virtual QString text() const RT_OVERRIDE RT_FINAL; 71 int columnLength(int iColumnIndex) const; 72 void setText(const QString &strText); 73 74 private: 75 76 /* VMActivityOverviewColumn enum: */ 77 int m_iColumnIndex; 78 QString m_strText; 79 }; 80 81 82 /********************************************************************************************************************************* 83 * UIVMActivityOverviewRow definition. * 84 *********************************************************************************************************************************/ 85 86 class UIVMActivityOverviewRow : public QITableViewRow 87 { 88 89 Q_OBJECT; 90 91 public: 92 93 UIVMActivityOverviewRow(QITableView *pTableView, const QUuid &uMachineId, 71 94 const QString &strMachineName); 72 95 … … 77 100 virtual bool isCloudVM() const = 0; 78 101 79 virtual ~UI ActivityOverviewAccessibleRow();102 virtual ~UIVMActivityOverviewRow(); 80 103 virtual int childCount() const RT_OVERRIDE RT_FINAL; 81 104 … … 89 112 QUuid m_uMachineId; 90 113 /* Key is VMActivityOverviewColumn enum item. */ 91 QMap<int, UI ActivityOverviewAccessibleCell*> m_cells;114 QMap<int, UIVMActivityOverviewCell*> m_cells; 92 115 93 116 QString m_strMachineName; … … 99 122 100 123 /********************************************************************************************************************************* 101 * UI ActivityOverviewAccessibleRowLocal definition. *124 * UIVMActivityOverviewRowLocal definition. * 102 125 *********************************************************************************************************************************/ 103 126 104 class UI ActivityOverviewAccessibleRowLocal : public UIActivityOverviewAccessibleRow127 class UIVMActivityOverviewRowLocal : public UIVMActivityOverviewRow 105 128 { 106 129 … … 109 132 public: 110 133 111 UI ActivityOverviewAccessibleRowLocal(QITableView *pTableView, const QUuid &uMachineId,134 UIVMActivityOverviewRowLocal(QITableView *pTableView, const QUuid &uMachineId, 112 135 const QString &strMachineName, KMachineState enmMachineState); 113 ~UI ActivityOverviewAccessibleRowLocal();136 ~UIVMActivityOverviewRowLocal(); 114 137 virtual void setMachineState(int iState) RT_OVERRIDE RT_FINAL; 115 138 … … 146 169 147 170 /********************************************************************************************************************************* 148 * UI ActivityOverviewAccessibleRowCloud definition. *171 * UIVMActivityOverviewRowCloud definition. * 149 172 *********************************************************************************************************************************/ 150 173 151 /* A UI ActivityOverviewItem derivation to show cloud vms in the table view: */152 class UI ActivityOverviewAccessibleRowCloud : public UIActivityOverviewAccessibleRow174 /* A UIVMActivityOverviewItem derivation to show cloud vms in the table view: */ 175 class UIVMActivityOverviewRowCloud : public UIVMActivityOverviewRow 153 176 { 154 177 Q_OBJECT; 155 178 public: 156 UI ActivityOverviewAccessibleRowCloud(QITableView *pTableView, const QUuid &uMachineId,179 UIVMActivityOverviewRowCloud(QITableView *pTableView, const QUuid &uMachineId, 157 180 const QString &strMachineName, CCloudMachine &comCloudMachine); 158 181 void updateMachineState(); … … 184 207 185 208 /********************************************************************************************************************************* 186 * UI ActivityOverviewAccessibleRowLocal implementation. *209 * UIVMActivityOverviewRowLocal implementation. * 187 210 *********************************************************************************************************************************/ 188 211 189 UI ActivityOverviewAccessibleRowLocal::UIActivityOverviewAccessibleRowLocal(QITableView *pTableView, const QUuid &uMachineId,212 UIVMActivityOverviewRowLocal::UIVMActivityOverviewRowLocal(QITableView *pTableView, const QUuid &uMachineId, 190 213 const QString &strMachineName, KMachineState enmMachineState) 191 : UI ActivityOverviewAccessibleRow(pTableView, uMachineId, strMachineName)214 : UIVMActivityOverviewRow(pTableView, uMachineId, strMachineName) 192 215 , m_enmMachineState(enmMachineState) 193 216 , m_uFreeRAM(0) … … 203 226 } 204 227 205 void UI ActivityOverviewAccessibleRowLocal::updateCells()228 void UIVMActivityOverviewRowLocal::updateCells() 206 229 { 207 230 /* CPU Load: */ … … 273 296 } 274 297 275 UI ActivityOverviewAccessibleRowLocal::~UIActivityOverviewAccessibleRowLocal()298 UIVMActivityOverviewRowLocal::~UIVMActivityOverviewRowLocal() 276 299 { 277 300 if (!m_comSession.isNull()) … … 279 302 } 280 303 281 void UI ActivityOverviewAccessibleRowLocal::resetDebugger()304 void UIVMActivityOverviewRowLocal::resetDebugger() 282 305 { 283 306 m_comSession = uiCommon().openSession(m_uMachineId, KLockType_Shared); … … 293 316 } 294 317 295 void UI ActivityOverviewAccessibleRowLocal::setMachineState(int iState)318 void UIVMActivityOverviewRowLocal::setMachineState(int iState) 296 319 { 297 320 if (iState <= KMachineState_Null || iState >= KMachineState_Max) … … 305 328 } 306 329 307 bool UI ActivityOverviewAccessibleRowLocal::isRunning() const330 bool UIVMActivityOverviewRowLocal::isRunning() const 308 331 { 309 332 return m_enmMachineState == KMachineState_Running; 310 333 } 311 334 312 bool UI ActivityOverviewAccessibleRowLocal::isCloudVM() const335 bool UIVMActivityOverviewRowLocal::isCloudVM() const 313 336 { 314 337 return false; 315 338 } 316 339 317 bool UI ActivityOverviewAccessibleRowLocal::isWithGuestAdditions()340 bool UIVMActivityOverviewRowLocal::isWithGuestAdditions() 318 341 { 319 342 if (m_comGuest.isNull()) … … 322 345 } 323 346 324 void UI ActivityOverviewAccessibleRowLocal::setTotalRAM(quint64 uTotalRAM)347 void UIVMActivityOverviewRowLocal::setTotalRAM(quint64 uTotalRAM) 325 348 { 326 349 m_uTotalRAM = uTotalRAM; 327 350 } 328 351 329 void UI ActivityOverviewAccessibleRowLocal::setFreeRAM(quint64 uFreeRAM)352 void UIVMActivityOverviewRowLocal::setFreeRAM(quint64 uFreeRAM) 330 353 { 331 354 m_uFreeRAM = uFreeRAM; 332 355 } 333 356 334 QString UI ActivityOverviewAccessibleRowLocal::machineStateString() const357 QString UIVMActivityOverviewRowLocal::machineStateString() const 335 358 { 336 359 return gpConverter->toString(m_enmMachineState); … … 339 362 340 363 /********************************************************************************************************************************* 341 * UI ActivityOverviewAccessibleRowCloud implementation. *364 * UIVMActivityOverviewRowCloud implementation. * 342 365 *********************************************************************************************************************************/ 343 366 344 UI ActivityOverviewAccessibleRowCloud::UIActivityOverviewAccessibleRowCloud(QITableView *pTableView, const QUuid &uMachineId,367 UIVMActivityOverviewRowCloud::UIVMActivityOverviewRowCloud(QITableView *pTableView, const QUuid &uMachineId, 345 368 const QString &strMachineName, CCloudMachine &comCloudMachine) 346 : UI ActivityOverviewAccessibleRow(pTableView, uMachineId, strMachineName)369 : UIVMActivityOverviewRow(pTableView, uMachineId, strMachineName) 347 370 , m_comCloudMachine(comCloudMachine) 348 371 { … … 351 374 if (m_pTimer) 352 375 { 353 connect(m_pTimer, &QTimer::timeout, this, &UI ActivityOverviewAccessibleRowCloud::sltTimeout);376 connect(m_pTimer, &QTimer::timeout, this, &UIVMActivityOverviewRowCloud::sltTimeout); 354 377 m_pTimer->setInterval(60 * 1000); 355 378 } … … 357 380 } 358 381 359 void UI ActivityOverviewAccessibleRowCloud::updateMachineState()382 void UIVMActivityOverviewRowCloud::updateMachineState() 360 383 { 361 384 if (m_comCloudMachine.isOk()) … … 363 386 } 364 387 365 bool UI ActivityOverviewAccessibleRowCloud::isRunning() const388 bool UIVMActivityOverviewRowCloud::isRunning() const 366 389 { 367 390 return m_enmMachineState == KCloudMachineState_Running; 368 391 } 369 392 370 bool UI ActivityOverviewAccessibleRowCloud::isCloudVM() const393 bool UIVMActivityOverviewRowCloud::isCloudVM() const 371 394 { 372 395 return true; 373 396 } 374 397 375 QString UI ActivityOverviewAccessibleRowCloud::machineStateString() const398 QString UIVMActivityOverviewRowCloud::machineStateString() const 376 399 { 377 400 if (!m_comCloudMachine.isOk()) … … 380 403 } 381 404 382 void UI ActivityOverviewAccessibleRowCloud::sltTimeout()405 void UIVMActivityOverviewRowCloud::sltTimeout() 383 406 { 384 407 int iDataSize = 1; … … 388 411 enmMetricType, iDataSize); 389 412 connect(pTask, &UIProgressTaskReadCloudMachineMetricData::sigMetricDataReceived, 390 this, &UI ActivityOverviewAccessibleRowCloud::sltMetricDataReceived);413 this, &UIVMActivityOverviewRowCloud::sltMetricDataReceived); 391 414 pTask->start(); 392 415 } 393 416 } 394 417 395 void UI ActivityOverviewAccessibleRowCloud::sltMetricDataReceived(KMetricType enmMetricType,418 void UIVMActivityOverviewRowCloud::sltMetricDataReceived(KMetricType enmMetricType, 396 419 const QVector<QString> &data, const QVector<QString> &timeStamps) 397 420 { … … 437 460 } 438 461 439 void UI ActivityOverviewAccessibleRowCloud::setMachineState(int iState)462 void UIVMActivityOverviewRowCloud::setMachineState(int iState) 440 463 { 441 464 if (iState <= KCloudMachineState_Invalid || iState >= KCloudMachineState_Max) … … 458 481 } 459 482 460 void UI ActivityOverviewAccessibleRowCloud::resetColumData()483 void UIVMActivityOverviewRowCloud::resetColumData() 461 484 { 462 485 for (int i = (int) VMActivityOverviewColumn_CPUGuestLoad; … … 465 488 } 466 489 467 void UI ActivityOverviewAccessibleRowCloud::getMetricList()490 void UIVMActivityOverviewRowCloud::getMetricList() 468 491 { 469 492 if (!isRunning()) … … 473 496 AssertPtrReturnVoid(pReadListProgressTask); 474 497 connect(pReadListProgressTask, &UIProgressTaskReadCloudMachineMetricList::sigMetricListReceived, 475 this, &UI ActivityOverviewAccessibleRowCloud::sltMetricNameListingComplete);498 this, &UIVMActivityOverviewRowCloud::sltMetricNameListingComplete); 476 499 pReadListProgressTask->start(); 477 500 } 478 501 479 void UI ActivityOverviewAccessibleRowCloud::sltMetricNameListingComplete(QVector<QString> metricNameList)502 void UIVMActivityOverviewRowCloud::sltMetricNameListingComplete(QVector<QString> metricNameList) 480 503 { 481 504 AssertReturnVoid(m_pTimer); … … 503 526 504 527 /********************************************************************************************************************************* 505 * UIVMActivityOverview AccessibleTableView implementation. *528 * UIVMActivityOverviewTableView implementation. * 506 529 *********************************************************************************************************************************/ 507 530 508 UIVMActivityOverview AccessibleTableView::UIVMActivityOverviewAccessibleTableView(QWidget *pParent)531 UIVMActivityOverviewTableView::UIVMActivityOverviewTableView(QWidget *pParent) 509 532 : QITableView(pParent) 510 533 { 511 534 } 512 535 513 void UIVMActivityOverview AccessibleTableView::updateColumVisibility()514 { 515 UI ActivityOverviewAccessibleProxyModel *pProxyModel = qobject_cast<UIActivityOverviewAccessibleProxyModel*>(model());536 void UIVMActivityOverviewTableView::updateColumVisibility() 537 { 538 UIVMActivityOverviewProxyModel *pProxyModel = qobject_cast<UIVMActivityOverviewProxyModel*>(model()); 516 539 if (!pProxyModel) 517 540 return; 518 UI ActivityOverviewAccessibleModel *pModel = qobject_cast<UIActivityOverviewAccessibleModel*>(pProxyModel->sourceModel());541 UIVMActivityOverviewModel *pModel = qobject_cast<UIVMActivityOverviewModel*>(pProxyModel->sourceModel()); 519 542 QHeaderView *pHeader = horizontalHeader(); 520 543 … … 531 554 } 532 555 533 int UIVMActivityOverview AccessibleTableView::selectedItemIndex() const534 { 535 UI ActivityOverviewAccessibleProxyModel *pModel = qobject_cast<UIActivityOverviewAccessibleProxyModel*>(model());556 int UIVMActivityOverviewTableView::selectedItemIndex() const 557 { 558 UIVMActivityOverviewProxyModel *pModel = qobject_cast<UIVMActivityOverviewProxyModel*>(model()); 536 559 if (!pModel) 537 560 return -1; … … 552 575 } 553 576 554 bool UIVMActivityOverview AccessibleTableView::hasSelection() const577 bool UIVMActivityOverviewTableView::hasSelection() const 555 578 { 556 579 if (!selectionModel()) … … 559 582 } 560 583 561 void UIVMActivityOverview AccessibleTableView::setMinimumColumnWidths(const QMap<int, int>& widths)584 void UIVMActivityOverviewTableView::setMinimumColumnWidths(const QMap<int, int>& widths) 562 585 { 563 586 m_minimumColumnWidths = widths; … … 565 588 } 566 589 567 void UIVMActivityOverview AccessibleTableView::resizeEvent(QResizeEvent *pEvent)590 void UIVMActivityOverviewTableView::resizeEvent(QResizeEvent *pEvent) 568 591 { 569 592 resizeHeaders(); … … 571 594 } 572 595 573 void UIVMActivityOverview AccessibleTableView::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)596 void UIVMActivityOverviewTableView::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) 574 597 { 575 598 emit sigSelectionChanged(selected, deselected); … … 577 600 } 578 601 579 void UIVMActivityOverview AccessibleTableView::mousePressEvent(QMouseEvent *pEvent)602 void UIVMActivityOverviewTableView::mousePressEvent(QMouseEvent *pEvent) 580 603 { 581 604 if (!indexAt(pEvent->position().toPoint()).isValid()) … … 584 607 } 585 608 586 void UIVMActivityOverview AccessibleTableView::resizeHeaders()609 void UIVMActivityOverviewTableView::resizeHeaders() 587 610 { 588 611 QHeaderView* pHeader = horizontalHeader(); … … 603 626 604 627 /********************************************************************************************************************************* 605 * UI ActivityOverviewAccessibleModel implementation. *628 * UIVMActivityOverviewModel implementation. * 606 629 *********************************************************************************************************************************/ 607 630 608 UI ActivityOverviewAccessibleModel::UIActivityOverviewAccessibleModel(QObject *pParent, QITableView *pView)631 UIVMActivityOverviewModel::UIVMActivityOverviewModel(QObject *pParent, QITableView *pView) 609 632 :QAbstractTableModel(pParent) 610 633 , m_pTableView(pView) … … 614 637 } 615 638 616 void UI ActivityOverviewAccessibleModel::setCloudMachineItems(const QList<UIVirtualMachineItemCloud*> &cloudItems)639 void UIVMActivityOverviewModel::setCloudMachineItems(const QList<UIVirtualMachineItemCloud*> &cloudItems) 617 640 { 618 641 QVector<QUuid> newIds; … … 626 649 newIds << id; 627 650 } 628 QVector<UI ActivityOverviewAccessibleRow*> originalItemList = m_rows;651 QVector<UIVMActivityOverviewRow*> originalItemList = m_rows; 629 652 630 653 /* Remove m_rows items that are not in @cloudItems: */ 631 QMutableVectorIterator<UI ActivityOverviewAccessibleRow*> iterator(m_rows);654 QMutableVectorIterator<UIVMActivityOverviewRow*> iterator(m_rows); 632 655 while (iterator.hasNext()) 633 656 { 634 UI ActivityOverviewAccessibleRow *pItem = iterator.next();657 UIVMActivityOverviewRow *pItem = iterator.next(); 635 658 if (!pItem->isCloudVM()) 636 659 continue; … … 656 679 } 657 680 if (!fFound) 658 m_rows.append(new UI ActivityOverviewAccessibleRowCloud(m_pTableView, id, comMachine.GetName(), comMachine));681 m_rows.append(new UIVMActivityOverviewRowCloud(m_pTableView, id, comMachine.GetName(), comMachine)); 659 682 } 660 683 … … 664 687 if (!m_rows[i] || !m_rows[i]->isCloudVM()) 665 688 continue; 666 UI ActivityOverviewAccessibleRowCloud *pItem = qobject_cast<UIActivityOverviewAccessibleRowCloud*>(m_rows[i]);689 UIVMActivityOverviewRowCloud *pItem = qobject_cast<UIVMActivityOverviewRowCloud*>(m_rows[i]); 667 690 if (!pItem) 668 691 continue; … … 671 694 } 672 695 673 void UI ActivityOverviewAccessibleModel::setColumnVisible(const QMap<int, bool>& columnVisible)696 void UIVMActivityOverviewModel::setColumnVisible(const QMap<int, bool>& columnVisible) 674 697 { 675 698 m_columnVisible = columnVisible; 676 699 } 677 700 678 bool UI ActivityOverviewAccessibleModel::columnVisible(int iColumnId) const701 bool UIVMActivityOverviewModel::columnVisible(int iColumnId) const 679 702 { 680 703 return m_columnVisible.value(iColumnId, true); … … 682 705 683 706 684 bool UI ActivityOverviewAccessibleModel::isVMRunning(int rowIndex) const707 bool UIVMActivityOverviewModel::isVMRunning(int rowIndex) const 685 708 { 686 709 if (rowIndex >= m_rows.size() || rowIndex < 0 || !m_rows[rowIndex]) … … 689 712 } 690 713 691 bool UI ActivityOverviewAccessibleModel::isCloudVM(int rowIndex) const714 bool UIVMActivityOverviewModel::isCloudVM(int rowIndex) const 692 715 { 693 716 if (rowIndex >= m_rows.size() || rowIndex < 0 || !m_rows[rowIndex]) … … 696 719 } 697 720 698 void UI ActivityOverviewAccessibleModel::setupPerformanceCollector()721 void UIVMActivityOverviewModel::setupPerformanceCollector() 699 722 { 700 723 m_nameList.clear(); … … 714 737 } 715 738 716 void UI ActivityOverviewAccessibleModel::clearData()739 void UIVMActivityOverviewModel::clearData() 717 740 { 718 741 /* We have a request to detach COM stuff, … … 726 749 } 727 750 728 UI ActivityOverviewAccessibleModel::~UIActivityOverviewAccessibleModel()751 UIVMActivityOverviewModel::~UIVMActivityOverviewModel() 729 752 { 730 753 clearData(); 731 754 } 732 755 733 void UI ActivityOverviewAccessibleModel::setShouldUpdate(bool fShouldUpdate)756 void UIVMActivityOverviewModel::setShouldUpdate(bool fShouldUpdate) 734 757 { 735 758 if (m_pLocalVMUpdateTimer) … … 742 765 } 743 766 744 int UI ActivityOverviewAccessibleModel::rowCount(const QModelIndex &parent) const767 int UIVMActivityOverviewModel::rowCount(const QModelIndex &parent) const 745 768 { 746 769 Q_UNUSED(parent); … … 748 771 } 749 772 750 int UI ActivityOverviewAccessibleModel::columnCount(const QModelIndex &parent) const773 int UIVMActivityOverviewModel::columnCount(const QModelIndex &parent) const 751 774 { 752 775 Q_UNUSED(parent); … … 758 781 } 759 782 760 QVariant UI ActivityOverviewAccessibleModel::data(const QModelIndex &index, int role) const783 QVariant UIVMActivityOverviewModel::data(const QModelIndex &index, int role) const 761 784 { 762 785 int iRow = index.row(); … … 774 797 } 775 798 776 const QMap<int, int> UI ActivityOverviewAccessibleModel::dataLengths() const799 const QMap<int, int> UIVMActivityOverviewModel::dataLengths() const 777 800 { 778 801 return m_columnDataMaxLength; 779 802 } 780 803 781 void UI ActivityOverviewAccessibleModel::initialize()804 void UIVMActivityOverviewModel::initialize() 782 805 { 783 806 for (int i = 0; i < (int)VMActivityOverviewColumn_Max; ++i) … … 786 809 if (m_pLocalVMUpdateTimer) 787 810 { 788 connect(m_pLocalVMUpdateTimer, &QTimer::timeout, this, &UI ActivityOverviewAccessibleModel::sltLocalVMUpdateTimeout);811 connect(m_pLocalVMUpdateTimer, &QTimer::timeout, this, &UIVMActivityOverviewModel::sltLocalVMUpdateTimeout); 789 812 m_pLocalVMUpdateTimer->start(1000); 790 813 } 791 814 792 815 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineStateChange, 793 this, &UI ActivityOverviewAccessibleModel::sltMachineStateChanged);816 this, &UIVMActivityOverviewModel::sltMachineStateChanged); 794 817 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineRegistered, 795 this, &UI ActivityOverviewAccessibleModel::sltMachineRegistered);818 this, &UIVMActivityOverviewModel::sltMachineRegistered); 796 819 foreach (const CMachine &comMachine, gpGlobalSession->virtualBox().GetMachines()) 797 820 { … … 802 825 } 803 826 804 void UI ActivityOverviewAccessibleModel::addRow(const QUuid& uMachineId, const QString& strMachineName, KMachineState enmState)805 { 806 //QVector<UI ActivityOverviewAccessibleRow*> m_rows;807 m_rows << new UI ActivityOverviewAccessibleRowLocal(m_pTableView, uMachineId, strMachineName, enmState);808 } 809 810 QVariant UI ActivityOverviewAccessibleModel::headerData(int section, Qt::Orientation orientation, int role) const827 void UIVMActivityOverviewModel::addRow(const QUuid& uMachineId, const QString& strMachineName, KMachineState enmState) 828 { 829 //QVector<UIVMActivityOverviewRow*> m_rows; 830 m_rows << new UIVMActivityOverviewRowLocal(m_pTableView, uMachineId, strMachineName, enmState); 831 } 832 833 QVariant UIVMActivityOverviewModel::headerData(int section, Qt::Orientation orientation, int role) const 811 834 { 812 835 if (role == Qt::DisplayRole && orientation == Qt::Horizontal) … … 815 838 } 816 839 817 void UI ActivityOverviewAccessibleModel::setColumnCaptions(const QMap<int, QString>& captions)840 void UIVMActivityOverviewModel::setColumnCaptions(const QMap<int, QString>& captions) 818 841 { 819 842 m_columnTitles = captions; … … 821 844 822 845 823 void UI ActivityOverviewAccessibleModel::sltMachineStateChanged(const QUuid &uId, const KMachineState state)846 void UIVMActivityOverviewModel::sltMachineStateChanged(const QUuid &uId, const KMachineState state) 824 847 { 825 848 int iIndex = itemIndex(uId); 826 849 if (iIndex != -1 && iIndex < m_rows.size()) 827 850 { 828 UI ActivityOverviewAccessibleRowLocal *pItem = qobject_cast<UIActivityOverviewAccessibleRowLocal*>(m_rows[iIndex]);851 UIVMActivityOverviewRowLocal *pItem = qobject_cast<UIVMActivityOverviewRowLocal*>(m_rows[iIndex]); 829 852 if (pItem) 830 853 { … … 836 859 } 837 860 838 void UI ActivityOverviewAccessibleModel::sltMachineRegistered(const QUuid &uId, bool fRegistered)861 void UIVMActivityOverviewModel::sltMachineRegistered(const QUuid &uId, bool fRegistered) 839 862 { 840 863 if (fRegistered) … … 849 872 } 850 873 851 void UI ActivityOverviewAccessibleModel::getHostRAMStats()874 void UIVMActivityOverviewModel::getHostRAMStats() 852 875 { 853 876 CHost comHost = gpGlobalSession->host(); … … 856 879 } 857 880 858 void UI ActivityOverviewAccessibleModel::sltLocalVMUpdateTimeout()881 void UIVMActivityOverviewModel::sltLocalVMUpdateTimeout() 859 882 { 860 883 /* Host's RAM usage is obtained from IHost not from IPerformanceCollector: */ … … 866 889 for (int i = 0; i < m_rows.size(); ++i) 867 890 { 868 UI ActivityOverviewAccessibleRowLocal *pItem = qobject_cast<UIActivityOverviewAccessibleRowLocal*>(m_rows[i]);891 UIVMActivityOverviewRowLocal *pItem = qobject_cast<UIVMActivityOverviewRowLocal*>(m_rows[i]); 869 892 if (!pItem || !pItem->isRunning()) 870 893 continue; … … 883 906 } 884 907 885 int UI ActivityOverviewAccessibleModel::itemIndex(const QUuid &uid)908 int UIVMActivityOverviewModel::itemIndex(const QUuid &uid) 886 909 { 887 910 for (int i = 0; i < m_rows.size(); ++i) … … 895 918 } 896 919 897 QUuid UI ActivityOverviewAccessibleModel::itemUid(int iIndex)920 QUuid UIVMActivityOverviewModel::itemUid(int iIndex) 898 921 { 899 922 if (iIndex >= m_rows.size() || !m_rows[iIndex]) … … 902 925 } 903 926 904 void UI ActivityOverviewAccessibleModel::removeRow(const QUuid& uMachineId)927 void UIVMActivityOverviewModel::removeRow(const QUuid& uMachineId) 905 928 { 906 929 int iIndex = itemIndex(uMachineId); … … 911 934 } 912 935 913 void UI ActivityOverviewAccessibleModel::queryPerformanceCollector()936 void UIVMActivityOverviewModel::queryPerformanceCollector() 914 937 { 915 938 QVector<QString> aReturnNames; … … 949 972 continue; 950 973 951 UI ActivityOverviewAccessibleRowLocal *pItem = qobject_cast<UIActivityOverviewAccessibleRowLocal*>(m_rows[iIndex]);974 UIVMActivityOverviewRowLocal *pItem = qobject_cast<UIVMActivityOverviewRowLocal*>(m_rows[iIndex]); 952 975 if (!pItem) 953 976 continue; … … 998 1021 999 1022 /********************************************************************************************************************************* 1000 * UI ActivityOverviewAccessibleProxyModel implementation. *1023 * UIVMActivityOverviewProxyModel implementation. * 1001 1024 *********************************************************************************************************************************/ 1002 UI ActivityOverviewAccessibleProxyModel::UIActivityOverviewAccessibleProxyModel(QObject *pParent /* = 0 */)1025 UIVMActivityOverviewProxyModel::UIVMActivityOverviewProxyModel(QObject *pParent /* = 0 */) 1003 1026 : QSortFilterProxyModel(pParent) 1004 1027 { 1005 1028 } 1006 1029 1007 void UI ActivityOverviewAccessibleProxyModel::dataUpdate()1030 void UIVMActivityOverviewProxyModel::dataUpdate() 1008 1031 { 1009 1032 if (sourceModel()) … … 1012 1035 } 1013 1036 1014 void UI ActivityOverviewAccessibleProxyModel::setNotRunningVMVisibility(bool fShow)1037 void UIVMActivityOverviewProxyModel::setNotRunningVMVisibility(bool fShow) 1015 1038 { 1016 1039 if (m_fShowNotRunningVMs == fShow) … … 1021 1044 1022 1045 1023 void UI ActivityOverviewAccessibleProxyModel::setCloudVMVisibility(bool fShow)1046 void UIVMActivityOverviewProxyModel::setCloudVMVisibility(bool fShow) 1024 1047 { 1025 1048 if (m_fShowCloudVMs == fShow) … … 1029 1052 } 1030 1053 1031 bool UI ActivityOverviewAccessibleProxyModel::filterAcceptsRow(int iSourceRow, const QModelIndex &sourceParent) const1054 bool UIVMActivityOverviewProxyModel::filterAcceptsRow(int iSourceRow, const QModelIndex &sourceParent) const 1032 1055 { 1033 1056 Q_UNUSED(sourceParent); 1034 1057 if (m_fShowNotRunningVMs && m_fShowCloudVMs) 1035 1058 return true; 1036 UI ActivityOverviewAccessibleModel *pModel = qobject_cast<UIActivityOverviewAccessibleModel*>(sourceModel());1059 UIVMActivityOverviewModel *pModel = qobject_cast<UIVMActivityOverviewModel*>(sourceModel()); 1037 1060 if (!pModel) 1038 1061 return true; … … 1045 1068 } 1046 1069 1047 bool UI ActivityOverviewAccessibleProxyModel::lessThan(const QModelIndex &sourceLeftIndex, const QModelIndex &sourceRightIndex) const1048 { 1049 UI ActivityOverviewAccessibleModel *pModel = qobject_cast<UIActivityOverviewAccessibleModel*>(sourceModel());1070 bool UIVMActivityOverviewProxyModel::lessThan(const QModelIndex &sourceLeftIndex, const QModelIndex &sourceRightIndex) const 1071 { 1072 UIVMActivityOverviewModel *pModel = qobject_cast<UIVMActivityOverviewModel*>(sourceModel()); 1050 1073 if (pModel) 1051 1074 { … … 1074 1097 1075 1098 /********************************************************************************************************************************* 1076 * UI ActivityOverviewAccessibleRow implementation. *1099 * UIVMActivityOverviewRow implementation. * 1077 1100 *********************************************************************************************************************************/ 1078 1101 1079 UI ActivityOverviewAccessibleRow::UIActivityOverviewAccessibleRow(QITableView *pTableView, const QUuid &uMachineId,1102 UIVMActivityOverviewRow::UIVMActivityOverviewRow(QITableView *pTableView, const QUuid &uMachineId, 1080 1103 const QString &strMachineName) 1081 1104 : QITableViewRow(pTableView) … … 1087 1110 } 1088 1111 1089 int UI ActivityOverviewAccessibleRow::childCount() const1112 int UIVMActivityOverviewRow::childCount() const 1090 1113 { 1091 1114 return m_cells.size(); 1092 1115 } 1093 1116 1094 QITableViewCell *UI ActivityOverviewAccessibleRow::childItem(int iIndex) const1117 QITableViewCell *UIVMActivityOverviewRow::childItem(int iIndex) const 1095 1118 { 1096 1119 return m_cells.value(iIndex, 0); 1097 1120 } 1098 1121 1099 QString UI ActivityOverviewAccessibleRow::cellText(int iColumn) const1122 QString UIVMActivityOverviewRow::cellText(int iColumn) const 1100 1123 { 1101 1124 if (!m_cells.contains(iColumn)) … … 1106 1129 } 1107 1130 1108 int UI ActivityOverviewAccessibleRow::columnLength(int iColumnIndex) const1109 { 1110 UI ActivityOverviewAccessibleCell *pCell = m_cells.value(iColumnIndex, 0);1131 int UIVMActivityOverviewRow::columnLength(int iColumnIndex) const 1132 { 1133 UIVMActivityOverviewCell *pCell = m_cells.value(iColumnIndex, 0); 1111 1134 if (!pCell) 1112 1135 return 0; … … 1114 1137 } 1115 1138 1116 UI ActivityOverviewAccessibleRow::~UIActivityOverviewAccessibleRow()1139 UIVMActivityOverviewRow::~UIVMActivityOverviewRow() 1117 1140 { 1118 1141 qDeleteAll(m_cells); 1119 1142 } 1120 1143 1121 void UI ActivityOverviewAccessibleRow::initCells()1144 void UIVMActivityOverviewRow::initCells() 1122 1145 { 1123 1146 for (int i = (int) VMActivityOverviewColumn_Name; i < (int) VMActivityOverviewColumn_Max; ++i) 1124 m_cells[i] = new UI ActivityOverviewAccessibleCell(this, i);1147 m_cells[i] = new UIVMActivityOverviewCell(this, i); 1125 1148 m_cells[VMActivityOverviewColumn_Name]->setText(m_strMachineName); 1126 1149 } 1127 1150 1128 const QUuid &UI ActivityOverviewAccessibleRow::machineId() const1151 const QUuid &UIVMActivityOverviewRow::machineId() const 1129 1152 { 1130 1153 return m_uMachineId; 1131 1154 } 1132 1155 1133 void UI ActivityOverviewAccessibleRow::updateCellText(int /*VMActivityOverviewColumn*/ enmColumnIndex, const QString &strText)1156 void UIVMActivityOverviewRow::updateCellText(int /*VMActivityOverviewColumn*/ enmColumnIndex, const QString &strText) 1134 1157 { 1135 1158 if (m_cells.value(enmColumnIndex, 0)) … … 1139 1162 1140 1163 /********************************************************************************************************************************* 1141 * UI ActivityOverviewAccessibleCell implementation. *1164 * UIVMActivityOverviewCell implementation. * 1142 1165 *********************************************************************************************************************************/ 1143 1166 1144 UI ActivityOverviewAccessibleCell::UIActivityOverviewAccessibleCell(QITableViewRow *pRow, int iColumnIndex)1167 UIVMActivityOverviewCell::UIVMActivityOverviewCell(QITableViewRow *pRow, int iColumnIndex) 1145 1168 :QITableViewCell(pRow) 1146 1169 , m_iColumnIndex(iColumnIndex) … … 1148 1171 } 1149 1172 1150 QString UI ActivityOverviewAccessibleCell::text() const1173 QString UIVMActivityOverviewCell::text() const 1151 1174 { 1152 1175 return m_strText; 1153 1176 } 1154 1177 1155 int UI ActivityOverviewAccessibleCell::columnLength(int /*iColumnIndex*/) const1178 int UIVMActivityOverviewCell::columnLength(int /*iColumnIndex*/) const 1156 1179 { 1157 1180 return 0; … … 1159 1182 } 1160 1183 1161 void UI ActivityOverviewAccessibleCell::setText(const QString &strText)1184 void UIVMActivityOverviewCell::setText(const QString &strText) 1162 1185 { 1163 1186 m_strText = strText; -
trunk/src/VBox/Frontends/VirtualBox/src/activity/overview/UIVMActivityOverviewModelView.h
r104969 r104970 47 47 48 48 class QTimer; 49 class UI ActivityOverviewAccessibleCell;50 class UI ActivityOverviewAccessibleRow;51 class UI ActivityOverviewAccessibleRowCloud;49 class UIVMActivityOverviewCell; 50 class UIVMActivityOverviewRow; 51 class UIVMActivityOverviewRowCloud; 52 52 class UIVirtualMachineItemCloud; 53 53 … … 72 72 73 73 74 class UIVMActivityOverview AccessibleTableView : public QITableView74 class UIVMActivityOverviewTableView : public QITableView 75 75 { 76 76 Q_OBJECT; … … 82 82 public: 83 83 84 UIVMActivityOverview AccessibleTableView(QWidget *pParent);84 UIVMActivityOverviewTableView(QWidget *pParent); 85 85 void setMinimumColumnWidths(const QMap<int, int>& widths); 86 86 void updateColumVisibility(); … … 103 103 104 104 105 class UI ActivityOverviewAccessibleProxyModel : public QSortFilterProxyModel105 class UIVMActivityOverviewProxyModel : public QSortFilterProxyModel 106 106 { 107 107 … … 110 110 public: 111 111 112 UI ActivityOverviewAccessibleProxyModel(QObject *parent = 0);112 UIVMActivityOverviewProxyModel(QObject *parent = 0); 113 113 void dataUpdate(); 114 114 void setNotRunningVMVisibility(bool fShow); … … 127 127 }; 128 128 129 class UIActivityOverviewAccessibleCell : public QITableViewCell 130 { 131 132 Q_OBJECT; 133 134 public: 135 136 UIActivityOverviewAccessibleCell(QITableViewRow *pRow, int iColumnIndex); 137 virtual QString text() const RT_OVERRIDE RT_FINAL; 138 int columnLength(int iColumnIndex) const; 139 void setText(const QString &strText); 140 141 private: 142 143 /* VMActivityOverviewColumn enum: */ 144 int m_iColumnIndex; 145 QString m_strText; 146 }; 147 148 149 150 151 class UIActivityOverviewAccessibleModel : public QAbstractTableModel 129 class UIVMActivityOverviewModel : public QAbstractTableModel 152 130 { 153 131 Q_OBJECT; … … 160 138 public: 161 139 162 ~UI ActivityOverviewAccessibleModel();163 UI ActivityOverviewAccessibleModel(QObject *pParent, QITableView *pView);140 ~UIVMActivityOverviewModel(); 141 UIVMActivityOverviewModel(QObject *pParent, QITableView *pView); 164 142 int rowCount(const QModelIndex &parent = QModelIndex()) const RT_OVERRIDE RT_FINAL; 165 143 int columnCount(const QModelIndex &parent = QModelIndex()) const RT_OVERRIDE RT_FINAL; … … 192 170 void queryPerformanceCollector(); 193 171 void getHostRAMStats(); 194 QVector<UI ActivityOverviewAccessibleRow*> m_rows;172 QVector<UIVMActivityOverviewRow*> m_rows; 195 173 QITableView *m_pTableView; 196 174 QMap<int, QString> m_columnTitles; 197 175 QMap<int, bool> m_columnVisible; 198 176 QTimer *m_pLocalVMUpdateTimer; 199 /** Maximum length of string length of data displayed in column. Updated in UI ActivityOverviewModel::data(..). */177 /** Maximum length of string length of data displayed in column. Updated in UIVMActivityOverviewModel::data(..). */ 200 178 mutable QMap<int, int> m_columnDataMaxLength; 201 179 CPerformanceCollector m_performanceCollector; -
trunk/src/VBox/Frontends/VirtualBox/src/activity/overview/UIVMActivityOverviewWidget.cpp
r104965 r104970 162 162 163 163 /********************************************************************************************************************************* 164 * Class UI ActivityOverviewItem definition. *164 * Class UIVMActivityOverviewItem definition. * 165 165 *********************************************************************************************************************************/ 166 /** Each instance of UI ActivityOverviewItem corresponds to a vm. they are owned my the model. */167 class UI ActivityOverviewItem : public QObject166 /** Each instance of UIVMActivityOverviewItem corresponds to a vm. they are owned my the model. */ 167 class UIVMActivityOverviewItem : public QObject 168 168 { 169 169 … … 172 172 public: 173 173 174 UI ActivityOverviewItem(QObject *pParent, const QUuid &uid, const QString &strVMName);175 176 UI ActivityOverviewItem();177 virtual ~UI ActivityOverviewItem();178 bool operator==(const UI ActivityOverviewItem& other) const;174 UIVMActivityOverviewItem(QObject *pParent, const QUuid &uid, const QString &strVMName); 175 176 UIVMActivityOverviewItem(); 177 virtual ~UIVMActivityOverviewItem(); 178 bool operator==(const UIVMActivityOverviewItem& other) const; 179 179 int columnLength(int iColumnIndex) const; 180 180 const QUuid &machineId() const; … … 202 202 }; 203 203 204 Q_DECLARE_METATYPE(UI ActivityOverviewItem);204 Q_DECLARE_METATYPE(UIVMActivityOverviewItem); 205 205 206 206 /********************************************************************************************************************************* 207 * Class UI ActivityOverviewItemLocal definition. *207 * Class UIVMActivityOverviewItemLocal definition. * 208 208 *********************************************************************************************************************************/ 209 /* A UI ActivityOverviewItem derivation to show local vms in the table view: */210 class UI ActivityOverviewItemLocal : public UIActivityOverviewItem209 /* A UIVMActivityOverviewItem derivation to show local vms in the table view: */ 210 class UIVMActivityOverviewItemLocal : public UIVMActivityOverviewItem 211 211 { 212 212 Q_OBJECT; 213 213 public: 214 214 215 UI ActivityOverviewItemLocal(QObject *pParent, const QUuid &uid, const QString &strVMName);216 UI ActivityOverviewItemLocal();217 ~UI ActivityOverviewItemLocal();215 UIVMActivityOverviewItemLocal(QObject *pParent, const QUuid &uid, const QString &strVMName); 216 UIVMActivityOverviewItemLocal(); 217 ~UIVMActivityOverviewItemLocal(); 218 218 219 219 bool isWithGuestAdditions(); … … 240 240 241 241 /********************************************************************************************************************************* 242 * Class UI ActivityOverviewItemCloud definition. *242 * Class UIVMActivityOverviewItemCloud definition. * 243 243 *********************************************************************************************************************************/ 244 /* A UI ActivityOverviewItem derivation to show cloud vms in the table view: */245 class UI ActivityOverviewItemCloud : public UIActivityOverviewItem244 /* A UIVMActivityOverviewItem derivation to show cloud vms in the table view: */ 245 class UIVMActivityOverviewItemCloud : public UIVMActivityOverviewItem 246 246 { 247 247 Q_OBJECT; 248 248 public: 249 249 250 UI ActivityOverviewItemCloud(QObject *pParent, const QUuid &uid, const QString &strVMName, CCloudMachine &comCloudMachine);251 252 UI ActivityOverviewItemCloud();253 ~UI ActivityOverviewItemCloud();250 UIVMActivityOverviewItemCloud(QObject *pParent, const QUuid &uid, const QString &strVMName, CCloudMachine &comCloudMachine); 251 252 UIVMActivityOverviewItemCloud(); 253 ~UIVMActivityOverviewItemCloud(); 254 254 void updateMachineState(); 255 255 virtual bool isRunning() const RT_OVERRIDE; … … 598 598 599 599 /********************************************************************************************************************************* 600 * Class UI ActivityOverviewItem implementation. *600 * Class UIVMActivityOverviewItem implementation. * 601 601 *********************************************************************************************************************************/ 602 UI ActivityOverviewItem::UIActivityOverviewItem(QObject *pParent, const QUuid &uid, const QString &strVMName)602 UIVMActivityOverviewItem::UIVMActivityOverviewItem(QObject *pParent, const QUuid &uid, const QString &strVMName) 603 603 : QObject(pParent) 604 604 , m_uTotalRAM(0) … … 612 612 } 613 613 614 UI ActivityOverviewItem::UIActivityOverviewItem()614 UIVMActivityOverviewItem::UIVMActivityOverviewItem() 615 615 : QObject() 616 616 , m_uTotalRAM(0) … … 622 622 } 623 623 624 UI ActivityOverviewItem::~UIActivityOverviewItem()625 { 626 } 627 628 bool UI ActivityOverviewItem::operator==(const UIActivityOverviewItem& other) const624 UIVMActivityOverviewItem::~UIVMActivityOverviewItem() 625 { 626 } 627 628 bool UIVMActivityOverviewItem::operator==(const UIVMActivityOverviewItem& other) const 629 629 { 630 630 if (m_VMuid == other.m_VMuid) … … 633 633 } 634 634 635 QString UI ActivityOverviewItem::columnData(int iColumnIndex) const635 QString UIVMActivityOverviewItem::columnData(int iColumnIndex) const 636 636 { 637 637 return m_columnData.value(iColumnIndex, QString()); 638 638 } 639 639 640 int UI ActivityOverviewItem::columnLength(int iColumnIndex) const640 int UIVMActivityOverviewItem::columnLength(int iColumnIndex) const 641 641 { 642 642 return m_columnData.value(iColumnIndex, QString()).length(); 643 643 } 644 644 645 const QUuid &UI ActivityOverviewItem::machineId() const645 const QUuid &UIVMActivityOverviewItem::machineId() const 646 646 { 647 647 return m_VMuid; … … 666 666 667 667 /********************************************************************************************************************************* 668 * Class UI ActivityOverviewItemCloud implementation. *668 * Class UIVMActivityOverviewItemCloud implementation. * 669 669 *********************************************************************************************************************************/ 670 670 671 UI ActivityOverviewItemCloud::UIActivityOverviewItemCloud(QObject *pParent, const QUuid &uid, const QString &strVMName, CCloudMachine &comCloudMachine)672 : UI ActivityOverviewItem(pParent, uid, strVMName)671 UIVMActivityOverviewItemCloud::UIVMActivityOverviewItemCloud(QObject *pParent, const QUuid &uid, const QString &strVMName, CCloudMachine &comCloudMachine) 672 : UIVMActivityOverviewItem(pParent, uid, strVMName) 673 673 , m_comCloudMachine(comCloudMachine) 674 674 { … … 677 677 if (m_pTimer) 678 678 { 679 connect(m_pTimer, &QTimer::timeout, this, &UI ActivityOverviewItemCloud::sltTimeout);679 connect(m_pTimer, &QTimer::timeout, this, &UIVMActivityOverviewItemCloud::sltTimeout); 680 680 m_pTimer->setInterval(60 * 1000); 681 681 } … … 683 683 } 684 684 685 UI ActivityOverviewItemCloud::UIActivityOverviewItemCloud()686 { 687 } 688 689 UI ActivityOverviewItemCloud::~UIActivityOverviewItemCloud()690 { 691 } 692 693 void UI ActivityOverviewItemCloud::updateMachineState()685 UIVMActivityOverviewItemCloud::UIVMActivityOverviewItemCloud() 686 { 687 } 688 689 UIVMActivityOverviewItemCloud::~UIVMActivityOverviewItemCloud() 690 { 691 } 692 693 void UIVMActivityOverviewItemCloud::updateMachineState() 694 694 { 695 695 if (m_comCloudMachine.isOk()) … … 697 697 } 698 698 699 bool UI ActivityOverviewItemCloud::isRunning() const699 bool UIVMActivityOverviewItemCloud::isRunning() const 700 700 { 701 701 return m_enmMachineState == KCloudMachineState_Running; 702 702 } 703 703 704 bool UI ActivityOverviewItemCloud::isCloudVM() const704 bool UIVMActivityOverviewItemCloud::isCloudVM() const 705 705 { 706 706 return true; 707 707 } 708 708 709 QString UI ActivityOverviewItemCloud::machineStateString() const709 QString UIVMActivityOverviewItemCloud::machineStateString() const 710 710 { 711 711 if (!m_comCloudMachine.isOk()) … … 714 714 } 715 715 716 void UI ActivityOverviewItemCloud::sltTimeout()716 void UIVMActivityOverviewItemCloud::sltTimeout() 717 717 { 718 718 int iDataSize = 1; … … 722 722 enmMetricType, iDataSize); 723 723 connect(pTask, &UIProgressTaskReadCloudMachineMetricData::sigMetricDataReceived, 724 this, &UI ActivityOverviewItemCloud::sltMetricDataReceived);724 this, &UIVMActivityOverviewItemCloud::sltMetricDataReceived); 725 725 pTask->start(); 726 726 } 727 727 } 728 728 729 void UI ActivityOverviewItemCloud::sltMetricDataReceived(KMetricType enmMetricType,729 void UIVMActivityOverviewItemCloud::sltMetricDataReceived(KMetricType enmMetricType, 730 730 const QVector<QString> &data, const QVector<QString> &timeStamps) 731 731 { … … 777 777 } 778 778 779 void UI ActivityOverviewItemCloud::setMachineState(int iState)779 void UIVMActivityOverviewItemCloud::setMachineState(int iState) 780 780 { 781 781 if (iState <= KCloudMachineState_Invalid || iState >= KCloudMachineState_Max) … … 798 798 } 799 799 800 void UI ActivityOverviewItemCloud::resetColumData()800 void UIVMActivityOverviewItemCloud::resetColumData() 801 801 { 802 802 for (int i = (int) VMActivityOverviewColumn_CPUGuestLoad; … … 805 805 } 806 806 807 void UI ActivityOverviewItemCloud::getMetricList()807 void UIVMActivityOverviewItemCloud::getMetricList() 808 808 { 809 809 if (!isRunning()) … … 813 813 AssertPtrReturnVoid(pReadListProgressTask); 814 814 connect(pReadListProgressTask, &UIProgressTaskReadCloudMachineMetricList::sigMetricListReceived, 815 this, &UI ActivityOverviewItemCloud::sltMetricNameListingComplete);815 this, &UIVMActivityOverviewItemCloud::sltMetricNameListingComplete); 816 816 pReadListProgressTask->start(); 817 817 } 818 818 819 void UI ActivityOverviewItemCloud::sltMetricNameListingComplete(QVector<QString> metricNameList)819 void UIVMActivityOverviewItemCloud::sltMetricNameListingComplete(QVector<QString> metricNameList) 820 820 { 821 821 AssertReturnVoid(m_pTimer); … … 843 843 844 844 /********************************************************************************************************************************* 845 * Class UI ActivityOverviewItemLocal implementation. *845 * Class UIVMActivityOverviewItemLocal implementation. * 846 846 *********************************************************************************************************************************/ 847 UI ActivityOverviewItemLocal::UIActivityOverviewItemLocal(QObject *pParent, const QUuid &uid, const QString &strVMName)848 : UI ActivityOverviewItem(pParent, uid, strVMName)847 UIVMActivityOverviewItemLocal::UIVMActivityOverviewItemLocal(QObject *pParent, const QUuid &uid, const QString &strVMName) 848 : UIVMActivityOverviewItem(pParent, uid, strVMName) 849 849 , m_enmMachineState(KMachineState_Null) 850 850 , m_uVMExitTotal(0) … … 858 858 } 859 859 860 UI ActivityOverviewItemLocal::UIActivityOverviewItemLocal()860 UIVMActivityOverviewItemLocal::UIVMActivityOverviewItemLocal() 861 861 : m_enmMachineState(KMachineState_Null) 862 862 , m_uVMExitTotal(0) … … 868 868 } 869 869 870 UI ActivityOverviewItemLocal::~UIActivityOverviewItemLocal()870 UIVMActivityOverviewItemLocal::~UIVMActivityOverviewItemLocal() 871 871 { 872 872 if (!m_comSession.isNull()) … … 874 874 } 875 875 876 bool UI ActivityOverviewItemLocal::isWithGuestAdditions()876 bool UIVMActivityOverviewItemLocal::isWithGuestAdditions() 877 877 { 878 878 if (m_comGuest.isNull()) … … 881 881 } 882 882 883 void UI ActivityOverviewItemLocal::resetDebugger()883 void UIVMActivityOverviewItemLocal::resetDebugger() 884 884 { 885 885 m_comSession = uiCommon().openSession(m_VMuid, KLockType_Shared); … … 895 895 } 896 896 897 bool UI ActivityOverviewItemLocal::isRunning() const897 bool UIVMActivityOverviewItemLocal::isRunning() const 898 898 { 899 899 return m_enmMachineState == KMachineState_Running; 900 900 } 901 901 902 bool UI ActivityOverviewItemLocal::isCloudVM() const902 bool UIVMActivityOverviewItemLocal::isCloudVM() const 903 903 { 904 904 return false; 905 905 } 906 906 907 void UI ActivityOverviewItemLocal::setMachineState(int iState)907 void UIVMActivityOverviewItemLocal::setMachineState(int iState) 908 908 { 909 909 if (iState <= KMachineState_Null || iState >= KMachineState_Max) … … 917 917 } 918 918 919 void UI ActivityOverviewItemLocal::updateColumnData()919 void UIVMActivityOverviewItemLocal::updateColumnData() 920 920 { 921 921 AssertReturnVoid(m_comDebugger.isOk()); … … 988 988 } 989 989 990 QString UI ActivityOverviewItemLocal::machineStateString() const990 QString UIVMActivityOverviewItemLocal::machineStateString() const 991 991 { 992 992 return gpConverter->toString(m_enmMachineState); … … 1005 1005 , m_fShowToolbar(fShowToolbar) 1006 1006 , m_pToolBar(0) 1007 , m_p AccessibleTableView(0)1008 , m_p AccessibleProxyModel(0)1009 , m_p AccessibleModel(0)1007 , m_pTableView(0) 1008 , m_pProxyModel(0) 1009 , m_pModel(0) 1010 1010 , m_pColumnVisibilityToggleMenu(0) 1011 1011 , m_pHostStatsWidget(0) … … 1036 1036 { 1037 1037 m_fIsCurrentTool = fIsCurrentTool; 1038 if (m_p AccessibleModel)1039 m_p AccessibleModel->setShouldUpdate(fIsCurrentTool);1038 if (m_pModel) 1039 m_pModel->setShouldUpdate(fIsCurrentTool); 1040 1040 } 1041 1041 1042 1042 void UIVMActivityOverviewWidget::setCloudMachineItems(const QList<UIVirtualMachineItemCloud*> &cloudItems) 1043 1043 { 1044 if (m_p AccessibleModel)1045 m_p AccessibleModel->setCloudMachineItems(cloudItems);1044 if (m_pModel) 1045 m_pModel->setCloudMachineItems(cloudItems); 1046 1046 } 1047 1047 … … 1065 1065 updateColumnsMenu(); 1066 1066 1067 if (m_p AccessibleModel)1068 m_p AccessibleModel->setColumnCaptions(m_columnTitles);1067 if (m_pModel) 1068 m_pModel->setColumnCaptions(m_columnTitles); 1069 1069 1070 1070 computeMinimumColumnWidths(); … … 1073 1073 void UIVMActivityOverviewWidget::showEvent(QShowEvent *pEvent) 1074 1074 { 1075 if (m_pVMActivityMonitorAction && m_p AccessibleTableView)1076 m_pVMActivityMonitorAction->setEnabled(m_p AccessibleTableView->hasSelection());1075 if (m_pVMActivityMonitorAction && m_pTableView) 1076 m_pVMActivityMonitorAction->setEnabled(m_pTableView->hasSelection()); 1077 1077 1078 1078 QWidget::showEvent(pEvent); … … 1127 1127 layout()->addWidget(m_pHostStatsWidget); 1128 1128 1129 m_p AccessibleProxyModel = new UIActivityOverviewAccessibleProxyModel(this);1130 m_p AccessibleTableView = new UIVMActivityOverviewAccessibleTableView(this);1131 m_p AccessibleModel = new UIActivityOverviewAccessibleModel(this, m_pAccessibleTableView);1132 m_p AccessibleProxyModel->setSourceModel(m_pAccessibleModel);1133 m_p AccessibleProxyModel->setNotRunningVMVisibility(m_fShowNotRunningVMs);1134 m_p AccessibleProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);1135 m_p AccessibleTableView->setModel(m_pAccessibleProxyModel);1136 1137 m_p AccessibleTableView->setItemDelegate(new UIVMActivityOverviewDelegate(this));1138 m_p AccessibleTableView->setSelectionMode(QAbstractItemView::SingleSelection);1139 m_p AccessibleTableView->setSelectionBehavior(QAbstractItemView::SelectRows);1140 m_p AccessibleTableView->setShowGrid(false);1141 m_p AccessibleTableView->setContextMenuPolicy(Qt::CustomContextMenu);1142 m_p AccessibleTableView->horizontalHeader()->setHighlightSections(false);1143 m_p AccessibleTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);1144 m_p AccessibleTableView->verticalHeader()->setVisible(false);1145 m_p AccessibleTableView->setEditTriggers(QAbstractItemView::NoEditTriggers);1129 m_pProxyModel = new UIVMActivityOverviewProxyModel(this); 1130 m_pTableView = new UIVMActivityOverviewTableView(this); 1131 m_pModel = new UIVMActivityOverviewModel(this, m_pTableView); 1132 m_pProxyModel->setSourceModel(m_pModel); 1133 m_pProxyModel->setNotRunningVMVisibility(m_fShowNotRunningVMs); 1134 m_pProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); 1135 m_pTableView->setModel(m_pProxyModel); 1136 1137 m_pTableView->setItemDelegate(new UIVMActivityOverviewDelegate(this)); 1138 m_pTableView->setSelectionMode(QAbstractItemView::SingleSelection); 1139 m_pTableView->setSelectionBehavior(QAbstractItemView::SelectRows); 1140 m_pTableView->setShowGrid(false); 1141 m_pTableView->setContextMenuPolicy(Qt::CustomContextMenu); 1142 m_pTableView->horizontalHeader()->setHighlightSections(false); 1143 m_pTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed); 1144 m_pTableView->verticalHeader()->setVisible(false); 1145 m_pTableView->setEditTriggers(QAbstractItemView::NoEditTriggers); 1146 1146 /* Minimize the row height: */ 1147 m_p AccessibleTableView->verticalHeader()->setDefaultSectionSize(m_pAccessibleTableView->verticalHeader()->minimumSectionSize());1148 m_p AccessibleTableView->setAlternatingRowColors(true);1149 m_p AccessibleTableView->setSortingEnabled(true);1150 m_p AccessibleTableView->sortByColumn(0, Qt::AscendingOrder);1151 1152 connect(m_p AccessibleTableView, &UIVMActivityOverviewAccessibleTableView::customContextMenuRequested,1147 m_pTableView->verticalHeader()->setDefaultSectionSize(m_pTableView->verticalHeader()->minimumSectionSize()); 1148 m_pTableView->setAlternatingRowColors(true); 1149 m_pTableView->setSortingEnabled(true); 1150 m_pTableView->sortByColumn(0, Qt::AscendingOrder); 1151 1152 connect(m_pTableView, &UIVMActivityOverviewTableView::customContextMenuRequested, 1153 1153 this, &UIVMActivityOverviewWidget::sltHandleTableContextMenuRequest); 1154 connect(m_p AccessibleTableView, &UIVMActivityOverviewAccessibleTableView::sigSelectionChanged,1154 connect(m_pTableView, &UIVMActivityOverviewTableView::sigSelectionChanged, 1155 1155 this, &UIVMActivityOverviewWidget::sltHandleTableSelectionChanged); 1156 connect(m_p AccessibleModel, &UIActivityOverviewAccessibleModel::sigDataUpdate,1156 connect(m_pModel, &UIVMActivityOverviewModel::sigDataUpdate, 1157 1157 this, &UIVMActivityOverviewWidget::sltHandleDataUpdate); 1158 connect(m_p AccessibleModel, &UIActivityOverviewAccessibleModel::sigHostStatsUpdate,1158 connect(m_pModel, &UIVMActivityOverviewModel::sigHostStatsUpdate, 1159 1159 this, &UIVMActivityOverviewWidget::sltHandleHostStatsUpdate); 1160 1160 1161 1161 updateModelColumVisibilityCache(); 1162 layout()->addWidget(m_p AccessibleTableView);1162 layout()->addWidget(m_pTableView); 1163 1163 } 1164 1164 … … 1243 1243 void UIVMActivityOverviewWidget::sltClearCOMData() 1244 1244 { 1245 if (m_p AccessibleModel)1246 m_p AccessibleModel->clearData();1245 if (m_pModel) 1246 m_pModel->clearData(); 1247 1247 } 1248 1248 … … 1272 1272 { 1273 1273 computeMinimumColumnWidths(); 1274 if (m_p AccessibleProxyModel)1275 m_p AccessibleProxyModel->dataUpdate();1274 if (m_pProxyModel) 1275 m_pProxyModel->dataUpdate(); 1276 1276 } 1277 1277 1278 1278 void UIVMActivityOverviewWidget::sltHandleTableContextMenuRequest(const QPoint &pos) 1279 1279 { 1280 if (!m_p AccessibleTableView)1280 if (!m_pTableView) 1281 1281 return; 1282 1282 … … 1300 1300 this, &UIVMActivityOverviewWidget::sltCloudVMVisibility); 1301 1301 1302 menu.exec(m_p AccessibleTableView->mapToGlobal(pos));1302 menu.exec(m_pTableView->mapToGlobal(pos)); 1303 1303 } 1304 1304 … … 1306 1306 { 1307 1307 Q_UNUSED(deselected); 1308 if (!m_pVMActivityMonitorAction || !m_p AccessibleModel || !m_pAccessibleProxyModel)1308 if (!m_pVMActivityMonitorAction || !m_pModel || !m_pProxyModel) 1309 1309 return; 1310 1310 … … 1314 1314 return; 1315 1315 } 1316 int iMachineIndex = m_p AccessibleProxyModel->mapToSource(selected.indexes()[0]).row();1317 if (!m_p AccessibleModel->isVMRunning(iMachineIndex))1316 int iMachineIndex = m_pProxyModel->mapToSource(selected.indexes()[0]).row(); 1317 if (!m_pModel->isVMRunning(iMachineIndex)) 1318 1318 { 1319 1319 m_pVMActivityMonitorAction->setEnabled(false); … … 1325 1325 void UIVMActivityOverviewWidget::sltHandleShowVMActivityMonitor() 1326 1326 { 1327 if (!m_p AccessibleTableView || !m_pAccessibleModel)1328 return; 1329 const QUuid uMachineId = m_p AccessibleModel->itemUid(m_pAccessibleTableView->selectedItemIndex());1327 if (!m_pTableView || !m_pModel) 1328 return; 1329 const QUuid uMachineId = m_pModel->itemUid(m_pTableView->selectedItemIndex()); 1330 1330 if (uMachineId.isNull()) 1331 1331 return; … … 1336 1336 { 1337 1337 m_fShowNotRunningVMs = fShow; 1338 if (m_p AccessibleProxyModel)1339 m_p AccessibleProxyModel->setNotRunningVMVisibility(m_fShowNotRunningVMs);1338 if (m_pProxyModel) 1339 m_pProxyModel->setNotRunningVMVisibility(m_fShowNotRunningVMs); 1340 1340 } 1341 1341 … … 1343 1343 { 1344 1344 m_fShowCloudVMs = fShow; 1345 if (m_p AccessibleProxyModel)1346 m_p AccessibleProxyModel->setCloudVMVisibility(m_fShowCloudVMs);1345 if (m_pProxyModel) 1346 m_pProxyModel->setCloudVMVisibility(m_fShowCloudVMs); 1347 1347 } 1348 1348 … … 1357 1357 void UIVMActivityOverviewWidget::updateModelColumVisibilityCache() 1358 1358 { 1359 if (m_p AccessibleModel)1360 m_p AccessibleModel->setColumnVisible(m_columnVisible);1359 if (m_pModel) 1360 m_pModel->setColumnVisible(m_columnVisible); 1361 1361 /* Notify the table view for the changed column visibility: */ 1362 if (m_p AccessibleTableView)1363 m_p AccessibleTableView->updateColumVisibility();1362 if (m_pTableView) 1363 m_pTableView->updateColumVisibility(); 1364 1364 } 1365 1365 1366 1366 void UIVMActivityOverviewWidget::computeMinimumColumnWidths() 1367 1367 { 1368 if (!m_p AccessibleTableView || !m_pAccessibleModel)1369 return; 1370 QFontMetrics fontMetrics(m_p AccessibleTableView->font());1371 const QMap<int, int> &columnDataStringLengths = m_p AccessibleModel->dataLengths();1368 if (!m_pTableView || !m_pModel) 1369 return; 1370 QFontMetrics fontMetrics(m_pTableView->font()); 1371 const QMap<int, int> &columnDataStringLengths = m_pModel->dataLengths(); 1372 1372 QMap<int, int> columnWidthsInPixels; 1373 1373 for (int i = 0; i < (int)VMActivityOverviewColumn_Max; ++i) … … 1381 1381 + m_iSortIndicatorWidth; 1382 1382 } 1383 m_p AccessibleTableView->setMinimumColumnWidths(columnWidthsInPixels);1383 m_pTableView->setMinimumColumnWidths(columnWidthsInPixels); 1384 1384 } 1385 1385 -
trunk/src/VBox/Frontends/VirtualBox/src/activity/overview/UIVMActivityOverviewWidget.h
r104964 r104970 48 48 class UIActionPool; 49 49 class QIToolBar; 50 class UI ActivityOverviewProxyModel;51 class UI ActivityOverviewModel;50 class UIVMActivityOverviewProxyModel; 51 class UIVMActivityOverviewModel; 52 52 class UIVirtualMachineItemCloud; 53 53 class UIVMActivityOverviewHostStats; 54 54 class UIVMActivityOverviewHostStatsWidget; 55 55 class UIVMActivityOverviewTableView; 56 class UIVMActivityOverview AccessibleTableView;57 class UI ActivityOverviewAccessibleModel;58 class UI ActivityOverviewAccessibleProxyModel;56 class UIVMActivityOverviewTableView; 57 class UIVMActivityOverviewModel; 58 class UIVMActivityOverviewProxyModel; 59 59 60 60 /** QWidget extension to display a Linux top like utility that sort running vm wrt. resource allocations. */ … … 132 132 * @{ */ 133 133 QIToolBar *m_pToolBar; 134 UIVMActivityOverview AccessibleTableView *m_pAccessibleTableView;135 UI ActivityOverviewAccessibleProxyModel *m_pAccessibleProxyModel;136 UI ActivityOverviewAccessibleModel *m_pAccessibleModel;134 UIVMActivityOverviewTableView *m_pTableView; 135 UIVMActivityOverviewProxyModel *m_pProxyModel; 136 UIVMActivityOverviewModel *m_pModel; 137 137 QMenu *m_pColumnVisibilityToggleMenu; 138 138 /* The key is the column id (VMActivityOverviewColumn) and value is column title. */
Note:
See TracChangeset
for help on using the changeset viewer.