* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
+#include <QApplication>
#include "uistyle.h"
#include "uistylesettings.h"
// Default format
QTextCharFormat def;
def.setForeground(QBrush("#000000"));
- def.setFont(QFont("Mono",12));
+ def.setFont(QFont("Monospace", QApplication::font().pointSize()));
+ def.font().setFixedPitch(true);
+ def.font().setStyleHint(QFont::TypeWriter);
_defaultFormats = QVector<QTextCharFormat>(NumFormatTypes, def);
_customFormats = QVector<QTextCharFormat>(NumFormatTypes, QTextFormat().toCharFormat());
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
return _formatCodes.key(ftype);
}
-UiStyle::StyledText UiStyle::styleString(QString s) {
+UiStyle::StyledText UiStyle::styleString(const QString &_s) {
+ QString s = _s;
StyledText result;
QList<FormatType> fmtList;
fmtList.append(None);
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);
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;
}
return fmt;
}
-
-