diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-04-07 20:42:53 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-04-07 20:42:53 -0400 |
commit | 1251d89ef0577c9d450a8581d52dd94b67a45075 (patch) | |
tree | 310cf70fed83bdfff22d2b663d7761f95d4c94c6 /windows/profilewindow.cpp | |
parent | 0faff42e17cbe349a0b5812a653456ab67d49e52 (diff) | |
download | abaddon-portaudio-1251d89ef0577c9d450a8581d52dd94b67a45075.tar.gz abaddon-portaudio-1251d89ef0577c9d450a8581d52dd94b67a45075.zip |
use discord's default avatars instead of placeholder
Diffstat (limited to 'windows/profilewindow.cpp')
-rw-r--r-- | windows/profilewindow.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/windows/profilewindow.cpp b/windows/profilewindow.cpp index d6ce320..58f3b28 100644 --- a/windows/profilewindow.cpp +++ b/windows/profilewindow.cpp @@ -47,23 +47,21 @@ ProfileWindow::ProfileWindow(Snowflake user_id) static const bool show_animations = Abaddon::Get().GetSettings().GetShowAnimations(); auto &img = Abaddon::Get().GetImageManager(); m_avatar.property_pixbuf() = img.GetPlaceholder(64); - if (user.HasAvatar()) { - auto icon_cb = [this](const Glib::RefPtr<Gdk::Pixbuf> &pb) { - set_icon(pb); + auto icon_cb = [this](const Glib::RefPtr<Gdk::Pixbuf> &pb) { + set_icon(pb); + }; + img.LoadFromURL(user.GetAvatarURL("png", "64"), sigc::track_obj(icon_cb, *this)); + + if (show_animations && user.HasAnimatedAvatar()) { + auto cb = [this](const Glib::RefPtr<Gdk::PixbufAnimation> &pb) { + m_avatar.property_pixbuf_animation() = pb; }; - img.LoadFromURL(user.GetAvatarURL("png", "64"), sigc::track_obj(icon_cb, *this)); - - if (show_animations && user.HasAnimatedAvatar()) { - auto cb = [this](const Glib::RefPtr<Gdk::PixbufAnimation> &pb) { - m_avatar.property_pixbuf_animation() = pb; - }; - img.LoadAnimationFromURL(user.GetAvatarURL("gif", "64"), 64, 64, sigc::track_obj(cb, *this)); - } else { - auto cb = [this](const Glib::RefPtr<Gdk::Pixbuf> &pb) { - m_avatar.property_pixbuf() = pb->scale_simple(64, 64, Gdk::INTERP_BILINEAR); - }; - img.LoadFromURL(user.GetAvatarURL("png", "64"), sigc::track_obj(cb, *this)); - } + img.LoadAnimationFromURL(user.GetAvatarURL("gif", "64"), 64, 64, sigc::track_obj(cb, *this)); + } else { + auto cb = [this](const Glib::RefPtr<Gdk::Pixbuf> &pb) { + m_avatar.property_pixbuf() = pb->scale_simple(64, 64, Gdk::INTERP_BILINEAR); + }; + img.LoadFromURL(user.GetAvatarURL("png", "64"), sigc::track_obj(cb, *this)); } m_username.set_markup(user.GetEscapedString()); |