cleaned up ChatStyle.cpp from obvious comments

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7703 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-11-23 19:22:57 +00:00
parent 99274d1a05
commit 7b8cdd685d

View File

@ -291,20 +291,20 @@ QString ChatStyle::formatMessage(enumFormatMessage type, const QString &name, co
if ((str.startsWith("<body>")) && (str.endsWith( "</body>"))) {
str.remove(0, 6);
str.chop( 7);
}//if ((str.startsWith("<body>")) && (str.endsWith( "</body>")))
}
//remove first <span> if it is without attribute
if ((str.startsWith("<span>")) && (str.endsWith( "</span>"))) {
str.remove(0, 6);
str.chop( 7);
}//if ((str.startsWith("<span>")) && (str.endsWith( "</span>")))
}
messageBody += str;
} else {
QDomText text = it.firstChild().toText();
styleOptimized = text.data();
}//if (it.nodeName().toLower() != "style")
}//foreach (QDomElement it, body.childNodes())
}//if (!body.isNull()){
}//if (docOK = doc.setContent(text, &errorMsg, &errorLine, &errorColumn))
}
}
}
}
if (messageBody.isEmpty()) messageBody = message;
QString style = m_style[type];
@ -329,30 +329,30 @@ QString ChatStyle::formatMessage(enumFormatMessage type, const QString &name, co
case FORMATMSG_SYSTEM:
style = getStyle(m_styleDir, m_styleVariant, GETSTYLE_SYSTEM);
break;
}//switch (type)
}
if (style.isEmpty()) {
// default style
style = "<table width='100%'><tr><td><b>%name%</b></td><td width='130' align='right'>%time%</td></tr></table><table width='100%'><tr><td>%message%</td></tr></table>";
}//if (style.isEmpty())
}
style = style.replace("\r","").replace("\n","").replace("\t","") ;
m_style[type] = style;
}//if (style.isEmpty())
}
#ifdef COLORED_NICKNAMES
QColor color;
if (flag & CHAT_FORMATMSG_SYSTEM) {
color = Qt::darkBlue;
} else {//if ( flag & CHAT_FORMATMSG_SYSTEM
} else {
// Calculate color from the name
uint hash = 0;
for (int i = 0; i < name.length(); ++i) {
hash = (((hash << 1) + (hash >> 14)) ^ ((int) name[i].toLatin1())) & 0x3fff;
}//for (int i = 0; i < name.length(); ++i)
}
color.setHsv(hash, 255, 150);
}//if (flag & CHAT_FORMATMSG_SYSTEM)
}
#else
Q_UNUSED(flag);
#endif
@ -368,8 +368,8 @@ QString ChatStyle::formatMessage(enumFormatMessage type, const QString &name, co
int pos = formatMsg.indexOf("</style>") ;
if ( pos >= 0 ) {
formatMsg.insert(pos, styleOptimized) ;
}//if (pos >= 0)
}//if (!styleOptimized.isEmpty())
}
}
return formatMsg;
}