VirtualBox

Changeset 43223 in vbox


Ignore:
Timestamp:
Sep 6, 2012 11:48:24 AM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: VM selector: Details-view: Light bold-font support; Make sure 'Inaccessible' mediums are marked bold.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp

    r43153 r43223  
    826826    int iLeading = fm.leading();
    827827
     828    /* Only bold sub-strings are currently handled: */
     829    QString strModifiedText(strText);
     830    QRegExp boldRegExp("<b>([\\s\\S]+)</b>");
     831    QList<QTextLayout::FormatRange> formatRangeList;
     832    while (boldRegExp.indexIn(strModifiedText) != -1)
     833    {
     834        /* Prepare format: */
     835        QTextLayout::FormatRange formatRange;
     836        QFont font = formatRange.format.font();
     837        font.setBold(true);
     838        formatRange.format.setFont(font);
     839        formatRange.start = boldRegExp.pos(0);
     840        formatRange.length = boldRegExp.cap(1).size();
     841        /* Add format range to list: */
     842        formatRangeList << formatRange;
     843        /* Replace sub-string: */
     844        strModifiedText.replace(boldRegExp.cap(0), boldRegExp.cap(1));
     845    }
     846
    828847    /* Create layout; */
    829     QTextLayout *pTextLayout = new QTextLayout(strText, font, pPaintDevice);
     848    QTextLayout *pTextLayout = new QTextLayout(strModifiedText, font, pPaintDevice);
     849    pTextLayout->setAdditionalFormats(formatRangeList);
    830850
    831851    /* Configure layout: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.cpp

    r42855 r43223  
    449449                    /* Prepare attachment information: */
    450450                    QString strAttachmentInfo = vboxGlobal().details(attachment.GetMedium(), false, false);
     451                    /* That temporary hack makes sure 'Inaccessible' word is always bold: */
     452                    { // hack
     453                        QString strInaccessibleString(VBoxGlobal::tr("Inaccessible", "medium"));
     454                        QString strBoldInaccessibleString(QString("<b>%1</b>").arg(strInaccessibleString));
     455                        strAttachmentInfo.replace(strInaccessibleString, strBoldInaccessibleString);
     456                    } // hack
    451457                    /* Append 'device slot name' with 'device type name' for CD/DVD devices only: */
    452458                    QString strDeviceType = attachment.GetType() == KDeviceType_DVD ?
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