diff --git a/src/model/group.cpp b/src/model/group.cpp index 4102f01a0..5506efbc3 100644 --- a/src/model/group.cpp +++ b/src/model/group.cpp @@ -37,8 +37,6 @@ Group::Group(int groupId, const QString& name, bool isAvGroupchat, const QString , nPeers{0} , avGroupchat{isAvGroupchat} { - chatForm = new GroupChatForm(this); - // in groupchats, we only notify on messages containing your name <-- dumb // sound notifications should be on all messages, but system popup notification // on naming is appropriate @@ -46,11 +44,6 @@ Group::Group(int groupId, const QString& name, bool isAvGroupchat, const QString userWasMentioned = 0; } -Group::~Group() -{ - delete chatForm; -} - void Group::updatePeer(int peerId, QString name) { ToxPk peerKey = Core::getInstance()->getGroupPeerPk(groupId, peerId); @@ -137,11 +130,6 @@ int Group::getPeersCount() const return nPeers; } -GroupChatForm* Group::getChatForm() -{ - return chatForm; -} - QStringList Group::getPeerList() const { return peers; diff --git a/src/model/group.h b/src/model/group.h index e3b6de1fe..574d452ba 100644 --- a/src/model/group.h +++ b/src/model/group.h @@ -36,7 +36,6 @@ class Group : public Contact Q_OBJECT public: Group(int groupId, const QString& name, bool isAvGroupchat, const QString& selfName); - ~Group() override; bool isAvGroupchat() const; uint32_t getId() const override; @@ -45,8 +44,6 @@ public: QStringList getPeerList() const; bool isSelfPeerNumber(int peernumber) const; - GroupChatForm* getChatForm(); - void setEventFlag(bool f) override; bool getEventFlag() const override; diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 3fbb31cb2..4a822d099 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -527,6 +527,10 @@ Widget::~Widget() delete form; } + for (auto form : groupChatForms) { + delete form; + } + delete icon; delete profileForm; delete addFriendForm; @@ -1848,7 +1852,7 @@ Group* Widget::createGroup(int groupId) GroupWidget* widget = new GroupWidget(groupId, groupName, compact); groupWidgets[groupId] = widget; - auto form = newgroup->getChatForm(); + auto form = new GroupChatForm(newgroup); groupChatForms[groupId] = form; contactListWidget->addGroupWidget(widget);