Handle room avatars in top bar without an icon

pull/1/head
Konstantinos Sideris 8 years ago
parent a859145983
commit 1c9e92b8bd
  1. 1
      include/TopRoomBar.h
  2. 2
      src/ChatPage.cc
  3. 10
      src/TopRoomBar.cc

@ -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("");

Loading…
Cancel
Save