VirtualBox

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


Ignore:
Timestamp:
Mar 5, 2009 3:11:21 PM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4: 3627: Shorten error dialogs - emphasize quoted strings with bold style & bracket uuids with italic style. Adding dot to the end of API part of error/warning message.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h

    r17388 r17408  
    680680    static QString highlight (const QString &aStr, bool aToolTip = false);
    681681
     682    static QString emphasize (const QString &aStr);
     683
    682684    static QString systemLanguageId();
    683685
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r17385 r17408  
    38533853    rx.setMinimal (true);
    38543854    text.replace (rx,
    3855         QString ("\\1%1<nobr>'\\2'</nobr>%2")
    3856                  .arg (strFont). arg (endFont));
     3855        QString ("\\1%1<nobr>'\\2'</nobr>%2").arg (strFont).arg (endFont));
    38573856
    38583857    /* mark UUIDs with color */
     
    38613860        "(\\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\\})"
    38623861        "(?=[:.-!);]?(?:\\s|$))"),
    3863         QString ("\\1%1<nobr>\\2</nobr>%2")
    3864                  .arg (uuidFont). arg (endFont));
     3862        QString ("\\1%1<nobr>\\2</nobr>%2").arg (uuidFont).arg (endFont));
    38653863
    38663864    /* split to paragraphs at \n chars */
     
    38693867    else
    38703868        text.replace ('\n', "<br>");
     3869
     3870    return text;
     3871}
     3872
     3873/**
     3874 *  Reformats the input string @a aStr so that:
     3875 *  - strings in single quotes will be put inside <nobr> and marked
     3876 *    with bold style;
     3877 *  - UUIDs be put inside <nobr> and marked
     3878 *    with italic style;
     3879 *  - replaces new line chars with </p><p> constructs to form paragraphs
     3880 *    (note that <p> and </p> are not appended to the beginnign and to the
     3881 *     end of the string respectively, to allow the result be appended
     3882 *     or prepended to the existing paragraph).
     3883 */
     3884/* static */
     3885QString VBoxGlobal::emphasize (const QString &aStr)
     3886{
     3887    QString strEmphStart ("<b>");
     3888    QString strEmphEnd ("</b>");
     3889    QString uuidEmphStart ("<i>");
     3890    QString uuidEmphEnd ("</i>");
     3891
     3892    QString text = aStr;
     3893
     3894    /* replace special entities, '&' -- first! */
     3895    text.replace ('&', "&amp;");
     3896    text.replace ('<', "&lt;");
     3897    text.replace ('>', "&gt;");
     3898    text.replace ('\"', "&quot;");
     3899
     3900    /* mark strings in single quotes with bold style */
     3901    QRegExp rx = QRegExp ("((?:^|\\s)[(]?)'([^']*)'(?=[:.-!);]?(?:\\s|$))");
     3902    rx.setMinimal (true);
     3903    text.replace (rx,
     3904        QString ("\\1%1<nobr>'\\2'</nobr>%2").arg (strEmphStart).arg (strEmphEnd));
     3905
     3906    /* mark UUIDs with italic style */
     3907    text.replace (QRegExp (
     3908        "((?:^|\\s)[(]?)"
     3909        "(\\{[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\\})"
     3910        "(?=[:.-!);]?(?:\\s|$))"),
     3911        QString ("\\1%1<nobr>\\2</nobr>%2").arg (uuidEmphStart).arg (uuidEmphEnd));
     3912
     3913    /* split to paragraphs at \n chars */
     3914    text.replace ('\n', "</p><p>");
    38713915
    38723916    return text;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r17378 r17408  
    666666             .arg (vbox.GetSettingsFilePath()),
    667667        !res.isOk() ? formatErrorInfo (res)
    668                     : QString ("<p>%1</p>").arg (error));
     668                    : QString ("<p>%1.</p>").arg (vboxGlobal().emphasize (error)));
    669669}
    670670
     
    21902190
    21912191    if (!errorMsg.isEmpty())
    2192         formatted += QString ("<p>%1</p><!--EOM-->")
    2193                               .arg (errorMsg);
     2192        formatted += QString ("<p>%1.</p><!--EOM-->")
     2193                              .arg (vboxGlobal().emphasize (errorMsg));
    21942194
    21952195    if (!errorID.isEmpty())
     
    23282328
    23292329    if (!aInfo.text().isEmpty())
    2330         formatted += QString ("<p>%1</p><!--EOM-->").arg (aInfo.text());
     2330        formatted += QString ("<p>%1.</p><!--EOM-->").arg (vboxGlobal().emphasize (aInfo.text()));
    23312331
    23322332    formatted += "<table bgcolor=#EEEEEE border=0 cellspacing=0 "
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