mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
parent
233cc412ac
commit
abf7b42324
|
@ -20,6 +20,8 @@
|
|||
#include "chatlog.h"
|
||||
#include "chatmessage.h"
|
||||
#include "chatlinecontent.h"
|
||||
#include "chatlinecontentproxy.h"
|
||||
#include "content/filetransferwidget.h"
|
||||
#include "src/widget/translator.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
@ -560,11 +562,20 @@ void ChatLog::clear()
|
|||
{
|
||||
clearSelection();
|
||||
|
||||
QVector<ChatLine::Ptr> savedLines;
|
||||
|
||||
for (ChatLine::Ptr l : lines)
|
||||
{
|
||||
if (isActiveFileTransfer(l))
|
||||
savedLines.push_back(l);
|
||||
else
|
||||
l->removeFromScene();
|
||||
}
|
||||
|
||||
lines.clear();
|
||||
visibleLines.clear();
|
||||
for (ChatLine::Ptr l : savedLines)
|
||||
insertChatlineAtBottom(l);
|
||||
|
||||
updateSceneRect();
|
||||
}
|
||||
|
@ -850,3 +861,22 @@ void ChatLog::retranslateUi()
|
|||
copyAction->setText(tr("Copy"));
|
||||
selectAllAction->setText(tr("Select all"));
|
||||
}
|
||||
|
||||
bool ChatLog::isActiveFileTransfer(ChatLine::Ptr l)
|
||||
{
|
||||
int count = l->getColumnCount();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
ChatLineContent *content = l->getContent(i);
|
||||
ChatLineContentProxy *proxy = dynamic_cast<ChatLineContentProxy*>(content);
|
||||
if (!proxy)
|
||||
continue;
|
||||
|
||||
QWidget *widget = proxy->getWidget();
|
||||
FileTransferWidget *transferWidget = dynamic_cast<FileTransferWidget*>(widget);
|
||||
if (transferWidget && transferWidget->isActive())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ private slots:
|
|||
|
||||
private:
|
||||
void retranslateUi();
|
||||
bool isActiveFileTransfer(ChatLine::Ptr l);
|
||||
|
||||
private:
|
||||
enum SelectionMode {
|
||||
|
|
Loading…
Reference in New Issue
Block a user