Changeset 17408 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Mar 5, 2009 3:11:21 PM (16 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r17388 r17408 680 680 static QString highlight (const QString &aStr, bool aToolTip = false); 681 681 682 static QString emphasize (const QString &aStr); 683 682 684 static QString systemLanguageId(); 683 685 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r17385 r17408 3853 3853 rx.setMinimal (true); 3854 3854 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)); 3857 3856 3858 3857 /* mark UUIDs with color */ … … 3861 3860 "(\\{[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}\\})" 3862 3861 "(?=[:.-!);]?(?:\\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)); 3865 3863 3866 3864 /* split to paragraphs at \n chars */ … … 3869 3867 else 3870 3868 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 */ 3885 QString 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 ('&', "&"); 3896 text.replace ('<', "<"); 3897 text.replace ('>', ">"); 3898 text.replace ('\"', """); 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>"); 3871 3915 3872 3916 return text; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
r17378 r17408 666 666 .arg (vbox.GetSettingsFilePath()), 667 667 !res.isOk() ? formatErrorInfo (res) 668 : QString ("<p>%1 </p>").arg (error));668 : QString ("<p>%1.</p>").arg (vboxGlobal().emphasize (error))); 669 669 } 670 670 … … 2190 2190 2191 2191 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)); 2194 2194 2195 2195 if (!errorID.isEmpty()) … … 2328 2328 2329 2329 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())); 2331 2331 2332 2332 formatted += "<table bgcolor=#EEEEEE border=0 cellspacing=0 "
Note:
See TracChangeset
for help on using the changeset viewer.