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:
parent
904627e50a
commit
3bb52e5538
|
@ -74,19 +74,16 @@ ChatLog::ChatLog(QWidget* parent)
|
||||||
workerTimer->setSingleShot(false);
|
workerTimer->setSingleShot(false);
|
||||||
workerTimer->setInterval(100);
|
workerTimer->setInterval(100);
|
||||||
connect(workerTimer, &QTimer::timeout, this, [this] {
|
connect(workerTimer, &QTimer::timeout, this, [this] {
|
||||||
const int stepSize = 200;
|
const int stepSize = 400;
|
||||||
|
|
||||||
workerDy += layout(lastWorkerIndex, lastWorkerIndex+stepSize, useableWidth());
|
workerDy += layout(lastWorkerIndex, lastWorkerIndex+stepSize, useableWidth());
|
||||||
|
|
||||||
qDebug() << "working... " << lastWorkerIndex << "/" << lines.size();
|
|
||||||
|
|
||||||
if(!visibleLines.isEmpty())
|
if(!visibleLines.isEmpty())
|
||||||
{
|
{
|
||||||
int firstVisLineIndex = visibleLines.first()->getRowIndex();
|
int firstVisLineIndex = visibleLines.first()->getRowIndex();
|
||||||
int delta = firstVisLineIndex - lastWorkerIndex;
|
int delta = firstVisLineIndex - lastWorkerIndex;
|
||||||
if(delta > 0 && delta < stepSize)
|
if(delta > 0 && delta < stepSize)
|
||||||
{
|
{
|
||||||
//qDebug() << "delta " << delta << "fvl " << firstVisLineIndex;
|
|
||||||
lastWorkerIndex += delta+1;
|
lastWorkerIndex += delta+1;
|
||||||
|
|
||||||
if(!stickToBottom())
|
if(!stickToBottom())
|
||||||
|
@ -96,7 +93,9 @@ ChatLog::ChatLog(QWidget* parent)
|
||||||
checkVisibility();
|
checkVisibility();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
lastWorkerIndex += stepSize;
|
lastWorkerIndex += stepSize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
lastWorkerIndex += stepSize;
|
lastWorkerIndex += stepSize;
|
||||||
|
@ -111,8 +110,6 @@ ChatLog::ChatLog(QWidget* parent)
|
||||||
updateSceneRect();
|
updateSceneRect();
|
||||||
if(stb)
|
if(stb)
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
|
|
||||||
qDebug() << "working... done!";
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "src/misc/smileypack.h"
|
#include "src/misc/smileypack.h"
|
||||||
#include "src/misc/style.h"
|
#include "src/misc/style.h"
|
||||||
|
|
||||||
#define NAME_COL_WIDTH 75.0
|
#define NAME_COL_WIDTH 90.0
|
||||||
#define TIME_COL_WIDTH 90.0
|
#define TIME_COL_WIDTH 90.0
|
||||||
|
|
||||||
ChatMessage::ChatMessage()
|
ChatMessage::ChatMessage()
|
||||||
|
@ -39,9 +39,11 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt
|
||||||
|
|
||||||
QString text = toHtmlChars(rawMessage);
|
QString text = toHtmlChars(rawMessage);
|
||||||
|
|
||||||
|
//smileys
|
||||||
if(Settings::getInstance().getUseEmoticons())
|
if(Settings::getInstance().getUseEmoticons())
|
||||||
text = SmileyPack::getInstance().smileyfied(text);
|
text = SmileyPack::getInstance().smileyfied(text);
|
||||||
|
|
||||||
|
//quotes (green text)
|
||||||
text = detectQuotes(detectAnchors(text));
|
text = detectQuotes(detectAnchors(text));
|
||||||
|
|
||||||
if(isAction)
|
if(isAction)
|
||||||
|
@ -54,7 +56,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt
|
||||||
text = "<div class=alert>" + text + "</div>";
|
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 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));
|
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 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));
|
msg->addColumn(new Text(date.toString(Settings::getInstance().getTimestampFormat()), Style::getFont(Style::Big)), ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user