1
0
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:
Diadlo 2017-08-06 13:06:23 +03:00
parent 7429614188
commit 47cf113868
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
4 changed files with 5 additions and 6 deletions

View File

@ -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);
}

View File

@ -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();
}
/**

View File

@ -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) {

View File

@ -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;