void Chat::insertMessage(const QString& alias, const QString& msg, const QColor& color) { Q_ASSERT(this->_options); int scrollBarValue = -1; QScrollBar* scrollBar = this->outputTextBrowser->verticalScrollBar(); if (scrollBar && scrollBar->value() != scrollBar->maximum()) scrollBarValue = scrollBar->value(); QString html("<p>"); html += QString("<span style='color:%1;'>%2 %3</span>").arg(color.name()).arg(getFormatedDateTime()).arg(alias); html.append(": </p>"); this->outputTextBrowser->moveCursor(QTextCursor::End); this->outputTextBrowser->insertHtml(html); replaceUrls(msg); this->outputTextBrowser->insertHtml("<br />"); if (this->_options->chatWidget->smileys()) insertSmileys(); if (scrollBar) { if (scrollBarValue != -1) scrollBar->setValue(scrollBarValue); else scrollBar->setValue(scrollBar->maximum()); } }
const QString QtChatUtils::decodeMessage(const QString & message) { QTextDocument tmp; tmp.setHtml(message); // Replace URLS QString toReturn = replaceUrls(tmp.toPlainText(), message); //Replace Images toReturn = replaceImgUrls(toReturn); //toReturn = replaceYoutubeAddress(toReturn); //VOXOX CHANCE CJC We only want to use the font color from the selected style. toReturn = removeFontTags(toReturn); toReturn = text2Emoticon( toReturn ); //End VoxOx return toReturn; }