mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #5415
Patrick (1): fix:(chatform): Issue 5115, use QSharedPointer for groupChatForms
This commit is contained in:
commit
9ecb6da051
|
@ -525,10 +525,6 @@ Widget::~Widget()
|
|||
delete form;
|
||||
}
|
||||
|
||||
for (auto form : groupChatForms) {
|
||||
delete form;
|
||||
}
|
||||
|
||||
delete icon;
|
||||
delete profileForm;
|
||||
delete profileInfo;
|
||||
|
@ -1155,7 +1151,7 @@ void Widget::openDialog(GenericChatroomWidget* widget, bool newWindow)
|
|||
form = chatForms[id];
|
||||
} else {
|
||||
id = group->getId();
|
||||
form = groupChatForms[id];
|
||||
form = groupChatForms[id].data();
|
||||
}
|
||||
|
||||
bool chatFormIsSet;
|
||||
|
@ -1303,7 +1299,7 @@ void Widget::addGroupDialog(Group* group, ContentDialog* dialog)
|
|||
onAddClicked();
|
||||
}
|
||||
|
||||
auto chatForm = groupChatForms[groupId];
|
||||
auto chatForm = groupChatForms[groupId].data();
|
||||
auto chatroom = groupChatrooms[groupId];
|
||||
auto groupWidget = dialog->addGroup(chatroom, chatForm);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0))
|
||||
|
@ -1749,7 +1745,7 @@ void Widget::onGroupMessageReceived(int groupnumber, int peernumber, const QStri
|
|||
const auto targeted = !isSelf && mention;
|
||||
const auto groupId = g->getId();
|
||||
const auto date = QDateTime::currentDateTime();
|
||||
auto form = groupChatForms[groupId];
|
||||
auto form = groupChatForms[groupId].data();
|
||||
|
||||
if (targeted && !isAction) {
|
||||
form->addAlertMessage(author, message, date, true);
|
||||
|
@ -1816,7 +1812,7 @@ void Widget::onGroupPeerAudioPlaying(int groupnumber, int peernumber)
|
|||
return;
|
||||
}
|
||||
|
||||
auto form = groupChatForms[g->getId()];
|
||||
auto form = groupChatForms[g->getId()].data();
|
||||
// TODO(sudden6): switch to ToxPk here
|
||||
form->peerAudioPlaying(g->resolvePeerId(peernumber));
|
||||
}
|
||||
|
@ -1851,7 +1847,6 @@ void Widget::removeGroup(Group* g, bool fake)
|
|||
qWarning() << "Tried to remove group" << groupId << "but GroupChatForm doesn't exist";
|
||||
return;
|
||||
}
|
||||
delete groupChatFormIt.value();
|
||||
groupChatForms.erase(groupChatFormIt);
|
||||
delete g;
|
||||
if (contentLayout && contentLayout->mainHead->layout()->isEmpty()) {
|
||||
|
@ -1885,7 +1880,7 @@ Group* Widget::createGroup(int groupId)
|
|||
auto form = new GroupChatForm(newgroup);
|
||||
groupWidgets[groupId] = widget;
|
||||
groupChatrooms[groupId] = chatroom;
|
||||
groupChatForms[groupId] = form;
|
||||
groupChatForms[groupId] = QSharedPointer<GroupChatForm>(form);
|
||||
|
||||
contactListWidget->addGroupWidget(widget);
|
||||
widget->updateStatusLight();
|
||||
|
@ -2091,7 +2086,7 @@ void Widget::onGroupSendFailed(int groupId)
|
|||
|
||||
const auto message = tr("Message failed to send");
|
||||
const auto curTime = QDateTime::currentDateTime();
|
||||
auto form = groupChatForms[g->getId()];
|
||||
auto form = groupChatForms[g->getId()].data();
|
||||
form->addSystemInfoMessage(message, ChatMessage::INFO, curTime);
|
||||
}
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ private:
|
|||
|
||||
QMap<uint32_t, GroupWidget*> groupWidgets;
|
||||
QMap<uint32_t, std::shared_ptr<GroupChatroom>> groupChatrooms;
|
||||
QMap<uint32_t, GroupChatForm*> groupChatForms;
|
||||
QMap<uint32_t, QSharedPointer<GroupChatForm>> groupChatForms;
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
QAction* fileMenu;
|
||||
|
|
Loading…
Reference in New Issue
Block a user