Changeset 80369 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Aug 21, 2019 11:43:11 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 132834
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/information
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationConfiguration.h
r80357 r80369 32 32 33 33 /* GUI includes: */ 34 #include "UITextTable.h"35 34 #include "UIInformationWidget.h" 36 35 … … 40 39 41 40 42 /** QWidget extension43 * providing GUI with configuration-information tab in session-information window. */44 41 class UIInformationConfiguration : public UIInformationWidget 45 42 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.cpp
r77594 r80369 17 17 18 18 /* Qt includes: */ 19 #include <QApplication> 20 #include <QTableWidget> 21 #include <QTextDocument> 19 22 #include <QVBoxLayout> 20 #include <QApplication>21 23 22 24 /* GUI includes: */ 25 #include "UICommon.h" 26 #include "UIConverter.h" 27 #include "UIIconPool.h" 23 28 #include "UIInformationRuntime.h" 24 29 #include "UIInformationDataItem.h" … … 28 33 #include "UIInformationModel.h" 29 34 35 /* COM includes: */ 36 #include "CDisplay.h" 37 #include "CMachineDebugger.h" 38 #include "CVRDEServerInfo.h" 30 39 31 40 UIInformationRuntime::UIInformationRuntime(QWidget *pParent, const CMachine &machine, const CConsole &console) 32 : QWidget(pParent) 33 , m_machine(machine) 34 , m_console(console) 35 , m_pMainLayout(0) 36 , m_pModel(0) 37 , m_pView(0) 38 { 39 /* Prepare layout: */ 40 prepareLayout(); 41 42 /* Prepare model: */ 43 prepareModel(); 44 45 /* Prepare view: */ 46 prepareView(); 47 } 48 49 void UIInformationRuntime::prepareLayout() 50 { 51 /* Create layout: */ 52 m_pMainLayout = new QVBoxLayout(this); 53 AssertPtrReturnVoid(m_pMainLayout); 54 { 55 /* Configure layout: */ 56 m_pMainLayout->setSpacing(0); 57 } 58 } 59 60 void UIInformationRuntime::prepareModel() 61 { 62 /* Create information-model: */ 63 m_pModel = new UIInformationModel(this, m_machine, m_console); 64 AssertPtrReturnVoid(m_pModel); 65 { 66 /* Create runtime-attributes data-item: */ 67 UIInformationDataRuntimeAttributes *pGeneral = new UIInformationDataRuntimeAttributes(m_machine, m_console, m_pModel); 68 AssertPtrReturnVoid(pGeneral); 41 : UIInformationWidget(pParent,machine, console) 42 { 43 retranslateUi(); 44 createTableItems(); 45 } 46 47 void UIInformationRuntime::retranslateUi() 48 { 49 m_strRuntimeTitle = QApplication::translate("UIVMInformationDialog", "Runtime Attributes"); 50 } 51 52 void UIInformationRuntime::createTableItems() 53 { 54 if (!m_pTableWidget) 55 return; 56 QFontMetrics fontMetrics(m_pTableWidget->font()); 57 QTextDocument textDocument; 58 int iMaxColumn1Length = 0; 59 60 insertTitleRow(m_strRuntimeTitle, UIIconPool::iconSet(":/state_running_16px.png"), fontMetrics); 61 62 63 insertInfoRows(runTimeAttributes(), 64 fontMetrics, textDocument, iMaxColumn1Length); 65 66 67 68 m_pTableWidget->resizeColumnToContents(0); 69 /* Resize the column 1 a bit larger than the max string if contains: */ 70 m_pTableWidget->setColumnWidth(1, 1.5 * iMaxColumn1Length); 71 m_pTableWidget->resizeColumnToContents(2); 72 } 73 74 UITextTable UIInformationRuntime::runTimeAttributes() 75 { 76 UITextTable textTable; 77 78 ULONG cGuestScreens = m_machine.GetMonitorCount(); 79 QVector<QString> aResolutions(cGuestScreens); 80 for (ULONG iScreen = 0; iScreen < cGuestScreens; ++iScreen) 81 { 82 /* Determine resolution: */ 83 ULONG uWidth = 0; 84 ULONG uHeight = 0; 85 ULONG uBpp = 0; 86 LONG xOrigin = 0; 87 LONG yOrigin = 0; 88 KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled; 89 m_console.GetDisplay().GetScreenResolution(iScreen, uWidth, uHeight, uBpp, xOrigin, yOrigin, monitorStatus); 90 QString strResolution = QString("%1x%2").arg(uWidth).arg(uHeight); 91 if (uBpp) 92 strResolution += QString("x%1").arg(uBpp); 93 strResolution += QString(" @%1,%2").arg(xOrigin).arg(yOrigin); 94 if (monitorStatus == KGuestMonitorStatus_Disabled) 69 95 { 70 /* Add runtime-attributes data-item to model: */71 m_pModel->addItem(pGeneral);96 strResolution += QString(" "); 97 strResolution += QString(QApplication::translate("UIVMInformationDialog", "turned off")); 72 98 } 73 74 /* Create network-statistics data-item: */ 75 UIInformationDataNetworkStatistics *pNetwork = new UIInformationDataNetworkStatistics(m_machine, m_console, m_pModel); 76 AssertPtrReturnVoid(pNetwork); 77 { 78 /* Add network-statistics data-item to model: */ 79 m_pModel->addItem(pNetwork); 80 } 81 82 /* Create storage-statistics data-item: */ 83 UIInformationDataStorageStatistics *pStorage = new UIInformationDataStorageStatistics(m_machine, m_console, m_pModel); 84 AssertPtrReturnVoid(pStorage); 85 { 86 /* Add storage-statistics data-item to model: */ 87 m_pModel->addItem(pStorage); 88 } 89 } 90 } 91 92 void UIInformationRuntime::prepareView() 93 { 94 /* Create information-view: */ 95 m_pView = new UIInformationView; 96 AssertPtrReturnVoid(m_pView); 97 { 98 /* Configure information-view: */ 99 m_pView->setResizeMode(QListView::Adjust); 100 101 /* Create information-delegate item: */ 102 UIInformationItem *pItem = new UIInformationItem(m_pView); 103 AssertPtrReturnVoid(pItem); 104 { 105 /* Set item-delegate for information-view: */ 106 m_pView->setItemDelegate(pItem); 107 } 108 /* Connect data changed signal: */ 109 connect(m_pModel, &UIInformationModel::dataChanged, m_pView, &UIInformationView::updateData); 110 111 /* Set model for view: */ 112 m_pView->setModel(m_pModel); 113 /* Add information-view to the layout: */ 114 m_pMainLayout->addWidget(m_pView); 115 } 116 } 99 aResolutions[iScreen] = strResolution; 100 } 101 102 /* Determine uptime: */ 103 CMachineDebugger debugger = m_console.GetDebugger(); 104 uint32_t uUpSecs = (debugger.GetUptime() / 5000) * 5; 105 char szUptime[32]; 106 uint32_t uUpDays = uUpSecs / (60 * 60 * 24); 107 uUpSecs -= uUpDays * 60 * 60 * 24; 108 uint32_t uUpHours = uUpSecs / (60 * 60); 109 uUpSecs -= uUpHours * 60 * 60; 110 uint32_t uUpMins = uUpSecs / 60; 111 uUpSecs -= uUpMins * 60; 112 RTStrPrintf(szUptime, sizeof(szUptime), "%dd %02d:%02d:%02d", 113 uUpDays, uUpHours, uUpMins, uUpSecs); 114 QString strUptime = QString(szUptime); 115 116 /* Determine clipboard mode: */ 117 QString strClipboardMode = gpConverter->toString(m_machine.GetClipboardMode()); 118 /* Determine Drag&Drop mode: */ 119 QString strDnDMode = gpConverter->toString(m_machine.GetDnDMode()); 120 121 /* Determine virtualization attributes: */ 122 QString strVirtualization = debugger.GetHWVirtExEnabled() ? 123 QApplication::translate("UIVMInformationDialog", "Active") : 124 QApplication::translate("UIVMInformationDialog", "Inactive"); 125 126 QString strExecutionEngine; 127 switch (debugger.GetExecutionEngine()) 128 { 129 case KVMExecutionEngine_HwVirt: 130 strExecutionEngine = "VT-x/AMD-V"; /* no translation */ 131 break; 132 case KVMExecutionEngine_RawMode: 133 strExecutionEngine = "raw-mode"; /* no translation */ 134 break; 135 case KVMExecutionEngine_NativeApi: 136 strExecutionEngine = "native API"; /* no translation */ 137 break; 138 default: 139 AssertFailed(); 140 RT_FALL_THRU(); 141 case KVMExecutionEngine_NotSet: 142 strExecutionEngine = QApplication::translate("UIVMInformationDialog", "not set"); 143 break; 144 } 145 QString strNestedPaging = debugger.GetHWVirtExNestedPagingEnabled() ? 146 QApplication::translate("UIVMInformationDialog", "Active"): 147 QApplication::translate("UIVMInformationDialog", "Inactive"); 148 149 QString strUnrestrictedExecution = debugger.GetHWVirtExUXEnabled() ? 150 QApplication::translate("UIVMInformationDialog", "Active"): 151 QApplication::translate("UIVMInformationDialog", "Inactive"); 152 153 QString strParavirtProvider = gpConverter->toString(m_machine.GetEffectiveParavirtProvider()); 154 155 /* Guest information: */ 156 CGuest guest = m_console.GetGuest(); 157 QString strGAVersion = guest.GetAdditionsVersion(); 158 if (strGAVersion.isEmpty()) 159 strGAVersion = tr("Not Detected", "guest additions"); 160 else 161 { 162 ULONG uRevision = guest.GetAdditionsRevision(); 163 if (uRevision != 0) 164 strGAVersion += QString(" r%1").arg(uRevision); 165 } 166 QString strOSType = guest.GetOSTypeId(); 167 if (strOSType.isEmpty()) 168 strOSType = tr("Not Detected", "guest os type"); 169 else 170 strOSType = uiCommon().vmGuestOSTypeDescription(strOSType); 171 172 /* VRDE information: */ 173 int iVRDEPort = m_console.GetVRDEServerInfo().GetPort(); 174 QString strVRDEInfo = (iVRDEPort == 0 || iVRDEPort == -1)? 175 tr("Not Available", "details report (VRDE server port)") : 176 QString("%1").arg(iVRDEPort); 177 178 /* Searching for longest string: */ 179 QStringList values; 180 for (ULONG iScreen = 0; iScreen < cGuestScreens; ++iScreen) 181 values << aResolutions[iScreen]; 182 values << strUptime 183 << strExecutionEngine << strNestedPaging << strUnrestrictedExecution 184 << strGAVersion << strOSType << strVRDEInfo; 185 int iMaxLength = 0; 186 foreach (const QString &strValue, values) 187 iMaxLength = iMaxLength < QApplication::fontMetrics().width(strValue) 188 ? QApplication::fontMetrics().width(strValue) : iMaxLength; 189 190 /* Summary: */ 191 for (ULONG iScreen = 0; iScreen < cGuestScreens; ++iScreen) 192 { 193 QString strLabel(tr("Screen Resolution")); 194 /* The screen number makes sense only if there are multiple monitors in the guest: */ 195 if (cGuestScreens > 1) 196 strLabel += QString(" %1").arg(iScreen + 1); 197 textTable << UITextTableLine(strLabel, aResolutions[iScreen]); 198 } 199 200 textTable << UITextTableLine(tr("VM Uptime"), strUptime); 201 textTable << UITextTableLine(tr("Clipboard Mode"), strClipboardMode); 202 textTable << UITextTableLine(tr("Drag and Drop Mode"), strDnDMode); 203 textTable << UITextTableLine(tr("VM Execution Engine", "details report"), strExecutionEngine); 204 textTable << UITextTableLine(tr("Nested Paging", "details report"), strNestedPaging); 205 textTable << UITextTableLine(tr("Unrestricted Execution", "details report"), strUnrestrictedExecution); 206 textTable << UITextTableLine(tr("Paravirtualization Interface", "details report"), strParavirtProvider); 207 textTable << UITextTableLine(tr("Guest Additions"), strGAVersion); 208 textTable << UITextTableLine(tr("Guest OS Type", "details report"), strOSType); 209 textTable << UITextTableLine(tr("Remote Desktop Server Port", "details report (VRDE Server)"), strVRDEInfo); 210 211 return textTable; 212 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.h
r80357 r80369 30 30 #include "CConsole.h" 31 31 32 /* GUI includes: */ 33 #include "UIInformationWidget.h" 34 32 35 /* Forward declarations: */ 33 36 class QVBoxLayout; … … 37 40 38 41 39 /** QWidget extension 40 * providing GUI with configuration-information tab in session-information window. */ 41 class UIInformationRuntime : public QWidget 42 class UIInformationRuntime : public UIInformationWidget 42 43 { 43 44 Q_OBJECT; … … 45 46 public: 46 47 47 /** Constructs information-tab passing @a pParent to the QWidget base-class constructor.48 * @param machine is machine reference.49 * @param console is machine console reference. */50 48 UIInformationRuntime(QWidget *pParent, const CMachine &machine, const CConsole &console); 51 49 50 protected: 51 52 void retranslateUi() /* override */; 53 void createTableItems() /* override */; 54 52 55 private: 56 UITextTable runTimeAttributes(); 53 57 54 /** Prepares layout. */ 55 void prepareLayout(); 58 /** @name Cached translated string. 59 * @{ */ 60 QString m_strRuntimeTitle; 61 /** @} */ 56 62 57 /** Prepares model. */58 void prepareModel();59 60 /** Prepares view. */61 void prepareView();62 63 /** Holds the machine instance. */64 CMachine m_machine;65 /** Holds the console instance. */66 CConsole m_console;67 /** Holds the instance of layout we create. */68 QVBoxLayout *m_pMainLayout;69 /** Holds the instance of model we create. */70 UIInformationModel *m_pModel;71 /** Holds the instance of view we create. */72 UIInformationView *m_pView;73 63 }; 74 64 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationWidget.h
r80357 r80369 52 52 53 53 virtual void retranslateUi() /* override */ = 0; 54 virtual void createTableItems() /* override */ = 0; 55 54 56 void insertTitleRow(const QString &strTitle, const QIcon &icon, const QFontMetrics &fontMetrics); 55 57 void insertInfoRows(const UITextTable &table, const QFontMetrics &fontMetrics, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp
r80341 r80369 271 271 272 272 /* Set Runtime Information tab as default: */ 273 m_pTabWidget->setCurrentIndex( 0);273 m_pTabWidget->setCurrentIndex(1); 274 274 275 275 /* Assign tab-widget page change handler: */
Note:
See TracChangeset
for help on using the changeset viewer.