@ -39,6 +39,7 @@ public:
inline void updateRoomAvatar(const QIcon &icon);
inline void updateRoomName(const QString &name);
inline void updateRoomTopic(const QString &topic);
void updateRoomAvatarFromName(const QString &name);
void reset();
@ -292,6 +292,8 @@ void ChatPage::changeTopRoomInfo(const RoomInfo &info)
if (room_avatars_.contains(info.id())) {
QIcon icon(room_avatars_.value(info.id()));
top_bar_->updateRoomAvatar(icon);
} else {
top_bar_->updateRoomAvatarFromName(info.name());
}
current_room_ = info;
@ -77,6 +77,16 @@ TopRoomBar::TopRoomBar(QWidget *parent)
setLayout(top_layout_);
void TopRoomBar::updateRoomAvatarFromName(const QString &name)
{
QChar letter = '?';
if (name.size() > 0)
letter = name[0];
avatar_->setLetter(letter);
void TopRoomBar::reset()
name_label_->setText("");