1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

tweaks, colorize the blue * in /me

This commit is contained in:
krepa098 2015-01-10 22:21:33 +01:00
parent 904627e50a
commit 3bb52e5538
2 changed files with 8 additions and 9 deletions

View File

@ -74,19 +74,16 @@ ChatLog::ChatLog(QWidget* parent)
workerTimer->setSingleShot(false);
workerTimer->setInterval(100);
connect(workerTimer, &QTimer::timeout, this, [this] {
const int stepSize = 200;
const int stepSize = 400;
workerDy += layout(lastWorkerIndex, lastWorkerIndex+stepSize, useableWidth());
qDebug() << "working... " << lastWorkerIndex << "/" << lines.size();
if(!visibleLines.isEmpty())
{
int firstVisLineIndex = visibleLines.first()->getRowIndex();
int delta = firstVisLineIndex - lastWorkerIndex;
if(delta > 0 && delta < stepSize)
{
//qDebug() << "delta " << delta << "fvl " << firstVisLineIndex;
lastWorkerIndex += delta+1;
if(!stickToBottom())
@ -96,8 +93,10 @@ ChatLog::ChatLog(QWidget* parent)
checkVisibility();
}
else
{
lastWorkerIndex += stepSize;
}
}
else
lastWorkerIndex += stepSize;
@ -111,8 +110,6 @@ ChatLog::ChatLog(QWidget* parent)
updateSceneRect();
if(stb)
scrollToBottom();
qDebug() << "working... done!";
}
});
}

View File

@ -25,7 +25,7 @@
#include "src/misc/smileypack.h"
#include "src/misc/style.h"
#define NAME_COL_WIDTH 75.0
#define NAME_COL_WIDTH 90.0
#define TIME_COL_WIDTH 90.0
ChatMessage::ChatMessage()
@ -39,9 +39,11 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt
QString text = toHtmlChars(rawMessage);
//smileys
if(Settings::getInstance().getUseEmoticons())
text = SmileyPack::getInstance().smileyfied(text);
//quotes (green text)
text = detectQuotes(detectAnchors(text));
if(isAction)
@ -54,7 +56,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt
text = "<div class=alert>" + text + "</div>";
}
msg->addColumn(new Text(isAction ? "*" : sender, isMe ? Style::getFont(Style::BigBold) : Style::getFont(Style::Big), true), ColumnFormat(NAME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
msg->addColumn(new Text(isAction ? "<div class=action>*</div>" : sender, isMe ? Style::getFont(Style::BigBold) : Style::getFont(Style::Big), isAction ? false : true), ColumnFormat(NAME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
msg->addColumn(new Text(text, Style::getFont(Style::Big), false, rawMessage), ColumnFormat(1.0, ColumnFormat::VariableSize));
msg->addColumn(new Spinner(QSizeF(16, 16)), ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
@ -77,7 +79,7 @@ ChatMessage::Ptr ChatMessage::createChatInfoMessage(const QString &rawMessage, S
}
msg->addColumn(new Image(QSizeF(16, 16), img), ColumnFormat(NAME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
msg->addColumn(new Text(rawMessage, Style::getFont(Style::Big), false, rawMessage), ColumnFormat(1.0, ColumnFormat::VariableSize));
msg->addColumn(new Text(rawMessage, Style::getFont(Style::Big), false, rawMessage), ColumnFormat(1.0, ColumnFormat::VariableSize, ColumnFormat::Center));
msg->addColumn(new Text(date.toString(Settings::getInstance().getTimestampFormat()), Style::getFont(Style::Big)), ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
return msg;