X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fuistyle.cpp;h=94c9742bef3b9e57042922eb82cddca07006cb63;hb=40fd2239205d9926296ccf60474a1aeb53c06c53;hp=017fee24689efd5e6953fe4587bafd7d5d1c4b57;hpb=5ee9c75fb9301473d40ca1f219201950529096f7;p=quassel.git diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index 017fee24..94c9742b 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -17,6 +17,7 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include #include "uistyle.h" #include "uistylesettings.h" @@ -25,7 +26,8 @@ UiStyle::UiStyle(const QString &settingsKey) : _settingsKey(settingsKey) { // Default format QTextCharFormat def; def.setForeground(QBrush("#000000")); - //def.setFont(QFont("Courier", 10)); + def.setFont(QFont("Monospace", QApplication::font().pointSize())); + def.font().setFixedPitch(true); def.font().setStyleHint(QFont::TypeWriter); _defaultFormats = QVector(NumFormatTypes, def); _customFormats = QVector(NumFormatTypes, QTextFormat().toCharFormat()); @@ -129,7 +131,8 @@ QString UiStyle::formatCode(FormatType ftype) const { return _formatCodes.key(ftype); } -UiStyle::StyledText UiStyle::styleString(QString s) { +UiStyle::StyledText UiStyle::styleString(const QString &_s) { + QString s = _s; StyledText result; QList fmtList; fmtList.append(None); @@ -137,7 +140,7 @@ UiStyle::StyledText UiStyle::styleString(QString s) { curFmtRng.format = format(None); curFmtRng.start = 0; result.formats.append(curFmtRng); - int pos = 0; int length; + int pos = 0; int length = 0; int fgCol = -1, bgCol = -1; // marks current mIRC color for(;;) { pos = s.indexOf('%', pos); @@ -237,5 +240,3 @@ QTextCharFormat UiStyle::mergedFormat(QList formatList) { } return fmt; } - -