mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(groupwidget): Move call updateUserCount in GroupWidget
This commit is contained in:
parent
7429614188
commit
47cf113868
@ -65,7 +65,6 @@ void Group::updatePeer(int peerId, QString name)
|
||||
peers[peerId] = f->getDisplayedName();
|
||||
toxids[peerPk] = f->getDisplayedName();
|
||||
} else {
|
||||
widget->onUserListChanged();
|
||||
chatForm->onUserListChanged();
|
||||
emit userListChanged(groupId, toxids);
|
||||
}
|
||||
@ -114,7 +113,6 @@ void Group::regeneratePeerList()
|
||||
}
|
||||
}
|
||||
|
||||
widget->onUserListChanged();
|
||||
chatForm->onUserListChanged();
|
||||
emit userListChanged(groupId, toxids);
|
||||
}
|
||||
|
@ -764,7 +764,6 @@ void ContentDialog::updateGroupWidget(uint32_t groupId)
|
||||
ContactInfo info = groupList.find(groupId).value();
|
||||
GroupWidget* widget = static_cast<GroupWidget*>(std::get<1>(info));
|
||||
widget->setName(name);
|
||||
widget->onUserListChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,9 +49,11 @@ GroupWidget::GroupWidget(int groupId, const QString& name, bool compact)
|
||||
statusPic.setMargin(3);
|
||||
nameLabel->setText(name);
|
||||
|
||||
onUserListChanged();
|
||||
updateUserCount();
|
||||
setAcceptDrops(true);
|
||||
|
||||
Group* g = GroupList::findGroup(groupId);
|
||||
connect(g, &Group::userListChanged, this, &GroupWidget::updateUserCount);
|
||||
connect(nameLabel, &CroppingLabel::editFinished, this, &GroupWidget::setTitle);
|
||||
Translator::registerHandler(std::bind(&GroupWidget::retranslateUi, this), this);
|
||||
}
|
||||
@ -140,7 +142,7 @@ void GroupWidget::mouseMoveEvent(QMouseEvent* ev)
|
||||
}
|
||||
}
|
||||
|
||||
void GroupWidget::onUserListChanged()
|
||||
void GroupWidget::updateUserCount()
|
||||
{
|
||||
Group* g = GroupList::findGroup(groupId);
|
||||
if (g) {
|
||||
|
@ -36,7 +36,6 @@ public:
|
||||
QString getStatusString() const final override;
|
||||
Group* getGroup() const final override;
|
||||
void setName(const QString& name);
|
||||
void onUserListChanged();
|
||||
void editName();
|
||||
|
||||
signals:
|
||||
@ -54,6 +53,7 @@ protected:
|
||||
private slots:
|
||||
void retranslateUi();
|
||||
void setTitle(const QString& newName);
|
||||
void updateUserCount();
|
||||
|
||||
public:
|
||||
int groupId;
|
||||
|
Loading…
x
Reference in New Issue
Block a user