VirtualBox

Ignore:
Timestamp:
May 27, 2014 8:03:54 AM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Mac OS X: HiDPI: Integrate VM-information-dialog icons.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/UIVMInfoDialog.cpp

    r51311 r51410  
    330330{
    331331    /* Details page update: */
    332     m_browsers[0]->setText(vboxGlobal().detailsReport(m_session.GetMachine(), false /* with links */));
     332    setText(m_browsers[0], vboxGlobal().detailsReport(m_session.GetMachine(), false /* with links */));
    333333}
    334334
     
    565565    /* Prepare templates: */
    566566    QString strTable = "<table width=100% cellspacing=1 cellpadding=0>%1</table>";
    567     QString strHeader = "<tr><td width=22><img src='%1'></td>"
     567    QString strHeader = "<tr><td width=22><img width=16 height=16 src='%1'></td>"
    568568                        "<td colspan=2><nobr><b>%2</b></nobr></td></tr>";
    569569    QString strParagraph = "<tr><td colspan=3></td></tr>";
     
    788788    /* Show full composed page & save/restore scroll-bar position: */
    789789    int iScrollBarValue = m_browsers[1]->verticalScrollBar()->value();
    790     m_browsers[1]->setText(strTable.arg(strResult));
     790    setText(m_browsers[1], strResult);
    791791    m_browsers[1]->verticalScrollBar()->setValue(iScrollBarValue);
    792792}
     
    875875}
    876876
     877/* static */
     878void UIVMInfoDialog::setText(QRichTextEdit *pTextEdit, QString strText)
     879{
     880    /* Temporary replace ":/tpixel.png" with "__tpixel__": */
     881    strText.replace(":/tpixel.png", "__tpixel__");
     882    /* Search for all the mentioned pixmaps: */
     883    QRegExp exp(":/([^/]+.png)");
     884    exp.setMinimal(true);
     885    /* Initialize iterator: */
     886    int iPos = exp.indexIn(strText);
     887    while (iPos != -1)
     888    {
     889        /* Replace pixmap record with HiDPI-aware analog: */
     890        strText.replace(iPos, 2, "pixmaps://");
     891        /* Load HiDPI-aware pixmap: */
     892        QPixmap pixmap = UIIconPool::pixmap(exp.cap(0));
     893        /* Register loaded pixmap in text-edit' document: */
     894        pTextEdit->document()->addResource(QTextDocument::ImageResource,
     895                                           QUrl(QString("pixmaps://%1").arg(exp.cap(1))), QVariant(pixmap));
     896        /* Advance iterator: */
     897        iPos = exp.indexIn(strText);
     898    }
     899    /* Replace "__tpixel__" with ":/tpixel.png" back: */
     900    strText.replace("__tpixel__", ":/tpixel.png");
     901    /* Assign text finally: */
     902    pTextEdit->setText(strText);
     903}
     904
  • trunk/src/VBox/Frontends/VirtualBox/src/UIVMInfoDialog.h

    r51312 r51410  
    118118    QString composeArticle(const QString &strBelongsTo, int iSpacesCount = 0);
    119119
     120    /** Helper to set @a strText with HiDPI-aware pixmaps to corresponding @a pTextEdit. */
     121    static void setText(QRichTextEdit *pTextEdit, QString strText);
     122
    120123    /** @name General variables.
    121124     * @{ */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r51401 r51410  
    11131113        "<table border=0 cellspacing=1 cellpadding=0>%1</table>";
    11141114    static const char *sSectionHrefTpl =
    1115         "<tr><td width=22 rowspan=%1 align=left><img src='%2'></td>"
     1115        "<tr><td width=22 rowspan=%1 align=left><img width=16 height=16 src='%2'></td>"
    11161116            "<td colspan=3><b><a href='%3'><nobr>%4</nobr></a></b></td></tr>"
    11171117            "%5"
    11181118        "<tr><td colspan=3><font size=1>&nbsp;</font></td></tr>";
    11191119    static const char *sSectionBoldTpl =
    1120         "<tr><td width=22 rowspan=%1 align=left><img src='%2'></td>"
     1120        "<tr><td width=22 rowspan=%1 align=left><img width=16 height=16 src='%2'></td>"
    11211121            "<td colspan=3><!-- %3 --><b><nobr>%4</nobr></b></td></tr>"
    11221122            "%5"
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