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

refactor(group): Move GroupWidget creation out of Group

This commit is contained in:
Diadlo 2017-08-06 15:02:35 +03:00
parent 5d159e0203
commit e19bd67381
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
3 changed files with 10 additions and 3 deletions

View File

@ -36,8 +36,6 @@ Group::Group(int groupId, const QString& name, bool isAvGroupchat)
, nPeers{0}
, avGroupchat{isAvGroupchat}
{
bool compact = Settings::getInstance().getCompactLayout();
widget = new GroupWidget(groupId, name, compact);
chatForm = new GroupChatForm(this);
// in groupchats, we only notify on messages containing your name <-- dumb
@ -137,6 +135,11 @@ GroupChatForm* Group::getChatForm()
return chatForm;
}
void Group::setGroupWidget(GroupWidget* widget)
{
this->widget = widget;
}
GroupWidget* Group::getGroupWidget()
{
return widget;

View File

@ -47,6 +47,8 @@ public:
bool isSelfPeerNumber(int peernumber) const;
GroupChatForm* getChatForm();
void setGroupWidget(GroupWidget* widget);
GroupWidget* getGroupWidget();
void setEventFlag(bool f) override;

View File

@ -1816,7 +1816,9 @@ Group* Widget::createGroup(int groupId)
bool enabled = coreAv->isGroupAvEnabled(groupId);
Group* newgroup = GroupList::addGroup(groupId, groupName, enabled);
GroupWidget* widget = newgroup->getGroupWidget();
bool compact = Settings::getInstance().getCompactLayout();
GroupWidget* widget = new GroupWidget(groupId, groupName, compact);
newgroup->setGroupWidget(widget);
contactListWidget->addGroupWidget(widget);
widget->updateStatusLight();