make Widget impl ProfilePic mutably
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -400,13 +400,16 @@ impl<'a> NavTitle<'a> {
|
||||
fn timeline_pfp(&mut self, ui: &mut egui::Ui, id: &TimelineKind, pfp_size: f32) {
|
||||
let txn = Transaction::new(self.ndb).unwrap();
|
||||
|
||||
if let Some(pfp) = id
|
||||
if let Some(mut pfp) = id
|
||||
.pubkey()
|
||||
.and_then(|pk| self.pubkey_pfp(&txn, pk.bytes(), pfp_size))
|
||||
{
|
||||
ui.add(pfp);
|
||||
ui.add(&mut pfp);
|
||||
} else {
|
||||
ui.add(ProfilePic::new(self.img_cache, notedeck::profile::no_pfp_url()).size(pfp_size));
|
||||
ui.add(
|
||||
&mut ProfilePic::new(self.img_cache, notedeck::profile::no_pfp_url())
|
||||
.size(pfp_size),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,10 +469,13 @@ impl<'a> NavTitle<'a> {
|
||||
|
||||
fn show_profile(&mut self, ui: &mut egui::Ui, pubkey: &Pubkey, pfp_size: f32) {
|
||||
let txn = Transaction::new(self.ndb).unwrap();
|
||||
if let Some(pfp) = self.pubkey_pfp(&txn, pubkey.bytes(), pfp_size) {
|
||||
ui.add(pfp);
|
||||
if let Some(mut pfp) = self.pubkey_pfp(&txn, pubkey.bytes(), pfp_size) {
|
||||
ui.add(&mut pfp);
|
||||
} else {
|
||||
ui.add(ProfilePic::new(self.img_cache, notedeck::profile::no_pfp_url()).size(pfp_size));
|
||||
ui.add(
|
||||
&mut ProfilePic::new(self.img_cache, notedeck::profile::no_pfp_url())
|
||||
.size(pfp_size),
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -142,11 +142,11 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
Some(ProfilePic::from_profile(self.note_context.img_cache, p)?.size(pfp_size))
|
||||
});
|
||||
|
||||
if let Some(pfp) = poster_pfp {
|
||||
ui.add(pfp);
|
||||
if let Some(mut pfp) = poster_pfp {
|
||||
ui.add(&mut pfp);
|
||||
} else {
|
||||
ui.add(
|
||||
ProfilePic::new(self.note_context.img_cache, notedeck::profile::no_pfp_url())
|
||||
&mut ProfilePic::new(self.note_context.img_cache, notedeck::profile::no_pfp_url())
|
||||
.size(pfp_size),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ impl<'a> EditProfileView<'a> {
|
||||
});
|
||||
ui.put(
|
||||
pfp_rect,
|
||||
ProfilePic::new(self.img_cache, pfp_url)
|
||||
&mut ProfilePic::new(self.img_cache, pfp_url)
|
||||
.size(size)
|
||||
.border(ProfilePic::border_stroke(ui)),
|
||||
);
|
||||
|
||||
@@ -148,7 +148,7 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
ui.horizontal(|ui| {
|
||||
ui.put(
|
||||
pfp_rect,
|
||||
ProfilePic::new(
|
||||
&mut ProfilePic::new(
|
||||
self.note_context.img_cache,
|
||||
get_profile_url(Some(&profile)),
|
||||
)
|
||||
|
||||
@@ -140,7 +140,7 @@ fn user_result<'a>(
|
||||
|
||||
let pfp_resp = ui.put(
|
||||
icon_rect,
|
||||
ProfilePic::new(cache, get_profile_url(Some(profile)))
|
||||
&mut ProfilePic::new(cache, get_profile_url(Some(profile)))
|
||||
.size(helper.scale_1d_pos(min_img_size)),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user