- Timestamp:
- Sep 2, 2019 11:22:27 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.cpp
r80543 r80545 161 161 void setFontSize(int iFontSize); 162 162 int fontSize() const; 163 void setTextList(const QStringList &textList);164 163 const QStringList &textList() const; 165 164 … … 190 189 private: 191 190 192 virtual void computeFontSize();193 191 /** @name Drawing helper functions. 194 192 * @{ */ … … 210 208 int m_iMarginTop; 211 209 int m_iMarginBottom; 212 QStringList m_textList;213 210 QRect m_lineChartRect; 214 211 int m_iPieChartRadius; … … 246 243 setSelectionMode(QAbstractItemView::NoSelection); 247 244 248 249 245 m_pTimer = new QTimer(this); 250 246 if (m_pTimer) … … 253 249 m_pTimer->start(5000); 254 250 } 255 256 251 257 252 retranslateUi(); … … 331 326 strResolution += m_strMonitorTurnedOff; 332 327 } 333 334 328 return strResolution; 335 329 } … … 344 338 ULONG uGuestScreens = m_machine.GetMonitorCount(); 345 339 m_screenResolutions.resize(uGuestScreens); 346 347 340 if (iScreenID != -1 && iScreenID >= (int)uGuestScreens) 348 341 return; … … 362 355 removeRow(i); 363 356 } 364 365 357 for (ULONG iScreen = 0; iScreen < uGuestScreens; ++iScreen) 366 358 { … … 455 447 updateScreenInfo(); 456 448 updateUpTime(); 457 458 449 459 450 /* Determine virtualization attributes: */ … … 537 528 538 529 m_iMarginLeft = 1 * qApp->QApplication::style()->pixelMetric(QStyle::PM_LayoutTopMargin); 539 m_iMarginRight = 6 * qApp->QApplication::style()->pixelMetric(QStyle::PM_LayoutTopMargin);530 m_iMarginRight = 9 * QFontMetrics(font()).width('X'); 540 531 m_iMarginTop = 0.3 * qApp->QApplication::style()->pixelMetric(QStyle::PM_LayoutTopMargin); 541 532 m_iMarginBottom = 2 * qApp->QApplication::style()->pixelMetric(QStyle::PM_LayoutTopMargin); 542 533 543 534 float fAppIconSize = qApp->style()->pixelMetric(QStyle::PM_LargeIconSize); 544 m_size = QSize(14 * fAppIconSize, 4* fAppIconSize);535 m_size = QSize(14 * fAppIconSize, 3.5 * fAppIconSize); 545 536 m_iPieChartSpacing = 2; 546 537 m_iPieChartRadius = m_size.height() - (m_iMarginTop + m_iMarginBottom + 2 * m_iPieChartSpacing); … … 557 548 { 558 549 return m_font.pixelSize(); 559 }560 561 void UIChart::setTextList(const QStringList &textList)562 {563 m_textList = textList;564 computeFontSize();565 }566 567 const QStringList &UIChart::textList() const568 {569 return m_textList;570 550 } 571 551 … … 638 618 m_strGAWarning = QApplication::translate("UIVMInformationDialog", "No guest additions! This metric requires guest additions to work properly."); 639 619 m_strResetActionLabel = QApplication::translate("UIVMInformationDialog", "Reset"); 640 }641 642 void UIChart::computeFontSize()643 {644 int iFontSize = 24;645 foreach (const QString &strText, m_textList)646 {647 m_font.setPixelSize(iFontSize);648 do{649 int iWidth = QFontMetrics(m_font).width(strText);650 if (iWidth + m_iMarginLeft + m_iMarginRight > m_size.width())651 --iFontSize;652 else653 break;654 m_font.setPixelSize(iFontSize);655 }while(iFontSize > 1);656 }657 620 } 658 621 … … 1178 1141 iMaximum = qMax(iMaximum, m_strVMExitLabelTotal.length()); 1179 1142 1180 1181 1143 /* Compute the maximum label string length and set it as a fixed width to labels to prevent always changing widths: */ 1182 1144 /* Add m_iDecimalCount plus 3 characters for the number and 3 for unit string: */ … … 1193 1155 } 1194 1156 } 1195 1196 1157 } 1197 1158 … … 1252 1213 m_pRuntimeInfoWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); 1253 1214 1254 1255 1215 QWidget *bottomSpacerWidget = new QWidget(this); 1256 1216 bottomSpacerWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); … … 1265 1225 void UIInformationRuntime::sltTimeout() 1266 1226 { 1267 1268 1227 if (m_performanceMonitor.isNull()) 1269 1228 return; … … 1322 1281 quint64 uNetworkTotalReceive = 0; 1323 1282 quint64 uNetworkTotalTransmit = 0; 1324 1325 1283 quint64 uDiskIOTotalWritten = 0; 1326 1284 quint64 uDiskIOTotalRead = 0; 1327 1328 quint64 uTotalVMExits = 0; 1285 quint64 uTotalVMExits = 0; 1329 1286 1330 1287 QVector<DebuggerMetricData> xmlData = getTotalCounterFromDegugger(m_strQueryString); … … 1482 1439 m_strQueryString += iterator.value().queryString(); 1483 1440 } 1484 1485 1441 } 1486 1442 … … 1655 1611 if (m_charts.contains(m_strDiskIOMetricName)) 1656 1612 m_charts[m_strDiskIOMetricName]->update(); 1657 1658 } 1659 1613 } 1660 1614 1661 1615 void UIInformationRuntime::updateVMExitMetric(quint64 uTotalVMExits) … … 1665 1619 1666 1620 UIMetric &VMExitMetric = m_subMetrics[m_strVMExitMetricName]; 1667 1668 1621 quint64 iRate = uTotalVMExits - VMExitMetric.total(0); 1669 1670 1622 VMExitMetric.setTotal(0, uTotalVMExits); 1671 1672 1623 /* Do not set data and maximum if the metric has not been initialized since we need to initialize totals "(t-1)" first: */ 1673 1624 if (!VMExitMetric.isInitialized()) … … 1676 1627 return; 1677 1628 } 1678 1679 1629 VMExitMetric.addData(0, iRate); 1680 1630 quint64 iMaximum = qMax(VMExitMetric.maximum(), iRate); 1681 1631 VMExitMetric.setMaximum(iMaximum); 1682 1683 1632 if (m_infoLabels.contains(m_strVMExitMetricName) && m_infoLabels[m_strVMExitMetricName]) 1684 1633 { … … 1713 1662 return xmlData; 1714 1663 CMachineDebugger debugger = m_console.GetDebugger(); 1715 1716 1664 QString strStats = debugger.GetStats(strQuery, false); 1717 1665 QXmlStreamReader xmlReader; … … 1740 1688 else 1741 1689 xmlReader.skipCurrentElement(); 1742 1743 1690 } 1744 1691 }
Note:
See TracChangeset
for help on using the changeset viewer.