34 #include <QCryptographicHash>
40 #define NAME_COL_WIDTH 90.0
41 #define TIME_COL_WIDTH 90.0
52 const QDateTime& date,
bool colorizeName)
56 QString text = rawMessage.toHtmlEscaped();
57 QString senderText = sender;
82 text =
wrapDiv(QString(
"%1 %2").arg(sender.toHtmlEscaped(), text),
"action");
92 QFont authorFont = baseFont;
94 authorFont.setBold(
true);
98 QByteArray hash = QCryptographicHash::hash((sender.toUtf8()), QCryptographicHash::Sha256);
99 float lightness = color.lightnessF();
101 lightness = lightness*0.5 + 0.3;
111 msg->addColumn(
new Text(senderText, authorFont,
true, sender, textType, color),
113 msg->addColumn(
new Text(text, baseFont,
false, ((type ==
ACTION) && isMe)
114 ? QString(
"%1 %2").arg(sender, rawMessage)
139 QString text = rawMessage.toHtmlEscaped();
156 msg->addColumn(
new Image(QSize(18, 18), img),
158 msg->addColumn(
new Text(
"<b>" + text +
"</b>", baseFont,
false, text),
167 ToxFile file,
bool isMe,
const QDateTime& date)
172 QFont authorFont = baseFont;
174 authorFont.setBold(
true);
177 msg->addColumn(
new Text(sender, authorFont,
true),
202 msg->addColumn(
new Text(
"[user]...", baseFont,
false,
""),
220 baseFont.setPixelSize(baseFont.pixelSize() + 2);
221 baseFont.setBold(
true);
223 msg->addColumn(
new Text(QObject::tr(
"Reformatting text...",
"Waiting for text to be reformatted"), baseFont,
false,
""),
278 QStringList messageLines = str.split(
"\n");
280 for (
int i = 0; i < messageLines.size(); ++i) {
284 if (QRegExp(
"^(>|>).*").exactMatch(messageLines[i])) {
285 if (i > 0 || type !=
ACTION)
286 quotedText +=
"<span class=quote>" + messageLines[i] +
" </span>";
288 quotedText += messageLines[i];
290 quotedText += messageLines[i];
293 if (i < messageLines.size() - 1) {
303 return QString(
"<p class=%1>%2</p>").arg(div, QString(str));