Changeset 83452 in vbox for trunk/src/VBox
- Timestamp:
- Mar 26, 2020 7:36:19 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r82968 r83452 126 126 template<> SHARED_LIBRARY_STUFF bool canConvert<UIMediumFormat>(); 127 127 template<> SHARED_LIBRARY_STUFF bool canConvert<UISettingsDefs::RecordingMode>(); 128 template<> SHARED_LIBRARY_STUFF bool canConvert<VMResouceMonitorColumn>(); 128 129 129 130 /* Declare COM canConvert specializations: */ … … 268 269 template<> SHARED_LIBRARY_STUFF QString toString(const UISettingsDefs::RecordingMode &enmRecordingMode); 269 270 template<> SHARED_LIBRARY_STUFF UISettingsDefs::RecordingMode fromString<UISettingsDefs::RecordingMode>(const QString &enmRecordingMode); 271 template<> SHARED_LIBRARY_STUFF QString toInternalString(const VMResouceMonitorColumn &enmVMResourceMonitorColumn); 272 template<> SHARED_LIBRARY_STUFF VMResouceMonitorColumn fromInternalString<VMResouceMonitorColumn>(const QString &strVMResourceMonitorColumn); 270 273 271 274 /* Declare COM conversion specializations: */ -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r83314 r83452 80 80 template<> bool canConvert<UIMediumFormat>() { return true; } 81 81 template<> bool canConvert<UISettingsDefs::RecordingMode>() { return true; } 82 template<> bool canConvert<VMResouceMonitorColumn>(){ return true; }; 82 83 83 84 … … 2569 2570 return values.at(keys.indexOf(QRegExp(strRecordingMode, Qt::CaseInsensitive))); 2570 2571 } 2572 2573 template<> QString toInternalString(const VMResouceMonitorColumn &enmVMResourceMonitorColumn) 2574 { 2575 QString strResult; 2576 switch (enmVMResourceMonitorColumn) 2577 { 2578 case VMResouceMonitorColumn_Name: strResult = "VMName"; break; 2579 case VMResouceMonitorColumn_CPUGuestLoad: strResult = "CPUGuestLoad"; break; 2580 case VMResouceMonitorColumn_CPUVMMLoad: strResult = "CPUVMMLoad"; break; 2581 case VMResouceMonitorColumn_RAMUsedAndTotal: strResult = "RAMUsedAndTotal"; break; 2582 case VMResouceMonitorColumn_RAMUsedPercentage: strResult = "RAMUsedPercentage"; break; 2583 case VMResouceMonitorColumn_NetworkUpRate: strResult = "NetworkUpRate"; break; 2584 case VMResouceMonitorColumn_NetworkDownRate: strResult = "NetworkDownRate"; break; 2585 case VMResouceMonitorColumn_NetworkUpTotal: strResult = "NetworkUpTotal"; break; 2586 case VMResouceMonitorColumn_NetworkDownTotal: strResult = "NetworkDownTotal"; break; 2587 case VMResouceMonitorColumn_DiskIOReadRate: strResult = "DiskIOReadRate"; break; 2588 case VMResouceMonitorColumn_DiskIOWriteRate: strResult = "DiskIOWriteRate"; break; 2589 case VMResouceMonitorColumn_DiskIOReadTotal: strResult = "DiskIOReadTotal"; break; 2590 case VMResouceMonitorColumn_DiskIOWriteTotal: strResult = "DiskIOWriteTotal"; break; 2591 case VMResouceMonitorColumn_VMExits: strResult = "VMExits"; break; 2592 default: 2593 { 2594 AssertMsgFailed(("No text for VM Resource Monitor Column=%d", enmVMResourceMonitorColumn)); 2595 break; 2596 } 2597 } 2598 return strResult; 2599 } 2600 2601 template<> VMResouceMonitorColumn fromInternalString<VMResouceMonitorColumn>(const QString &strVMResourceMonitorColumn) 2602 { 2603 QStringList keys; QList<VMResouceMonitorColumn> values; 2604 keys << "VMName"; values << VMResouceMonitorColumn_Name; 2605 keys << "CPUGuestLoad"; values << VMResouceMonitorColumn_CPUGuestLoad; 2606 keys << "CPUVMMLoad"; values << VMResouceMonitorColumn_CPUVMMLoad; 2607 keys << "RAMUsedAndTotal"; values << VMResouceMonitorColumn_RAMUsedAndTotal; 2608 keys << "RAMUsedPercentage"; values << VMResouceMonitorColumn_RAMUsedPercentage; 2609 keys << "NetworkUpRate"; values << VMResouceMonitorColumn_NetworkUpRate; 2610 keys << "NetworkDownRate"; values << VMResouceMonitorColumn_NetworkDownRate; 2611 keys << "NetworkUpTotal"; values << VMResouceMonitorColumn_NetworkUpTotal; 2612 keys << "NetworkDownTotal"; values << VMResouceMonitorColumn_NetworkDownTotal; 2613 keys << "DiskIOReadRate"; values << VMResouceMonitorColumn_DiskIOReadRate; 2614 keys << "DiskIOWriteRate"; values << VMResouceMonitorColumn_DiskIOWriteRate; 2615 keys << "DiskIOReadTotal"; values << VMResouceMonitorColumn_DiskIOReadTotal; 2616 keys << "DiskIOWriteTotal"; values << VMResouceMonitorColumn_DiskIOWriteTotal; 2617 keys << "VMExits"; values << VMResouceMonitorColumn_VMExits; 2618 if (!keys.contains(strVMResourceMonitorColumn, Qt::CaseInsensitive)) 2619 return VMResouceMonitorColumn_Max; 2620 /* Corresponding format for known words: */ 2621 return values.at(keys.indexOf(QRegExp(strVMResourceMonitorColumn, Qt::CaseInsensitive))); 2622 } -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r83304 r83452 240 240 const char *UIExtraDataDefs::GUI_GuestControl_LogViewerVisiblePanels = "GUI/LogViewerVisiblePanels"; 241 241 242 /* VM Resource Monitor: */ 243 const char *UIExtraDataDefs::GUI_VMResourceManager_HiddenColumns = "GUI/VMResourceManagerHiddenColumns"; 244 242 245 /* Obsolete keys: */ 243 246 QMap<QString, QString> UIExtraDataDefs::prepareObsoleteKeysMap() -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r83304 r83452 439 439 /** @} */ 440 440 441 /** @name Manager UI: VM Resource Monitor Related stuff 442 * @{ */ 443 SHARED_LIBRARY_STUFF extern const char *GUI_VMResourceManager_HiddenColumns; 444 /** @} */ 445 441 446 /** @name Old key support stuff. 442 447 * @{ */ … … 1064 1069 }; 1065 1070 1071 /** Manager UI: VM resource Monitor Column types. 1072 * @note The first element must be 0 and the rest must be consecutive */ 1073 enum VMResouceMonitorColumn 1074 { 1075 VMResouceMonitorColumn_Name = 0, 1076 VMResouceMonitorColumn_CPUGuestLoad, 1077 VMResouceMonitorColumn_CPUVMMLoad, 1078 VMResouceMonitorColumn_RAMUsedAndTotal, 1079 VMResouceMonitorColumn_RAMUsedPercentage, 1080 VMResouceMonitorColumn_NetworkUpRate, 1081 VMResouceMonitorColumn_NetworkDownRate, 1082 VMResouceMonitorColumn_NetworkUpTotal, 1083 VMResouceMonitorColumn_NetworkDownTotal, 1084 VMResouceMonitorColumn_DiskIOReadRate, 1085 VMResouceMonitorColumn_DiskIOWriteRate, 1086 VMResouceMonitorColumn_DiskIOReadTotal, 1087 VMResouceMonitorColumn_DiskIOWriteTotal, 1088 VMResouceMonitorColumn_VMExits, 1089 VMResouceMonitorColumn_Max 1090 }; 1066 1091 1067 1092 #endif /* !FEQT_INCLUDED_SRC_extradata_UIExtraDataDefs_h */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r83367 r83452 4567 4567 } 4568 4568 4569 void UIExtraDataManager::setVMResourceMonitorHiddenColumnList(const QStringList &hiddenColumnList) 4570 { 4571 setExtraDataStringList(GUI_VMResourceManager_HiddenColumns, hiddenColumnList); 4572 } 4573 4574 QStringList UIExtraDataManager::VMResourceMonitorHiddenColumnList() 4575 { 4576 return extraDataStringList(GUI_VMResourceManager_HiddenColumns); 4577 } 4578 4569 4579 void UIExtraDataManager::sltExtraDataChange(const QUuid &uMachineID, const QString &strKey, const QString &strValue) 4570 4580 { -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r82968 r83452 755 755 void setLogViewerVisiblePanels(const QStringList &panelNameList); 756 756 QStringList logViewerVisiblePanels(); 757 /** @} */ 758 759 /** @name Manager UI: VM Resource Monitor 760 * @{ */ 761 void setVMResourceMonitorHiddenColumnList(const QStringList &hiddenColumnList); 762 QStringList VMResourceMonitorHiddenColumnList(); 757 763 /** @} */ 758 764 -
trunk/src/VBox/Frontends/VirtualBox/src/monitor/resource/UIResourceMonitor.cpp
r83439 r83452 32 32 #include "UIActionPoolManager.h" 33 33 #include "UICommon.h" 34 #include "UIConverter.h" 35 #include "UIExtraDataDefs.h" 34 36 #include "UIExtraDataManager.h" 35 37 #include "UIIconPool.h" … … 52 54 /* Other VBox includes: */ 53 55 #include <iprt/cidr.h> 54 55 /* The first element must be 0 and the rest must be consecutive: */56 enum VMResouceMonitorColumn57 {58 VMResouceMonitorColumn_Name = 0,59 VMResouceMonitorColumn_CPUGuestLoad,60 VMResouceMonitorColumn_CPUVMMLoad,61 VMResouceMonitorColumn_RAMUsedAndTotal,62 VMResouceMonitorColumn_RAMUsedPercentage,63 VMResouceMonitorColumn_NetworkUpRate,64 VMResouceMonitorColumn_NetworkDownRate,65 VMResouceMonitorColumn_NetworkUpTotal,66 VMResouceMonitorColumn_NetworkDownTotal,67 VMResouceMonitorColumn_DiskIOReadRate,68 VMResouceMonitorColumn_DiskIOWriteRate,69 VMResouceMonitorColumn_DiskIOReadTotal,70 VMResouceMonitorColumn_DiskIOWriteTotal,71 VMResouceMonitorColumn_VMExits,72 VMResouceMonitorColumn_Max73 };74 56 75 57 struct ResourceColumn … … 635 617 } 636 618 619 UIResourceMonitorWidget::~UIResourceMonitorWidget() 620 { 621 saveSettings(); 622 } 623 637 624 QMenu *UIResourceMonitorWidget::menu() const 638 625 { … … 679 666 void UIResourceMonitorWidget::prepare() 680 667 { 681 m_columnShown.resize(VMResouceMonitorColumn_Max); 682 for (int i = 0; i < m_columnShown.size(); ++i) 683 m_columnShown[i] = true; 668 loadHiddenColumnList(); 684 669 prepareWidgets(); 685 670 loadSettings(); … … 801 786 } 802 787 788 void UIResourceMonitorWidget::loadHiddenColumnList() 789 { 790 QStringList hiddenColumnList = gEDataManager->VMResourceMonitorHiddenColumnList(); 791 m_columnShown.resize(VMResouceMonitorColumn_Max); 792 for (int i = 0; i < m_columnShown.size(); ++i) 793 m_columnShown[i] = true; 794 foreach(const QString& strColumn, hiddenColumnList) 795 { 796 VMResouceMonitorColumn enmColumn = gpConverter->fromInternalString<VMResouceMonitorColumn>(strColumn); 797 if ((int)enmColumn < m_columnShown.size()) 798 m_columnShown[(int)enmColumn] = false; 799 } 800 } 801 802 void UIResourceMonitorWidget::saveSettings() 803 { 804 QStringList hiddenColumnList; 805 for (int i = 0; i < m_columnShown.size(); ++i) 806 { 807 if (!m_columnShown[i]) 808 hiddenColumnList << gpConverter->toInternalString((VMResouceMonitorColumn) i); 809 } 810 gEDataManager->setVMResourceMonitorHiddenColumnList(hiddenColumnList); 811 } 812 803 813 void UIResourceMonitorWidget::sltToggleColumnSelectionMenu(bool fChecked) 804 814 { -
trunk/src/VBox/Frontends/VirtualBox/src/monitor/resource/UIResourceMonitor.h
r83439 r83452 52 52 UIResourceMonitorWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool, 53 53 bool fShowToolbar = true, QWidget *pParent = 0); 54 ~UIResourceMonitorWidget(); 54 55 55 56 QMenu *menu() const; … … 85 86 void prepareActions(); 86 87 void loadSettings(); 88 void loadHiddenColumnList(); 89 void saveSettings(); 87 90 /** @} */ 88 91
Note:
See TracChangeset
for help on using the changeset viewer.