mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: edit load history when scrolling
This commit is contained in:
parent
b807998fe9
commit
0a9e72020e
|
@ -363,6 +363,7 @@ void ChatLog::reposition(int start, int end, qreal deltaY)
|
||||||
|
|
||||||
void ChatLog::insertChatlineAtBottom(ChatLine::Ptr l)
|
void ChatLog::insertChatlineAtBottom(ChatLine::Ptr l)
|
||||||
{
|
{
|
||||||
|
numRemove = 0;
|
||||||
if (!l.get())
|
if (!l.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -386,9 +387,14 @@ void ChatLog::insertChatlineAtBottom(ChatLine::Ptr l)
|
||||||
|
|
||||||
void ChatLog::insertChatlineAtBottom(const QList<ChatLine::Ptr>& newLines)
|
void ChatLog::insertChatlineAtBottom(const QList<ChatLine::Ptr>& newLines)
|
||||||
{
|
{
|
||||||
|
numRemove = 0;
|
||||||
if (newLines.isEmpty())
|
if (newLines.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (lines.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
|
||||||
|
removeFirsts(DEF_NUM_MSG_TO_LOAD);
|
||||||
|
}
|
||||||
|
|
||||||
for (ChatLine::Ptr l : newLines) {
|
for (ChatLine::Ptr l : newLines) {
|
||||||
l->setRow(lines.size());
|
l->setRow(lines.size());
|
||||||
l->addToScene(scene);
|
l->addToScene(scene);
|
||||||
|
@ -397,11 +403,17 @@ void ChatLog::insertChatlineAtBottom(const QList<ChatLine::Ptr>& newLines)
|
||||||
}
|
}
|
||||||
|
|
||||||
layout(lines.last()->getRow(), lines.size(), useableWidth());
|
layout(lines.last()->getRow(), lines.size(), useableWidth());
|
||||||
startResizeWorker();
|
|
||||||
|
if (visibleLines.size() > 1) {
|
||||||
|
startResizeWorker(visibleLines[1]);
|
||||||
|
} else {
|
||||||
|
startResizeWorker();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatLog::insertChatlineOnTop(ChatLine::Ptr l)
|
void ChatLog::insertChatlineOnTop(ChatLine::Ptr l)
|
||||||
{
|
{
|
||||||
|
numRemove = 0;
|
||||||
if (!l.get())
|
if (!l.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -410,6 +422,7 @@ void ChatLog::insertChatlineOnTop(ChatLine::Ptr l)
|
||||||
|
|
||||||
void ChatLog::insertChatlinesOnTop(const QList<ChatLine::Ptr>& newLines)
|
void ChatLog::insertChatlinesOnTop(const QList<ChatLine::Ptr>& newLines)
|
||||||
{
|
{
|
||||||
|
numRemove = 0;
|
||||||
if (newLines.isEmpty())
|
if (newLines.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -429,6 +442,10 @@ void ChatLog::insertChatlinesOnTop(const QList<ChatLine::Ptr>& newLines)
|
||||||
combLines.push_back(l);
|
combLines.push_back(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lines.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
|
||||||
|
removeLasts(DEF_NUM_MSG_TO_LOAD);
|
||||||
|
}
|
||||||
|
|
||||||
// add the old lines
|
// add the old lines
|
||||||
for (ChatLine::Ptr l : lines) {
|
for (ChatLine::Ptr l : lines) {
|
||||||
l->setRow(i++);
|
l->setRow(i++);
|
||||||
|
@ -440,7 +457,12 @@ void ChatLog::insertChatlinesOnTop(const QList<ChatLine::Ptr>& newLines)
|
||||||
scene->setItemIndexMethod(oldIndexMeth);
|
scene->setItemIndexMethod(oldIndexMeth);
|
||||||
|
|
||||||
// redo layout
|
// redo layout
|
||||||
startResizeWorker();
|
if (visibleLines.size() > 1) {
|
||||||
|
startResizeWorker(visibleLines[1]);
|
||||||
|
} else {
|
||||||
|
startResizeWorker();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatLog::stickToBottom() const
|
bool ChatLog::stickToBottom() const
|
||||||
|
@ -454,19 +476,22 @@ void ChatLog::scrollToBottom()
|
||||||
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatLog::startResizeWorker()
|
void ChatLog::startResizeWorker(ChatLine::Ptr anchorLine)
|
||||||
{
|
{
|
||||||
if (lines.empty()) {
|
if (lines.empty()) {
|
||||||
|
isScroll = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (re)start the worker
|
// (re)start the worker
|
||||||
if (!workerTimer->isActive()) {
|
if (!workerTimer->isActive()) {
|
||||||
// these values must not be reevaluated while the worker is running
|
// these values must not be reevaluated while the worker is running
|
||||||
workerStb = stickToBottom();
|
if (anchorLine) {
|
||||||
|
workerAnchorLine = anchorLine;
|
||||||
if (!visibleLines.empty())
|
workerStb = false;
|
||||||
workerAnchorLine = visibleLines.first();
|
} else {
|
||||||
|
workerStb = stickToBottom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch to busy scene displaying the busy notification if there is a lot
|
// switch to busy scene displaying the busy notification if there is a lot
|
||||||
|
@ -653,8 +678,13 @@ void ChatLog::scrollToLine(ChatLine::Ptr line)
|
||||||
if (!line.get())
|
if (!line.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
updateSceneRect();
|
if (workerTimer->isActive()) {
|
||||||
verticalScrollBar()->setValue(line->sceneBoundingRect().top());
|
workerAnchorLine = line;
|
||||||
|
workerStb = false;
|
||||||
|
} else {
|
||||||
|
updateSceneRect();
|
||||||
|
verticalScrollBar()->setValue(line->sceneBoundingRect().top()); // NOTE: start here
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatLog::selectAll()
|
void ChatLog::selectAll()
|
||||||
|
@ -696,6 +726,7 @@ void ChatLog::removeFirsts(const int num)
|
||||||
{
|
{
|
||||||
if (lines.size() > num) {
|
if (lines.size() > num) {
|
||||||
lines.erase(lines.begin(), lines.begin()+num);
|
lines.erase(lines.begin(), lines.begin()+num);
|
||||||
|
numRemove = num;
|
||||||
} else {
|
} else {
|
||||||
lines.clear();
|
lines.clear();
|
||||||
}
|
}
|
||||||
|
@ -709,11 +740,22 @@ void ChatLog::removeLasts(const int num)
|
||||||
{
|
{
|
||||||
if (lines.size() > num) {
|
if (lines.size() > num) {
|
||||||
lines.erase(lines.end()-num, lines.end());
|
lines.erase(lines.end()-num, lines.end());
|
||||||
|
numRemove = num;
|
||||||
} else {
|
} else {
|
||||||
lines.clear();
|
lines.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatLog::setScroll(const bool scroll)
|
||||||
|
{
|
||||||
|
isScroll = scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ChatLog::getNumRemove() const
|
||||||
|
{
|
||||||
|
return numRemove;
|
||||||
|
}
|
||||||
|
|
||||||
void ChatLog::forceRelayout()
|
void ChatLog::forceRelayout()
|
||||||
{
|
{
|
||||||
startResizeWorker();
|
startResizeWorker();
|
||||||
|
@ -762,6 +804,7 @@ void ChatLog::checkVisibility(bool causedWheelEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (causedWheelEvent) {
|
if (causedWheelEvent) {
|
||||||
|
qDebug() << "causedWheelEvent";
|
||||||
if (lowerBound != lines.cend() && lowerBound->get()->row == 0) {
|
if (lowerBound != lines.cend() && lowerBound->get()->row == 0) {
|
||||||
emit loadHistoryLower();
|
emit loadHistoryLower();
|
||||||
} else if (upperBound == lines.cend()) {
|
} else if (upperBound == lines.cend()) {
|
||||||
|
@ -905,7 +948,8 @@ void ChatLog::onWorkerTimeout()
|
||||||
// hidden during busy screen
|
// hidden during busy screen
|
||||||
verticalScrollBar()->show();
|
verticalScrollBar()->show();
|
||||||
|
|
||||||
emit workerTimeoutFinished();
|
isScroll = true;
|
||||||
|
emit workerTimeoutFinished();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -972,6 +1016,10 @@ void ChatLog::focusOutEvent(QFocusEvent* ev)
|
||||||
|
|
||||||
void ChatLog::wheelEvent(QWheelEvent *event)
|
void ChatLog::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
|
if (!isScroll) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QGraphicsView::wheelEvent(event);
|
QGraphicsView::wheelEvent(event);
|
||||||
checkVisibility(true);
|
checkVisibility(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ class QTimer;
|
||||||
class ChatLineContent;
|
class ChatLineContent;
|
||||||
struct ToxFile;
|
struct ToxFile;
|
||||||
|
|
||||||
|
static const auto DEF_NUM_MSG_TO_LOAD = 100;
|
||||||
|
|
||||||
class ChatLog : public QGraphicsView
|
class ChatLog : public QGraphicsView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -58,6 +60,8 @@ public:
|
||||||
void reloadTheme();
|
void reloadTheme();
|
||||||
void removeFirsts(const int num);
|
void removeFirsts(const int num);
|
||||||
void removeLasts(const int num);
|
void removeLasts(const int num);
|
||||||
|
void setScroll(const bool scroll);
|
||||||
|
int getNumRemove() const;
|
||||||
|
|
||||||
QString getSelectedText() const;
|
QString getSelectedText() const;
|
||||||
|
|
||||||
|
@ -101,7 +105,7 @@ protected:
|
||||||
void updateSceneRect();
|
void updateSceneRect();
|
||||||
void checkVisibility(bool causedWheelEvent = false);
|
void checkVisibility(bool causedWheelEvent = false);
|
||||||
void scrollToBottom();
|
void scrollToBottom();
|
||||||
void startResizeWorker();
|
void startResizeWorker(ChatLine::Ptr anchorLine = nullptr);
|
||||||
|
|
||||||
virtual void mouseDoubleClickEvent(QMouseEvent* ev) final override;
|
virtual void mouseDoubleClickEvent(QMouseEvent* ev) final override;
|
||||||
virtual void mousePressEvent(QMouseEvent* ev) final override;
|
virtual void mousePressEvent(QMouseEvent* ev) final override;
|
||||||
|
@ -165,6 +169,7 @@ private:
|
||||||
int clickCount = 0;
|
int clickCount = 0;
|
||||||
QPoint lastClickPos;
|
QPoint lastClickPos;
|
||||||
Qt::MouseButton lastClickButton;
|
Qt::MouseButton lastClickButton;
|
||||||
|
bool isScroll{true};
|
||||||
|
|
||||||
// worker vars
|
// worker vars
|
||||||
int workerLastIndex = 0;
|
int workerLastIndex = 0;
|
||||||
|
@ -174,6 +179,9 @@ private:
|
||||||
// layout
|
// layout
|
||||||
QMargins margins = QMargins(10, 10, 10, 10);
|
QMargins margins = QMargins(10, 10, 10, 10);
|
||||||
qreal lineSpacing = 5.0f;
|
qreal lineSpacing = 5.0f;
|
||||||
|
|
||||||
|
int numRemove{0};
|
||||||
|
const int maxMessages{300};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHATLOG_H
|
#endif // CHATLOG_H
|
||||||
|
|
|
@ -110,9 +110,10 @@ ChatHistory::ChatHistory(Friend& f_, History* history_, const ICoreIdHandler& co
|
||||||
|
|
||||||
// NOTE: this has to be done _after_ sending all sent messages since initial
|
// NOTE: this has to be done _after_ sending all sent messages since initial
|
||||||
// state of the message has to be marked according to our dispatch state
|
// state of the message has to be marked according to our dispatch state
|
||||||
auto firstChatLogIdx = sessionChatLog.getFirstIdx().get() < DEF_NUM_MSG_TO_LOAD
|
constexpr auto defaultNumMessagesToLoad = 100;
|
||||||
|
auto firstChatLogIdx = sessionChatLog.getFirstIdx().get() < defaultNumMessagesToLoad
|
||||||
? ChatLogIdx(0)
|
? ChatLogIdx(0)
|
||||||
: sessionChatLog.getFirstIdx() - DEF_NUM_MSG_TO_LOAD;
|
: sessionChatLog.getFirstIdx() - defaultNumMessagesToLoad;
|
||||||
|
|
||||||
if (canUseHistory()) {
|
if (canUseHistory()) {
|
||||||
loadHistoryIntoSessionChatLog(firstChatLogIdx);
|
loadHistoryIntoSessionChatLog(firstChatLogIdx);
|
||||||
|
|
|
@ -35,8 +35,6 @@
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
static const auto DEF_NUM_MSG_TO_LOAD = 100;
|
|
||||||
|
|
||||||
using ChatLogIdx =
|
using ChatLogIdx =
|
||||||
NamedType<size_t, struct ChatLogIdxTag, Orderable, UnderlyingAddable, UnitlessDifferencable, Incrementable>;
|
NamedType<size_t, struct ChatLogIdxTag, Orderable, UnderlyingAddable, UnitlessDifferencable, Incrementable>;
|
||||||
Q_DECLARE_METATYPE(ChatLogIdx);
|
Q_DECLARE_METATYPE(ChatLogIdx);
|
||||||
|
|
|
@ -53,6 +53,8 @@
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#ifdef SPELL_CHECKING
|
#ifdef SPELL_CHECKING
|
||||||
#include <KF5/SonnetUi/sonnet/spellcheckdecorator.h>
|
#include <KF5/SonnetUi/sonnet/spellcheckdecorator.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -660,6 +662,7 @@ void GenericChatForm::loadHistory(const QDateTime &time, const LoadHistoryDialog
|
||||||
if (type == LoadHistoryDialog::from) {
|
if (type == LoadHistoryDialog::from) {
|
||||||
loadHistoryFrom(time);
|
loadHistoryFrom(time);
|
||||||
auto msg = messages.cbegin()->second;
|
auto msg = messages.cbegin()->second;
|
||||||
|
chatWidget->setScroll(true);
|
||||||
chatWidget->scrollToLine(msg);
|
chatWidget->scrollToLine(msg);
|
||||||
} else {
|
} else {
|
||||||
loadHistoryTo(time);
|
loadHistoryTo(time);
|
||||||
|
@ -668,15 +671,10 @@ void GenericChatForm::loadHistory(const QDateTime &time, const LoadHistoryDialog
|
||||||
|
|
||||||
void GenericChatForm::loadHistoryTo(const QDateTime &time)
|
void GenericChatForm::loadHistoryTo(const QDateTime &time)
|
||||||
{
|
{
|
||||||
|
chatWidget->setScroll(false);
|
||||||
auto end = ChatLogIdx(0);
|
auto end = ChatLogIdx(0);
|
||||||
if (time.isNull()) {
|
if (time.isNull()) {
|
||||||
if (messages.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
|
end = messages.begin()->first;
|
||||||
end = ChatLogIdx(messages.rbegin()->first.get() - DEF_NUM_MSG_TO_LOAD);
|
|
||||||
chatWidget->removeLasts(DEF_NUM_MSG_TO_LOAD);
|
|
||||||
removeLastsMessages(DEF_NUM_MSG_TO_LOAD);
|
|
||||||
} else {
|
|
||||||
end = messages.begin()->first;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
end = firstItemAfterDate(time.date(), chatLog);
|
end = firstItemAfterDate(time.date(), chatLog);
|
||||||
}
|
}
|
||||||
|
@ -686,28 +684,27 @@ void GenericChatForm::loadHistoryTo(const QDateTime &time)
|
||||||
begin = ChatLogIdx(end.get() - DEF_NUM_MSG_TO_LOAD);
|
begin = ChatLogIdx(end.get() - DEF_NUM_MSG_TO_LOAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderMessages(begin, end);
|
if (begin != end) {
|
||||||
|
renderMessages(begin, end);
|
||||||
|
} else {
|
||||||
|
chatWidget->setScroll(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericChatForm::loadHistoryFrom(const QDateTime &time)
|
void GenericChatForm::loadHistoryFrom(const QDateTime &time)
|
||||||
{
|
{
|
||||||
|
chatWidget->setScroll(false);
|
||||||
auto begin = ChatLogIdx(0);
|
auto begin = ChatLogIdx(0);
|
||||||
if (time.isNull()) {
|
if (time.isNull()) {
|
||||||
if (messages.size() + DEF_NUM_MSG_TO_LOAD >= maxMessages) {
|
begin = messages.rbegin()->first;
|
||||||
begin = ChatLogIdx(messages.rbegin()->first.get() + DEF_NUM_MSG_TO_LOAD);
|
|
||||||
chatWidget->removeFirsts(DEF_NUM_MSG_TO_LOAD);
|
|
||||||
removeFirstsMessages(DEF_NUM_MSG_TO_LOAD);
|
|
||||||
} else {
|
|
||||||
begin = messages.rbegin()->first;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
begin = firstItemAfterDate(time.date(), chatLog);
|
begin = firstItemAfterDate(time.date(), chatLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
int add = DEF_NUM_MSG_TO_LOAD;
|
int add = DEF_NUM_MSG_TO_LOAD;
|
||||||
if (begin.get() + DEF_NUM_MSG_TO_LOAD > chatLog.getNextIdx().get()) {
|
if (begin.get() + DEF_NUM_MSG_TO_LOAD > chatLog.getNextIdx().get()) {
|
||||||
add = chatLog.getNextIdx().get() - (begin.get() + DEF_NUM_MSG_TO_LOAD);
|
auto aTest = chatLog.getNextIdx().get();
|
||||||
|
add = chatLog.getNextIdx().get() - begin.get();
|
||||||
}
|
}
|
||||||
auto end = ChatLogIdx(begin.get() + add);
|
auto end = ChatLogIdx(begin.get() + add);
|
||||||
renderMessages(begin, end);
|
renderMessages(begin, end);
|
||||||
|
@ -1024,10 +1021,6 @@ void GenericChatForm::handleSearchResult(SearchResult result, SearchDirection di
|
||||||
|
|
||||||
void GenericChatForm::renderMessage(ChatLogIdx idx)
|
void GenericChatForm::renderMessage(ChatLogIdx idx)
|
||||||
{
|
{
|
||||||
if (chatWidget->getLines().size() >= maxMessages) {
|
|
||||||
chatWidget->removeFirsts(optimalRemove);
|
|
||||||
removeFirstsMessages(optimalRemove);
|
|
||||||
}
|
|
||||||
renderMessages(idx, idx + 1);
|
renderMessages(idx, idx + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1037,6 +1030,11 @@ void GenericChatForm::renderMessages(ChatLogIdx begin, ChatLogIdx end,
|
||||||
QList<ChatLine::Ptr> beforeLines;
|
QList<ChatLine::Ptr> beforeLines;
|
||||||
QList<ChatLine::Ptr> afterLines;
|
QList<ChatLine::Ptr> afterLines;
|
||||||
|
|
||||||
|
if (!messages.empty() && !(messages.rbegin()->first == begin || messages.begin()->first == end
|
||||||
|
|| messages.rbegin()->first.get() + 1 == begin.get())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto i = begin; i < end; ++i) {
|
for (auto i = begin; i < end; ++i) {
|
||||||
auto chatMessage = getChatMessageForIdx(i, messages);
|
auto chatMessage = getChatMessageForIdx(i, messages);
|
||||||
renderItem(chatLog.at(i), needsToHideName(i), colorizeNames, chatMessage);
|
renderItem(chatLog.at(i), needsToHideName(i), colorizeNames, chatMessage);
|
||||||
|
@ -1054,8 +1052,13 @@ void GenericChatForm::renderMessages(ChatLogIdx begin, ChatLogIdx end,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& line : afterLines) {
|
if (beforeLines.isEmpty() && afterLines.isEmpty()) {
|
||||||
chatWidget->insertChatlineAtBottom(line);
|
chatWidget->setScroll(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
chatWidget->insertChatlineAtBottom(afterLines);
|
||||||
|
if (chatWidget->getNumRemove()) {
|
||||||
|
removeFirstsMessages(chatWidget->getNumRemove());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!beforeLines.empty()) {
|
if (!beforeLines.empty()) {
|
||||||
|
@ -1072,6 +1075,9 @@ void GenericChatForm::renderMessages(ChatLogIdx begin, ChatLogIdx end,
|
||||||
}
|
}
|
||||||
|
|
||||||
chatWidget->insertChatlinesOnTop(beforeLines);
|
chatWidget->insertChatlinesOnTop(beforeLines);
|
||||||
|
if (chatWidget->getNumRemove()) {
|
||||||
|
removeLastsMessages(chatWidget->getNumRemove());
|
||||||
|
}
|
||||||
} else if (onCompletion) {
|
} else if (onCompletion) {
|
||||||
onCompletion();
|
onCompletion();
|
||||||
}
|
}
|
||||||
|
@ -1081,7 +1087,7 @@ void GenericChatForm::goToCurrentDate()
|
||||||
{
|
{
|
||||||
chatWidget->clear();
|
chatWidget->clear();
|
||||||
messages.clear();
|
messages.clear();
|
||||||
auto end = ChatLogIdx(chatLog.size() - 1);
|
auto end = ChatLogIdx(chatLog.size());
|
||||||
auto begin = end.get() > DEF_NUM_MSG_TO_LOAD ? ChatLogIdx(end.get() - DEF_NUM_MSG_TO_LOAD) : ChatLogIdx(0);
|
auto begin = end.get() > DEF_NUM_MSG_TO_LOAD ? ChatLogIdx(end.get() - DEF_NUM_MSG_TO_LOAD) : ChatLogIdx(0);
|
||||||
|
|
||||||
renderMessages(begin, end);
|
renderMessages(begin, end);
|
||||||
|
|
|
@ -201,10 +201,6 @@ protected:
|
||||||
SearchPos searchPos;
|
SearchPos searchPos;
|
||||||
std::map<ChatLogIdx, ChatMessage::Ptr> messages;
|
std::map<ChatLogIdx, ChatMessage::Ptr> messages;
|
||||||
bool colorizeNames = false;
|
bool colorizeNames = false;
|
||||||
|
|
||||||
private:
|
|
||||||
const int maxMessages{300};
|
|
||||||
const int optimalRemove{50};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GENERICCHATFORM_H
|
#endif // GENERICCHATFORM_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user