VirtualBox

Changeset 80249 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Aug 13, 2019 11:43:59 AM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9510: Getting rid of some hard coded color strings

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information
Files:
2 edited

Legend:

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

    r80247 r80249  
    801801    {
    802802        QString strInfo;
     803        QString strReceiveColor;
    803804        if (m_infoLabels[m_strNetMetricName]->isEnabled())
    804             strInfo = QString("<b>%1</b></b><br/><font color=\"#FF0000\">%2: %3</font><br/><font color=\"#0000FF\">%4: %5</font><br/>%6: %7").arg(m_strNetInfoLabelTitle)
     805            strInfo = QString("<b>%1</b></b><br/><font color=\"%2\">%3: %4</font><br/><font color=\"%5\">%6: %7</font><br/>%8: %9")
     806                .arg(m_strNetInfoLabelTitle)
     807                .arg(dataColorString(m_strNetMetricName, 0))
    805808                .arg(m_strNetInfoLabelReceived).arg(uiCommon().formatSize((quint64)iReceiveRate, iDecimalCount))
     809                .arg(dataColorString(m_strNetMetricName, 1))
    806810                .arg(m_strNetInfoLabelTransmitted).arg(uiCommon().formatSize((quint64)iTransmitRate, iDecimalCount))
    807811                .arg(m_strNetInfoLabelMaximum).arg(uiCommon().formatSize((quint64)iMaximum, iDecimalCount));
     
    815819}
    816820
     821QString UIPerformanceMonitor::dataColorString(const QString &strChartName, int iDataIndex)
     822{
     823    if (!m_charts.contains(strChartName))
     824        return QColor(Qt::red).name(QColor::HexRgb);
     825    UIChart *pChart = m_charts[strChartName];
     826    if (!pChart)
     827        return QColor(Qt::red).name(QColor::HexRgb);
     828    return pChart->dataSeriesColor(iDataIndex).name(QColor::HexRgb);
     829}
    817830#include "UIPerformanceMonitor.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIPerformanceMonitor.h

    r80243 r80249  
    110110    void updateRAMGraphsAndMetric(quint64 iTotalRAM, quint64 iFreeRAM);
    111111    void updateNewGraphsAndMetric(ULONG iReceiveRate, ULONG iTransmitRate);
     112    QString dataColorString(const QString &strChartName, int iDataIndex);
    112113
    113114    bool m_fGuestAdditionsAvailable;
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