Changeset 80525 in vbox
- Timestamp:
- Sep 1, 2019 1:39:49 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 133032
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/information
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.cpp
r80523 r80525 52 52 const int iDecimalCount = 2; 53 53 54 enum Info Line55 { 56 Info Line_Title = 0,57 Info Line_Resolution,58 Info Line_Uptime,59 Info Line_ClipboardMode,60 Info Line_DnDMode,61 Info Line_ExecutionEngine,62 Info Line_NestedPaging,63 Info Line_UnrestrictedExecution,64 Info Line_Paravirtualization,65 Info Line_GuestAdditions,66 Info Line_GuestOSType,67 Info Line_RemoteDesktop,68 Info Line_Max54 enum InfoRow 55 { 56 InfoRow_Title = 0, 57 InfoRow_Resolution, 58 InfoRow_Uptime, 59 InfoRow_ClipboardMode, 60 InfoRow_DnDMode, 61 InfoRow_ExecutionEngine, 62 InfoRow_NestedPaging, 63 InfoRow_UnrestrictedExecution, 64 InfoRow_Paravirtualization, 65 InfoRow_GuestAdditions, 66 InfoRow_GuestOSType, 67 InfoRow_RemoteDesktop, 68 InfoRow_Max 69 69 }; 70 70 … … 81 81 UIRuntimeInfoWidget(QWidget *pParent, const CMachine &machine, const CConsole &console); 82 82 void guestMonitorChange(ulong uScreenId); 83 void guestAdditionStateChange(); 84 void VRDEChange(); 83 85 84 86 protected: … … 94 96 private: 95 97 96 void runTimeAttributes();98 void createInfoRows(); 97 99 void updateScreenInfo(int iScreenId = -1); 98 100 void updateUpTime(); 101 void updateGAsVersion(); 102 void updateVRDE(); 103 /** Searches the table for the @p item of enmLine and replaces its text. if not found inserts a new 104 * row to the end of the table. Assumes only one line of the @p enmLine exists. */ 105 void updateInfoRow(InfoRow enmLine, const QString &strColumn0, const QString &strColumn1); 99 106 QString screenResolution(int iScreenId); 100 /** Creates to QTableWidgetItems of tye @enmInfo Lineusing the @p strLabel and @p strInfo and inserts it107 /** Creates to QTableWidgetItems of tye @enmInfoRow using the @p strLabel and @p strInfo and inserts it 101 108 * to the row @p iRow. If @p iRow is -1 then the items inserted to the end of the table. */ 102 void insertInfo Line(InfoLine enmInfoLine, const QString& strLabel, const QString &strInfo, int iRow = -1);109 void insertInfoRow(InfoRow enmInfoRow, const QString& strLabel, const QString &strInfo, int iRow = -1); 103 110 void computeMinimumWidth(); 104 111 … … 249 256 retranslateUi(); 250 257 /* Add the title row: */ 251 QTableWidgetItem *pTitleItem = new QTableWidgetItem(UIIconPool::iconSet(":/state_running_16px.png"), m_strTableTitle, Info Line_Title);258 QTableWidgetItem *pTitleItem = new QTableWidgetItem(UIIconPool::iconSet(":/state_running_16px.png"), m_strTableTitle, InfoRow_Title); 252 259 QFont titleFont(font()); 253 260 titleFont.setBold(true); … … 256 263 setItem(0, 0, pTitleItem); 257 264 /* Make the API calls and populate the table: */ 258 runTimeAttributes();265 createInfoRows(); 259 266 computeMinimumWidth(); 260 267 } … … 264 271 updateScreenInfo(uScreenId); 265 272 } 273 274 void UIRuntimeInfoWidget::guestAdditionStateChange() 275 { 276 updateGAsVersion(); 277 } 278 279 void UIRuntimeInfoWidget::VRDEChange() 280 { 281 updateVRDE(); 282 } 283 266 284 267 285 void UIRuntimeInfoWidget::retranslateUi() … … 297 315 } 298 316 299 void UIRuntimeInfoWidget::insertInfo Line(InfoLine enmInfoLine, const QString& strLabel, const QString &strInfo, int iRow /* = -1 */)317 void UIRuntimeInfoWidget::insertInfoRow(InfoRow enmInfoRow, const QString& strLabel, const QString &strInfo, int iRow /* = -1 */) 300 318 { 301 319 int iMargin = 0.2 * qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin); … … 304 322 iNewRow = iRow; 305 323 insertRow(iNewRow); 306 setItem(iNewRow, 0, new QTableWidgetItem(strLabel, enmInfo Line));307 setItem(iNewRow, 1, new QTableWidgetItem(strInfo, enmInfo Line));324 setItem(iNewRow, 0, new QTableWidgetItem(strLabel, enmInfoRow)); 325 setItem(iNewRow, 1, new QTableWidgetItem(strInfo, enmInfoRow)); 308 326 setRowHeight(iNewRow, 2 * iMargin + m_iFontHeight); 309 327 } … … 356 374 { 357 375 QTableWidgetItem *pItem = item(i, 0); 358 if (pItem && pItem->type() == Info Line_Resolution)376 if (pItem && pItem->type() == InfoRow_Resolution) 359 377 removeRow(i); 360 378 } … … 366 384 QString("%1:").arg(m_strScreenResolutionLabel); 367 385 /* Insert the screen resolution row at the top of the table. Row 0 is the title row: */ 368 insertInfo Line(InfoLine_Resolution, strLabel, m_screenResolutions[iScreen], iScreen + 1);386 insertInfoRow(InfoRow_Resolution, strLabel, m_screenResolutions[iScreen], iScreen + 1); 369 387 } 370 388 resizeColumnToContents(1); … … 385 403 uUpDays, uUpHours, uUpMins, uUpSecs); 386 404 QString strUptime = QString(szUptime); 387 405 updateInfoRow(InfoRow_Uptime, QString("%1:").arg(m_strUptimeLabel), strUptime); 406 } 407 408 void UIRuntimeInfoWidget::updateGAsVersion() 409 { 410 CGuest guest = m_console.GetGuest(); 411 QString strGAVersion = guest.GetAdditionsVersion(); 412 if (strGAVersion.isEmpty()) 413 strGAVersion = m_strNotDetected; 414 else 415 { 416 ULONG uRevision = guest.GetAdditionsRevision(); 417 if (uRevision != 0) 418 strGAVersion += QString(" r%1").arg(uRevision); 419 } 420 updateInfoRow(InfoRow_GuestAdditions, QString("%1:").arg(m_strGuestAdditionsLabel), strGAVersion); 421 } 422 423 void UIRuntimeInfoWidget::updateVRDE() 424 { 425 /* VRDE information: */ 426 int iVRDEPort = m_console.GetVRDEServerInfo().GetPort(); 427 QString strVRDEInfo = (iVRDEPort == 0 || iVRDEPort == -1) ? 428 m_strNotAvailable : QString("%1").arg(iVRDEPort); 429 updateInfoRow(InfoRow_RemoteDesktop, QString("%1:").arg(m_strRemoteDesktopLabel), strVRDEInfo); 430 } 431 432 void UIRuntimeInfoWidget::updateInfoRow(InfoRow enmLine, const QString &strColumn0, const QString &strColumn1) 433 { 388 434 QTableWidgetItem *pItem = 0; 389 435 for (int i = 0; i < rowCount() && !pItem; ++i) … … 392 438 if (!pItem) 393 439 continue; 394 if (pItem->type() != InfoLine_Uptime)440 if (pItem->type() != enmLine) 395 441 pItem = 0; 396 442 } 397 443 if (!pItem) 398 insertInfo Line(InfoLine_Uptime, QString("%1:").arg(m_strUptimeLabel), strUptime);444 insertInfoRow(enmLine, strColumn0, strColumn1); 399 445 else 400 pItem->setText(str Uptime);401 } 402 403 void UIRuntimeInfoWidget:: runTimeAttributes()446 pItem->setText(strColumn1); 447 } 448 449 void UIRuntimeInfoWidget::createInfoRows() 404 450 { 405 451 updateScreenInfo(); … … 444 490 QString strParavirtProvider = gpConverter->toString(m_machine.GetEffectiveParavirtProvider()); 445 491 446 /* Guest information: */ 447 CGuest guest = m_console.GetGuest(); 448 QString strGAVersion = guest.GetAdditionsVersion(); 449 if (strGAVersion.isEmpty()) 450 strGAVersion = m_strNotDetected; 451 else 452 { 453 ULONG uRevision = guest.GetAdditionsRevision(); 454 if (uRevision != 0) 455 strGAVersion += QString(" r%1").arg(uRevision); 456 } 457 QString strOSType = guest.GetOSTypeId(); 492 QString strOSType = m_console.GetGuest().GetOSTypeId(); 458 493 if (strOSType.isEmpty()) 459 494 strOSType = m_strNotDetected; … … 461 496 strOSType = uiCommon().vmGuestOSTypeDescription(strOSType); 462 497 463 /* VRDE information: */ 464 int iVRDEPort = m_console.GetVRDEServerInfo().GetPort(); 465 QString strVRDEInfo = (iVRDEPort == 0 || iVRDEPort == -1)? 466 m_strNotAvailable : QString("%1").arg(iVRDEPort); 467 468 469 insertInfoLine(InfoLine_ClipboardMode, QString("%1:").arg(m_strClipboardModeLabel), strClipboardMode); 470 insertInfoLine(InfoLine_DnDMode, QString("%1:").arg(m_strDragAndDropLabel), strDnDMode); 471 insertInfoLine(InfoLine_ExecutionEngine, QString("%1:").arg(m_strExcutionEngineLabel), strExecutionEngine); 472 insertInfoLine(InfoLine_NestedPaging, QString("%1:").arg(m_strNestedPagingLabel), strNestedPaging); 473 insertInfoLine(InfoLine_UnrestrictedExecution, QString("%1:").arg(m_strUnrestrictedExecutionLabel), strUnrestrictedExecution); 474 insertInfoLine(InfoLine_Paravirtualization, QString("%1:").arg(m_strParavirtualizationLabel), strParavirtProvider); 475 insertInfoLine(InfoLine_GuestAdditions, QString("%1:").arg(m_strGuestAdditionsLabel), strGAVersion); 476 insertInfoLine(InfoLine_GuestOSType, QString("%1:").arg(m_strGuestOSTypeLabel), strOSType); 477 insertInfoLine(InfoLine_RemoteDesktop, QString("%1:").arg(m_strRemoteDesktopLabel), strVRDEInfo); 498 499 insertInfoRow(InfoRow_ClipboardMode, QString("%1:").arg(m_strClipboardModeLabel), strClipboardMode); 500 insertInfoRow(InfoRow_DnDMode, QString("%1:").arg(m_strDragAndDropLabel), strDnDMode); 501 insertInfoRow(InfoRow_ExecutionEngine, QString("%1:").arg(m_strExcutionEngineLabel), strExecutionEngine); 502 insertInfoRow(InfoRow_NestedPaging, QString("%1:").arg(m_strNestedPagingLabel), strNestedPaging); 503 insertInfoRow(InfoRow_UnrestrictedExecution, QString("%1:").arg(m_strUnrestrictedExecutionLabel), strUnrestrictedExecution); 504 insertInfoRow(InfoRow_Paravirtualization, QString("%1:").arg(m_strParavirtualizationLabel), strParavirtProvider); 505 updateGAsVersion(); 506 insertInfoRow(InfoRow_GuestOSType, QString("%1:").arg(m_strGuestOSTypeLabel), strOSType); 507 updateVRDE(); 508 478 509 479 510 resizeColumnToContents(0); … … 1087 1118 connect(pSession, &UISession::sigAdditionsStateChange, this, &UIInformationRuntime::sltGuestAdditionsStateChange); 1088 1119 connect(pSession, &UISession::sigGuestMonitorChange, this, &UIInformationRuntime::sltGuestMonitorChange); 1120 connect(pSession, &UISession::sigVRDEChange, this, &UIInformationRuntime::sltVRDEChange); 1089 1121 1090 1122 prepareMetrics(); … … 1338 1370 void UIInformationRuntime::sltGuestAdditionsStateChange() 1339 1371 { 1372 if (m_pRuntimeInfoWidget) 1373 m_pRuntimeInfoWidget->guestAdditionStateChange(); 1340 1374 bool fGuestAdditionsAvailable = guestAdditionsAvailable(6 /* minimum major version */); 1341 1375 if (m_fGuestAdditionsAvailable == fGuestAdditionsAvailable) … … 1349 1383 Q_UNUSED(changeType); 1350 1384 Q_UNUSED(screenGeo); 1351 printf("%lu\n", uScreenId);1352 1385 if (m_pRuntimeInfoWidget) 1353 1386 m_pRuntimeInfoWidget->guestMonitorChange(uScreenId); 1387 } 1388 1389 void UIInformationRuntime::sltVRDEChange() 1390 { 1391 if (m_pRuntimeInfoWidget) 1392 m_pRuntimeInfoWidget->VRDEChange(); 1354 1393 } 1355 1394 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.h
r80523 r80525 38 38 /* GUI includes: */ 39 39 #include "QIWithRetranslateUI.h" 40 #include "UITextTable.h" 40 #include "UIMainEventListener.h" 41 41 42 42 43 /* Forward declarations: */ … … 155 156 void sltGuestAdditionsStateChange(); 156 157 void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo); 158 void sltVRDEChange(); 157 159 158 160 private: … … 192 194 QMap<QString,UIChart*> m_charts; 193 195 QMap<QString,QLabel*> m_infoLabels; 196 ComObjPtr<UIMainEventListenerImpl> m_pQtGuestListener; 194 197 195 198 /** @name These metric names are used for map keys to identify metrics.
Note:
See TracChangeset
for help on using the changeset viewer.