Пример #1
0
GroupWidget::GroupWidget(std::shared_ptr<GroupChatroom> chatroom, bool compact)
    : GenericChatroomWidget(compact)
    , groupId{chatroom->getGroup()->getPersistentId()}
    , chatroom{chatroom}
{
    avatar->setPixmap(Style::scaleSvgImage(":img/group.svg", avatar->width(), avatar->height()));
    statusPic.setPixmap(QPixmap(Status::getIconPath(Status::Status::Online)));
    statusPic.setMargin(3);

    Group* g = chatroom->getGroup();
    nameLabel->setText(g->getName());

    updateUserCount(g->getPeersCount());
    setAcceptDrops(true);

    connect(g, &Group::titleChanged, this, &GroupWidget::updateTitle);
    connect(g, &Group::numPeersChanged, this, &GroupWidget::updateUserCount);
    connect(nameLabel, &CroppingLabel::editFinished, g, &Group::setName);
    Translator::registerHandler(std::bind(&GroupWidget::retranslateUi, this), this);
}
void WidgetChatMiddle::userCountUpdated(ChatUserListModel* chatUserListModel, int operators, int users)
{
	if (currentRoom()->chatUserListModel == chatUserListModel)
		emit updateUserCount(operators, users);
}
Пример #3
0
void GroupWidget::retranslateUi()
{
    const Group* group = chatroom->getGroup();
    updateUserCount(group->getPeersCount());
}