new chatlistview component, file attachments, performance & primitive test
This commit is contained in:
@@ -57,6 +57,20 @@ void ChatMessage::setActiveGeneration(int index) {
|
||||
setActiveInternal(index);
|
||||
}
|
||||
|
||||
void ChatMessage::setAttachments(QList<Attachment*> attachments) {
|
||||
QList<Attachment*> stale;
|
||||
for (Attachment* attachment : m_attachments)
|
||||
if (!attachments.contains(attachment)) stale.append(attachment);
|
||||
m_attachments.clear();
|
||||
for (Attachment* attachment : attachments) {
|
||||
attachment->setParent(this);
|
||||
m_attachments.append(attachment);
|
||||
}
|
||||
Q_EMIT attachmentsChanged();
|
||||
for (Attachment* attachment : stale)
|
||||
attachment->deleteLater();
|
||||
}
|
||||
|
||||
void ChatMessage::edit(const QString& newContent) {
|
||||
if (auto* generation = activeGeneration())
|
||||
generation->setContent(newContent);
|
||||
|
||||
Reference in New Issue
Block a user