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:
parent
5d159e0203
commit
e19bd67381
|
@ -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;
|
||||
|
|
|
@ -47,6 +47,8 @@ public:
|
|||
bool isSelfPeerNumber(int peernumber) const;
|
||||
|
||||
GroupChatForm* getChatForm();
|
||||
|
||||
void setGroupWidget(GroupWidget* widget);
|
||||
GroupWidget* getGroupWidget();
|
||||
|
||||
void setEventFlag(bool f) override;
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user