mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'v1.17-dev'
This commit is contained in:
commit
e5a6708877
|
@ -407,10 +407,9 @@ void ChatLog::insertChatlineAtBottom(const QList<ChatLine::Ptr>& newLines)
|
||||||
|
|
||||||
layout(lines.last()->getRow(), lines.size(), useableWidth());
|
layout(lines.last()->getRow(), lines.size(), useableWidth());
|
||||||
|
|
||||||
if (visibleLines.size() > 1) {
|
// redo layout only when scrolled down
|
||||||
startResizeWorker(visibleLines[1]);
|
if(stickToBottom()) {
|
||||||
} else {
|
startResizeWorker(true);
|
||||||
startResizeWorker();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,9 +462,9 @@ void ChatLog::insertChatlinesOnTop(const QList<ChatLine::Ptr>& newLines)
|
||||||
|
|
||||||
// redo layout
|
// redo layout
|
||||||
if (visibleLines.size() > 1) {
|
if (visibleLines.size() > 1) {
|
||||||
startResizeWorker(visibleLines[1]);
|
startResizeWorker(stickToBottom(), visibleLines[1]);
|
||||||
} else {
|
} else {
|
||||||
startResizeWorker();
|
startResizeWorker(stickToBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -481,7 +480,7 @@ void ChatLog::scrollToBottom()
|
||||||
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatLog::startResizeWorker(ChatLine::Ptr anchorLine)
|
void ChatLog::startResizeWorker(bool stick, ChatLine::Ptr anchorLine)
|
||||||
{
|
{
|
||||||
if (lines.empty()) {
|
if (lines.empty()) {
|
||||||
isScroll = true;
|
isScroll = true;
|
||||||
|
@ -491,11 +490,11 @@ void ChatLog::startResizeWorker(ChatLine::Ptr anchorLine)
|
||||||
// (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
|
||||||
if (anchorLine) {
|
workerStb = stick;
|
||||||
workerAnchorLine = anchorLine;
|
if (stick) {
|
||||||
workerStb = false;
|
workerAnchorLine = ChatLine::Ptr();
|
||||||
} else {
|
} else {
|
||||||
workerStb = stickToBottom();
|
workerAnchorLine = anchorLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -765,7 +764,7 @@ int ChatLog::getNumRemove() const
|
||||||
|
|
||||||
void ChatLog::forceRelayout()
|
void ChatLog::forceRelayout()
|
||||||
{
|
{
|
||||||
startResizeWorker();
|
startResizeWorker(stickToBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatLog::checkVisibility(bool causedWheelEvent)
|
void ChatLog::checkVisibility(bool causedWheelEvent)
|
||||||
|
@ -834,7 +833,7 @@ void ChatLog::resizeEvent(QResizeEvent* ev)
|
||||||
bool stb = stickToBottom();
|
bool stb = stickToBottom();
|
||||||
|
|
||||||
if (ev->size().width() != ev->oldSize().width()) {
|
if (ev->size().width() != ev->oldSize().width()) {
|
||||||
startResizeWorker();
|
startResizeWorker(stb);
|
||||||
stb = false; // let the resize worker handle it
|
stb = false; // let the resize worker handle it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -901,8 +900,9 @@ QRectF ChatLog::calculateSceneRect() const
|
||||||
{
|
{
|
||||||
qreal bottom = (lines.empty() ? 0.0 : lines.last()->sceneBoundingRect().bottom());
|
qreal bottom = (lines.empty() ? 0.0 : lines.last()->sceneBoundingRect().bottom());
|
||||||
|
|
||||||
if (typingNotification.get() != nullptr)
|
if (typingNotification.get() != nullptr) {
|
||||||
bottom += typingNotification->sceneBoundingRect().height() + lineSpacing;
|
bottom += typingNotification->sceneBoundingRect().height() + lineSpacing;
|
||||||
|
}
|
||||||
|
|
||||||
return QRectF(-margins.left(), -margins.top(), useableWidth(),
|
return QRectF(-margins.left(), -margins.top(), useableWidth(),
|
||||||
bottom + margins.bottom() + margins.top());
|
bottom + margins.bottom() + margins.top());
|
||||||
|
|
|
@ -105,7 +105,7 @@ protected:
|
||||||
void updateSceneRect();
|
void updateSceneRect();
|
||||||
void checkVisibility(bool causedWheelEvent = false);
|
void checkVisibility(bool causedWheelEvent = false);
|
||||||
void scrollToBottom();
|
void scrollToBottom();
|
||||||
void startResizeWorker(ChatLine::Ptr anchorLine = nullptr);
|
void startResizeWorker(bool stick, ChatLine::Ptr anchorLine = nullptr);
|
||||||
|
|
||||||
void mouseDoubleClickEvent(QMouseEvent* ev) final;
|
void mouseDoubleClickEvent(QMouseEvent* ev) final;
|
||||||
void mousePressEvent(QMouseEvent* ev) final;
|
void mousePressEvent(QMouseEvent* ev) final;
|
||||||
|
|
|
@ -1456,7 +1456,7 @@ QString Core::getGroupPeerName(int groupId, int peerId) const
|
||||||
QMutexLocker ml{&coreLoopLock};
|
QMutexLocker ml{&coreLoopLock};
|
||||||
|
|
||||||
// from tox.h: "If peer_number == UINT32_MAX, then author is unknown (e.g. initial joining the conference)."
|
// from tox.h: "If peer_number == UINT32_MAX, then author is unknown (e.g. initial joining the conference)."
|
||||||
if (peerId != std::numeric_limits<uint32_t>::max()) {
|
if (peerId == std::numeric_limits<uint32_t>::max()) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user