diff options
Diffstat (limited to 'kopete/protocols/irc/ksparser.cpp')
-rw-r--r-- | kopete/protocols/irc/ksparser.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/kopete/protocols/irc/ksparser.cpp b/kopete/protocols/irc/ksparser.cpp index 66545688..f9029e84 100644 --- a/kopete/protocols/irc/ksparser.cpp +++ b/kopete/protocols/irc/ksparser.cpp @@ -23,15 +23,15 @@ Modified by Jason Keirstead <jason@keirstead.org> #include <knotifyclient.h> #include <kdebug.h> -#include <qbuffer.h> -#include <qdatastream.h> -#include <qstylesheet.h> +#include <tqbuffer.h> +#include <tqdatastream.h> +#include <tqstylesheet.h> #include "ksparser.h" #include <stdlib.h> KSParser KSParser::m_parser; -const QColor KSParser::IRC_Colors[17]= +const TQColor KSParser::IRC_Colors[17]= { Qt::white, Qt::black, @@ -49,10 +49,10 @@ const QColor KSParser::IRC_Colors[17]= Qt::magenta, Qt::darkGray, Qt::gray, - QColor() // default invalid color, must be the last + TQColor() // default invalid color, must be the last }; -const QRegExp KSParser::sm_colorsModeRegexp("(\\d{1,2})(?:,(\\d{1,2}))?"); +const TQRegExp KSParser::sm_colorsModeRegexp("(\\d{1,2})(?:,(\\d{1,2}))?"); template <typename _TYPE_> inline void swap(_TYPE_ &o1, _TYPE_ &o2) @@ -73,31 +73,31 @@ KSParser::~KSParser() } /* NOTE: If thread corruption are seen simply ad a qlock here */ -QCString KSParser::parse(const QCString &message) +TQCString KSParser::parse(const TQCString &message) { return m_parser._parse(message); } -QCString KSParser::_parse(const QCString &message) +TQCString KSParser::_parse(const TQCString &message) { - QCString data( message.size() * 2 ); - QBuffer buff( data ); + TQCString data( message.size() * 2 ); + TQBuffer buff( data ); buff.open( IO_WriteOnly ); m_tags.clear(); m_attributes.clear(); - QRegExp colorsModeRegexp(sm_colorsModeRegexp); + TQRegExp colorsModeRegexp(sm_colorsModeRegexp); // should be set to the current default colors .... - QColor fgColor; /*KopeteMesage::fg().name()*/ - QColor bgColor; /*KopeteMesage::bg().name()*/ + TQColor fgColor; /*KopeteMesage::fg().name()*/ + TQColor bgColor; /*KopeteMesage::bg().name()*/ uint chars = 0; for(uint i = 0; i < message.length(); ++i) { - const QChar &cur = message[i]; - QString toAppend; + const TQChar &cur = message[i]; + TQString toAppend; switch (cur) { @@ -108,7 +108,7 @@ QCString KSParser::_parse(const QCString &message) if (colorsModeRegexp.search(message, i+1) == (int)i+1) { i += colorsModeRegexp.matchedLength(); // + 1 will be added by ++ - QString tagStyle; + TQString tagStyle; fgColor = ircColor(colorsModeRegexp.cap(1)); bgColor = ircColor(colorsModeRegexp.cap(2)); @@ -117,17 +117,17 @@ QCString KSParser::_parse(const QCString &message) } else { - toAppend = popTag(QString::fromLatin1("span")); + toAppend = popTag(TQString::fromLatin1("span")); } break; case 0x07: //System bell: ^G - KNotifyClient::beep( QString::fromLatin1("IRC beep event received in a message") ); + KNotifyClient::beep( TQString::fromLatin1("IRC beep event received in a message") ); break; case '\t': // 0x09 - toAppend = QString::fromLatin1(" "); + toAppend = TQString::fromLatin1(" "); break; case '\n': // 0x0D - toAppend= QString::fromLatin1("<br/>"); + toAppend= TQString::fromLatin1("<br/>"); break; case 0x0D: // Italics: ^N toAppend = toggleTag("i"); @@ -145,23 +145,23 @@ QCString KSParser::_parse(const QCString &message) toAppend = toggleTag("u"); break; case '<': - toAppend = QString::fromLatin1("<"); + toAppend = TQString::fromLatin1("<"); break; case '>': - toAppend = QString::fromLatin1(">"); + toAppend = TQString::fromLatin1(">"); break; default: - if (cur < QChar(' ')) // search for control characters - toAppend = QString::fromLatin1("<%1>").arg(cur, 2, 16).upper(); + if (cur < TQChar(' ')) // search for control characters + toAppend = TQString::fromLatin1("<%1>").arg(cur, 2, 16).upper(); else - toAppend = QStyleSheet::escape(cur); + toAppend = TQStyleSheet::escape(cur); } chars += toAppend.length(); buff.writeBlock( toAppend.latin1(), toAppend.length() ); } - QString toAppend = popAll(); + TQString toAppend = popAll(); chars += toAppend.length(); buff.writeBlock( toAppend.latin1(), toAppend.length() ); @@ -174,9 +174,9 @@ QCString KSParser::_parse(const QCString &message) return data; } -QString KSParser::pushTag(const QString &tag, const QString &attributes) +TQString KSParser::pushTag(const TQString &tag, const TQString &attributes) { - QString res; + TQString res; m_tags.push(tag); if(!m_attributes.contains(tag)) m_attributes.insert(tag, attributes); @@ -188,28 +188,28 @@ QString KSParser::pushTag(const QString &tag, const QString &attributes) return res + ">"; } -QString KSParser::pushColorTag(const QColor &fgColor, const QColor &bgColor) +TQString KSParser::pushColorTag(const TQColor &fgColor, const TQColor &bgColor) { - QString tagStyle; + TQString tagStyle; if (fgColor.isValid()) - tagStyle += QString::fromLatin1("color:%1;").arg(fgColor.name()); + tagStyle += TQString::fromLatin1("color:%1;").arg(fgColor.name()); if (bgColor.isValid()) - tagStyle += QString::fromLatin1("background-color:%1;").arg(bgColor.name()); + tagStyle += TQString::fromLatin1("background-color:%1;").arg(bgColor.name()); if(!tagStyle.isEmpty()) - tagStyle = QString::fromLatin1("style=\"%1\"").arg(tagStyle); + tagStyle = TQString::fromLatin1("style=\"%1\"").arg(tagStyle); - return pushTag(QString::fromLatin1("span"), tagStyle);; + return pushTag(TQString::fromLatin1("span"), tagStyle);; } -QString KSParser::popTag(const QString &tag) +TQString KSParser::popTag(const TQString &tag) { if (!m_tags.contains(tag)) - return QString::null; + return TQString::null; - QString res; - QValueStack<QString> savedTags; + TQString res; + TQValueStack<TQString> savedTags; while(m_tags.top() != tag) { savedTags.push(m_tags.pop()); @@ -222,21 +222,21 @@ QString KSParser::popTag(const QString &tag) return res; } -QString KSParser::toggleTag(const QString &tag) +TQString KSParser::toggleTag(const TQString &tag) { return m_attributes.contains(tag)?popTag(tag):pushTag(tag); } -QString KSParser::popAll() +TQString KSParser::popAll() { - QString res; + TQString res; while(!m_tags.isEmpty()) res.append("</" + m_tags.pop() + ">"); m_attributes.clear(); return res; } -QColor KSParser::ircColor(const QString &color) +TQColor KSParser::ircColor(const TQString &color) { bool success; unsigned int intColor = color.toUInt(&success); @@ -244,19 +244,19 @@ QColor KSParser::ircColor(const QString &color) if (success) return ircColor(intColor); else - return QColor(); + return TQColor(); } -QColor KSParser::ircColor(unsigned int color) +TQColor KSParser::ircColor(unsigned int color) { - unsigned int maxcolor = sizeof(IRC_Colors)/sizeof(QColor); + unsigned int maxcolor = sizeof(IRC_Colors)/sizeof(TQColor); return color<=maxcolor?IRC_Colors[color]:IRC_Colors[maxcolor]; } -int KSParser::colorForHTML(const QString &html) +int KSParser::colorForHTML(const TQString &html) { - QColor color(html); - for(uint i=0; i<sizeof(IRC_Colors)/sizeof(QColor); i++) + TQColor color(html); + for(uint i=0; i<sizeof(IRC_Colors)/sizeof(TQColor); i++) { if(IRC_Colors[i] == color) return i; |