1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor: Remove ChatForm from Group

This commit is contained in:
Diadlo 2018-02-02 01:16:54 +03:00
parent 0586e65e72
commit 0d2926e196
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
3 changed files with 5 additions and 16 deletions

View File

@ -37,8 +37,6 @@ Group::Group(int groupId, const QString& name, bool isAvGroupchat, const QString
, nPeers{0} , nPeers{0}
, avGroupchat{isAvGroupchat} , avGroupchat{isAvGroupchat}
{ {
chatForm = new GroupChatForm(this);
// in groupchats, we only notify on messages containing your name <-- dumb // in groupchats, we only notify on messages containing your name <-- dumb
// sound notifications should be on all messages, but system popup notification // sound notifications should be on all messages, but system popup notification
// on naming is appropriate // on naming is appropriate
@ -46,11 +44,6 @@ Group::Group(int groupId, const QString& name, bool isAvGroupchat, const QString
userWasMentioned = 0; userWasMentioned = 0;
} }
Group::~Group()
{
delete chatForm;
}
void Group::updatePeer(int peerId, QString name) void Group::updatePeer(int peerId, QString name)
{ {
ToxPk peerKey = Core::getInstance()->getGroupPeerPk(groupId, peerId); ToxPk peerKey = Core::getInstance()->getGroupPeerPk(groupId, peerId);
@ -137,11 +130,6 @@ int Group::getPeersCount() const
return nPeers; return nPeers;
} }
GroupChatForm* Group::getChatForm()
{
return chatForm;
}
QStringList Group::getPeerList() const QStringList Group::getPeerList() const
{ {
return peers; return peers;

View File

@ -36,7 +36,6 @@ class Group : public Contact
Q_OBJECT Q_OBJECT
public: public:
Group(int groupId, const QString& name, bool isAvGroupchat, const QString& selfName); Group(int groupId, const QString& name, bool isAvGroupchat, const QString& selfName);
~Group() override;
bool isAvGroupchat() const; bool isAvGroupchat() const;
uint32_t getId() const override; uint32_t getId() const override;
@ -45,8 +44,6 @@ public:
QStringList getPeerList() const; QStringList getPeerList() const;
bool isSelfPeerNumber(int peernumber) const; bool isSelfPeerNumber(int peernumber) const;
GroupChatForm* getChatForm();
void setEventFlag(bool f) override; void setEventFlag(bool f) override;
bool getEventFlag() const override; bool getEventFlag() const override;

View File

@ -527,6 +527,10 @@ Widget::~Widget()
delete form; delete form;
} }
for (auto form : groupChatForms) {
delete form;
}
delete icon; delete icon;
delete profileForm; delete profileForm;
delete addFriendForm; delete addFriendForm;
@ -1848,7 +1852,7 @@ Group* Widget::createGroup(int groupId)
GroupWidget* widget = new GroupWidget(groupId, groupName, compact); GroupWidget* widget = new GroupWidget(groupId, groupName, compact);
groupWidgets[groupId] = widget; groupWidgets[groupId] = widget;
auto form = newgroup->getChatForm(); auto form = new GroupChatForm(newgroup);
groupChatForms[groupId] = form; groupChatForms[groupId] = form;
contactListWidget->addGroupWidget(widget); contactListWidget->addGroupWidget(widget);