X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fuisupport%2Fuistyle.cpp;h=5f0f717592996407e4450ecbabbdb00b6080f1ce;hb=8a91d275138941cc91704dd462efaf70c5f9732c;hp=1740185b0565e45bdc6a262c4135b02b7efd3a7f;hpb=4bfbd8dcbcb398302aaad0b6707c561760d7a7ac;p=quassel.git diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index 1740185b..5f0f7175 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-07 by the Quassel IRC Team * + * Copyright (C) 2005-08 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -25,7 +25,9 @@ UiStyle::UiStyle(const QString &settingsKey) : _settingsKey(settingsKey) { // Default format QTextCharFormat def; def.setForeground(QBrush("#000000")); - def.setFont(QFont("Mono",12)); + //def.setFont(QFont("Courier", 10)); + def.font().setFixedPitch(true); + def.font().setStyleHint(QFont::TypeWriter); _defaultFormats = QVector(NumFormatTypes, def); _customFormats = QVector(NumFormatTypes, QTextFormat().toCharFormat()); @@ -77,6 +79,9 @@ UiStyle::UiStyle(const QString &settingsKey) : _settingsKey(settingsKey) { QTextCharFormat fgf, bgf; fgf.setForeground(QBrush(QColor(colors[i]))); setFormat((FormatType)(FgCol00 + i), fgf, Settings::Default); bgf.setBackground(QBrush(QColor(colors[i]))); setFormat((FormatType)(BgCol00 + i), bgf, Settings::Default); + //FIXME fix the havoc caused by ColorSettingsPage + setFormat((FormatType)(FgCol00 + i), fgf, Settings::Custom); + setFormat((FormatType)(BgCol00 + i), bgf, Settings::Custom); } // Set a few more standard formats @@ -125,7 +130,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); @@ -133,7 +139,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); @@ -156,6 +162,8 @@ UiStyle::StyledText UiStyle::styleString(QString s) { length = 4; } else { int color = 10 * s[pos+4].digitValue() + s[pos+5].digitValue(); + //TODO: use 99 as transparent color (re mirc color "standard") + color &= 0x0f; int *colptr; FormatType coltype; if(s[pos+3] == 'f') { // foreground colptr = &fgCol; coltype = FgCol00; @@ -231,5 +239,3 @@ QTextCharFormat UiStyle::mergedFormat(QList formatList) { } return fmt; } - -