VirtualBox

Changeset 80545 in vbox for trunk/src


Ignore:
Timestamp:
Sep 2, 2019 11:22:27 AM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9510: Some clean up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.cpp

    r80543 r80545  
    161161    void setFontSize(int iFontSize);
    162162    int  fontSize() const;
    163     void setTextList(const QStringList &textList);
    164163    const QStringList &textList() const;
    165164
     
    190189private:
    191190
    192     virtual void computeFontSize();
    193191    /** @name Drawing helper functions.
    194192     * @{ */
     
    210208    int m_iMarginTop;
    211209    int m_iMarginBottom;
    212     QStringList m_textList;
    213210    QRect m_lineChartRect;
    214211    int m_iPieChartRadius;
     
    246243    setSelectionMode(QAbstractItemView::NoSelection);
    247244
    248 
    249245    m_pTimer = new QTimer(this);
    250246    if (m_pTimer)
     
    253249        m_pTimer->start(5000);
    254250    }
    255 
    256251
    257252    retranslateUi();
     
    331326        strResolution += m_strMonitorTurnedOff;
    332327    }
    333 
    334328    return strResolution;
    335329}
     
    344338    ULONG uGuestScreens = m_machine.GetMonitorCount();
    345339    m_screenResolutions.resize(uGuestScreens);
    346 
    347340    if (iScreenID != -1 && iScreenID >= (int)uGuestScreens)
    348341        return;
     
    362355            removeRow(i);
    363356    }
    364 
    365357    for (ULONG iScreen = 0; iScreen < uGuestScreens; ++iScreen)
    366358    {
     
    455447    updateScreenInfo();
    456448    updateUpTime();
    457 
    458449
    459450    /* Determine virtualization attributes: */
     
    537528
    538529    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');
    540531    m_iMarginTop = 0.3 * qApp->QApplication::style()->pixelMetric(QStyle::PM_LayoutTopMargin);
    541532    m_iMarginBottom = 2 * qApp->QApplication::style()->pixelMetric(QStyle::PM_LayoutTopMargin);
    542533
    543534    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);
    545536    m_iPieChartSpacing = 2;
    546537    m_iPieChartRadius = m_size.height() - (m_iMarginTop + m_iMarginBottom + 2 * m_iPieChartSpacing);
     
    557548{
    558549    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() const
    568 {
    569     return m_textList;
    570550}
    571551
     
    638618    m_strGAWarning = QApplication::translate("UIVMInformationDialog", "No guest additions! This metric requires guest additions to work properly.");
    639619    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             else
    653                 break;
    654             m_font.setPixelSize(iFontSize);
    655         }while(iFontSize > 1);
    656     }
    657620}
    658621
     
    11781141    iMaximum = qMax(iMaximum, m_strVMExitLabelTotal.length());
    11791142
    1180 
    11811143    /* Compute the maximum label string length and set it as a fixed width to labels to prevent always changing widths: */
    11821144    /* Add m_iDecimalCount plus 3 characters for the number and 3 for unit string: */
     
    11931155        }
    11941156    }
    1195 
    11961157}
    11971158
     
    12521213    m_pRuntimeInfoWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
    12531214
    1254 
    12551215    QWidget *bottomSpacerWidget = new QWidget(this);
    12561216    bottomSpacerWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
     
    12651225void UIInformationRuntime::sltTimeout()
    12661226{
    1267 
    12681227    if (m_performanceMonitor.isNull())
    12691228        return;
     
    13221281    quint64 uNetworkTotalReceive = 0;
    13231282    quint64 uNetworkTotalTransmit = 0;
    1324 
    13251283    quint64 uDiskIOTotalWritten = 0;
    13261284    quint64 uDiskIOTotalRead = 0;
    1327 
    1328    quint64 uTotalVMExits = 0;
     1285    quint64 uTotalVMExits = 0;
    13291286
    13301287    QVector<DebuggerMetricData> xmlData = getTotalCounterFromDegugger(m_strQueryString);
     
    14821439        m_strQueryString += iterator.value().queryString();
    14831440    }
    1484 
    14851441}
    14861442
     
    16551611    if (m_charts.contains(m_strDiskIOMetricName))
    16561612        m_charts[m_strDiskIOMetricName]->update();
    1657 
    1658 }
    1659 
     1613}
    16601614
    16611615void UIInformationRuntime::updateVMExitMetric(quint64 uTotalVMExits)
     
    16651619
    16661620    UIMetric &VMExitMetric = m_subMetrics[m_strVMExitMetricName];
    1667 
    16681621    quint64 iRate = uTotalVMExits - VMExitMetric.total(0);
    1669 
    16701622    VMExitMetric.setTotal(0, uTotalVMExits);
    1671 
    16721623    /* Do not set data and maximum if the metric has not been initialized  since we need to initialize totals "(t-1)" first: */
    16731624    if (!VMExitMetric.isInitialized())
     
    16761627        return;
    16771628    }
    1678 
    16791629    VMExitMetric.addData(0, iRate);
    16801630    quint64 iMaximum = qMax(VMExitMetric.maximum(), iRate);
    16811631    VMExitMetric.setMaximum(iMaximum);
    1682 
    16831632    if (m_infoLabels.contains(m_strVMExitMetricName)  && m_infoLabels[m_strVMExitMetricName])
    16841633    {
     
    17131662        return xmlData;
    17141663    CMachineDebugger debugger = m_console.GetDebugger();
    1715 
    17161664    QString strStats = debugger.GetStats(strQuery, false);
    17171665    QXmlStreamReader xmlReader;
     
    17401688            else
    17411689                xmlReader.skipCurrentElement();
    1742 
    17431690        }
    17441691    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette