From b25e481418ce5348bb842bad86d5fc0a2fbebbd5 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 22 Mar 2020 18:03:08 +0100 Subject: Clean up unused avatar functions --- src/ui/Avatar.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'src/ui/Avatar.cpp') diff --git a/src/ui/Avatar.cpp b/src/ui/Avatar.cpp index 7ee58d03..b8703e87 100644 --- a/src/ui/Avatar.cpp +++ b/src/ui/Avatar.cpp @@ -72,6 +72,8 @@ Avatar::setImage(const QString &avatar_url) static_cast(size_ * pixmap_.devicePixelRatio()), this, [this](QPixmap pm) { + if (pm.isNull()) + return; type_ = ui::AvatarType::Image; pixmap_ = pm; update(); @@ -88,20 +90,14 @@ Avatar::setImage(const QString &room, const QString &user) static_cast(size_ * pixmap_.devicePixelRatio()), this, [this](QPixmap pm) { + if (pm.isNull()) + return; type_ = ui::AvatarType::Image; pixmap_ = pm; update(); }); } -void -Avatar::setIcon(const QIcon &icon) -{ - icon_ = icon; - type_ = ui::AvatarType::Icon; - update(); -} - void Avatar::paintEvent(QPaintEvent *) { @@ -135,13 +131,6 @@ Avatar::paintEvent(QPaintEvent *) } switch (type_) { - case ui::AvatarType::Icon: { - icon_.paint(&painter, - QRect((width() - hs) / 2, (height() - hs) / 2, hs, hs), - Qt::AlignCenter, - QIcon::Normal); - break; - } case ui::AvatarType::Image: { QPainterPath ppath; -- cgit 1.5.1