mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(group): Don't pass widget on model change
This commit is contained in:
parent
9495a411cb
commit
11e75104f4
|
@ -64,13 +64,13 @@ void Group::updatePeer(int peerId, QString name)
|
|||
} else {
|
||||
widget->onUserListChanged();
|
||||
chatForm->onUserListChanged();
|
||||
emit userListChanged(getGroupWidget());
|
||||
emit userListChanged(groupId, toxids);
|
||||
}
|
||||
}
|
||||
|
||||
void Group::setName(const QString& name)
|
||||
{
|
||||
emit titleChanged(this->getGroupWidget());
|
||||
emit titleChanged(groupId, name);
|
||||
}
|
||||
|
||||
QString Group::getName() const
|
||||
|
@ -110,7 +110,7 @@ void Group::regeneratePeerList()
|
|||
|
||||
widget->onUserListChanged();
|
||||
chatForm->onUserListChanged();
|
||||
emit userListChanged(getGroupWidget());
|
||||
emit userListChanged(groupId, toxids);
|
||||
}
|
||||
|
||||
bool Group::isAvGroupchat() const
|
||||
|
|
|
@ -63,8 +63,8 @@ public:
|
|||
QString resolveToxId(const ToxPk& id) const;
|
||||
|
||||
signals:
|
||||
void titleChanged(GroupWidget* widget);
|
||||
void userListChanged(GroupWidget* widget);
|
||||
void titleChanged(uint32_t groupId, const QString& title);
|
||||
void userListChanged(uint32_t groupId, const QMap<QByteArray, QString>& toxids);
|
||||
|
||||
private:
|
||||
GroupWidget* widget;
|
||||
|
|
|
@ -754,14 +754,15 @@ void ContentDialog::updateFriendWidget(uint32_t friendId, QString alias)
|
|||
|
||||
/**
|
||||
* @brief Update group widget name and 'status'.
|
||||
* @param w Group widget to update.
|
||||
* @param groupId Id of group to update.
|
||||
*/
|
||||
void ContentDialog::updateGroupWidget(GroupWidget* w)
|
||||
void ContentDialog::updateGroupWidget(uint32_t groupId)
|
||||
{
|
||||
ContactInfo info = groupList.find(w->groupId).value();
|
||||
GroupWidget* widget = static_cast<GroupWidget*>(std::get<1>(info));
|
||||
Group* g = GroupList::findGroup(groupId);
|
||||
QString name = g->getName();
|
||||
|
||||
QString name = w->getName();
|
||||
ContactInfo info = groupList.find(groupId).value();
|
||||
GroupWidget* widget = static_cast<GroupWidget*>(std::get<1>(info));
|
||||
widget->setName(name);
|
||||
widget->onUserListChanged();
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ private slots:
|
|||
void activate(GenericChatroomWidget* widget);
|
||||
void openNewDialog(GenericChatroomWidget* widget);
|
||||
void updateFriendWidget(uint32_t friendId, QString alias);
|
||||
void updateGroupWidget(GroupWidget* w);
|
||||
void updateGroupWidget(uint32_t groupId);
|
||||
void onGroupchatPositionChanged(bool top);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue
Block a user