From b1fce2be7483d345e40d5f02e1ee66f3899e5d8e Mon Sep 17 00:00:00 2001 From: William Dunn Date: Wed, 11 Nov 2026 09:52:15 -0500 Subject: [PATCH] craft-ui cloud pages: move off deprecated egui aliases The current egui pin denies the deprecated egui::WidgetType alias and egui::Id::new. The slice's pages (account, cloud, share, presence, the menu helper) move to egui::Role::Button and egui::Id::unique, the same spellings main's craft-ui already uses. --- crates/ui/src/account.rs | 8 ++++---- crates/ui/src/cloud/mod.rs | 2 +- crates/ui/src/cloud/pages.rs | 2 +- crates/ui/src/menu.rs | 6 +++--- crates/ui/src/presence.rs | 4 ++-- crates/ui/src/share/mod.rs | 12 ++++++------ 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/crates/ui/src/account.rs b/crates/ui/src/account.rs index d83214500..9c8921064 100644 --- a/crates/ui/src/account.rs +++ b/crates/ui/src/account.rs @@ -243,7 +243,7 @@ impl AccountMenu { let label = format!("{}\n{}", one.display, one.service); let row = ui.add(egui::Button::new(label).wrap_mode(egui::TextWrapMode::Extend)); let name = one.display.clone(); - row.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + row.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, name.as_str())); if row.clicked() { let _ = tx.send(AccountAction::Use(one.id.clone())); ui.close(); @@ -263,7 +263,7 @@ impl AccountMenu { let badge = egui::Button::new(RichText::new(account.initial()).strong()).min_size(egui::vec2(26.0, 26.0)).corner_radius(13.0); let hit = ui.add(badge); let spoken = labels.badge.replace("{name}", &account.display); - hit.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, spoken.as_str())); + hit.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, spoken.as_str())); let hit = hit.on_hover_text(account.display.as_str()); egui::Popup::menu(&hit).show(|ui| { @@ -321,7 +321,7 @@ impl AccountMenu { let label = format!("{}\n{}", other.display, other.service); let row = ui.add(egui::Button::new(label).wrap_mode(egui::TextWrapMode::Extend)); let name = other.display.clone(); - row.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + row.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, name.as_str())); if row.clicked() { let _ = tx.send(AccountAction::Use(other.id.clone())); ui.close(); @@ -347,7 +347,7 @@ impl AccountMenu { /// Draw the badge in a context that has no `Ui` to hand. pub fn show_in_ctx(&mut self, ctx: &Context) { - egui::Area::new(egui::Id::new("craft-ui/account")).anchor(egui::Align2::RIGHT_TOP, egui::vec2(-8.0, 8.0)).show(ctx, |ui| { + egui::Area::new(egui::Id::unique("craft-ui/account")).anchor(egui::Align2::RIGHT_TOP, egui::vec2(-8.0, 8.0)).show(ctx, |ui| { self.show(ui); }); } diff --git a/crates/ui/src/cloud/mod.rs b/crates/ui/src/cloud/mod.rs index 220afc04e..a8d001a0b 100644 --- a/crates/ui/src/cloud/mod.rs +++ b/crates/ui/src/cloud/mod.rs @@ -837,7 +837,7 @@ fn entry_row(app: &A, ui: &mut Ui, entry: &Entry, detail: &str, res let width = (ui.available_width() - reserve).max(60.0); let (rect, resp) = ui.allocate_exact_size(vec2(width, 40.0), Sense::click()); let label = entry.name.clone(); - resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, &label)); + resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, &label)); let p = ui.painter(); if resp.hovered() { p.rect_filled(rect, 4.0, style.hover); diff --git a/crates/ui/src/cloud/pages.rs b/crates/ui/src/cloud/pages.rs index fa1ead8be..b8187cf67 100644 --- a/crates/ui/src/cloud/pages.rs +++ b/crates/ui/src/cloud/pages.rs @@ -469,7 +469,7 @@ pub fn conflict_modal(app: &mut A, ctx: &egui::Context) { let mut reload = false; let mut copy = false; let mut dismiss = false; - egui::Modal::new(egui::Id::new("craft-ui/cloud/conflict")).show(ctx, |ui| { + egui::Modal::new(egui::Id::unique("craft-ui/cloud/conflict")).show(ctx, |ui| { let style = app.style(ui); ui.set_width(430.0); ui.label(RichText::new(&words.title).font(egui::FontId::new(15.0, style.bold.clone()))); diff --git a/crates/ui/src/menu.rs b/crates/ui/src/menu.rs index 2b18340bf..70189a56f 100644 --- a/crates/ui/src/menu.rs +++ b/crates/ui/src/menu.rs @@ -104,7 +104,7 @@ pub fn overflow(ui: &mut Ui, items: &[MenuItem], labels: &MenuLabels) -> Option< let button = egui::Button::new(RichText::new("\u{2026}").size(15.0)).frame(false); let hit = ui.add(button); let name = labels.more.clone(); - hit.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + hit.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, name.as_str())); let hit = hit.on_hover_text(labels.more.as_str()); items_of(&hit, items) } @@ -142,7 +142,7 @@ pub fn split(ui: &mut Ui, primary: &str, items: &[MenuItem], labels: &MenuLabels let more = ui.add(egui::Button::new(" ").corner_radius(if backwards { outer } else { inner })); crate::buttons::chevron(ui, more.rect, ui.visuals().text_color()); let name = labels.more_for.replace("{action}", &primary.to_lowercase()); - more.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + more.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, name.as_str())); let more = more.on_hover_text(name.as_str()); if let Some(id) = items_of(&more, items) { *hit = Some(SplitHit::Item(id)); @@ -177,7 +177,7 @@ fn items_of(anchor: &Response, items: &[MenuItem]) -> Option { // The icon is decoration. The name is the label alone. let name = item.label.clone(); let enabled = item.enabled; - row.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, enabled, name.as_str())); + row.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, enabled, name.as_str())); if row.clicked() { chosen = Some(item.id.clone()); ui.close(); diff --git a/crates/ui/src/presence.rs b/crates/ui/src/presence.rs index 1da9327d9..f429691bc 100644 --- a/crates/ui/src/presence.rs +++ b/crates/ui/src/presence.rs @@ -283,7 +283,7 @@ impl PresenceBar { let more = self.labels.and_more.replace("{count}", &hidden.to_string()); let weak = ui.visuals().widgets.inactive.bg_fill; let badge = badge(ui, &format!("+{hidden}"), weak, ui.visuals().text_color()); - badge.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, more.as_str())); + badge.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, more.as_str())); badge.on_hover_text(self.peers.iter().skip(self.shown).map(|p| p.display.as_str()).collect::>().join("\n")); } let ids: Vec = self.peers.iter().map(|p| p.id.clone()).collect(); @@ -292,7 +292,7 @@ impl PresenceBar { let ink = colours.get(at).copied().unwrap_or_else(|| peer.colour()); let hit = badge(ui, &peer.initial(), ink, Color32::WHITE); let name = peer.display.clone(); - hit.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, name.as_str())); + hit.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, name.as_str())); let tip = match &peer.at { Some(at) => format!("{}\n{at}", peer.display), None => peer.display.clone(), diff --git a/crates/ui/src/share/mod.rs b/crates/ui/src/share/mod.rs index 5dbcf6c06..e38067411 100644 --- a/crates/ui/src/share/mod.rs +++ b/crates/ui/src/share/mod.rs @@ -566,7 +566,7 @@ impl ShareDialog { /// The recipient field's id, for an application that wants to focus it. pub fn query_field_id() -> Id { - Id::new(QUERY) + Id::unique(QUERY) } /// One frame, as a modal over the window. Call this unconditionally: @@ -576,7 +576,7 @@ impl ShareDialog { if self.open.is_none() { return; } - let modal = egui::Modal::new(Id::new("craft-ui/share")).show(ctx, |ui| { + let modal = egui::Modal::new(Id::unique("craft-ui/share")).show(ctx, |ui| { ui.set_min_width(440.0); ui.set_max_width(560.0); self.contents(ui); @@ -1076,7 +1076,7 @@ fn permission_menu(ui: &mut Ui, sheet: &mut Sheet, labels: &ShareLabels) { crate::buttons::chevron(ui, button.rect, ui.visuals().text_color()); // The padding makes room for the triangle. It is layout, so it must not // reach anybody reading the screen aloud. - button.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, current)); + button.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, current)); egui::Popup::menu(&button).show(|ui| { ui.set_min_width(190.0); for (value, name, detail) in [ @@ -1277,7 +1277,7 @@ fn access(ui: &mut Ui, sheet: &Sheet, labels: &ShareLabels, weak: Color32, acts: // A glyph is not a name. Left alone this button announces itself // to a screen reader as a wastebasket character, so the word goes // on explicitly. - pressed.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, !busy, hint)); + pressed.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, !busy, hint)); if pressed.on_hover_text(hint).clicked() { acts.push(Act::Withdraw(share.id.clone())); } @@ -1322,7 +1322,7 @@ fn chip(ui: &mut Ui, avatars: &HashMap, chosen: &Chosen, labels: let fill = if response.hovered() { ui.visuals().widgets.hovered.bg_fill } else { ui.visuals().widgets.inactive.bg_fill }; ui.painter().set(background, egui::Shape::rect_filled(response.rect, CornerRadius::same(AVATAR_RADIUS), fill)); let label = format!("{} {}", labels.remove, chosen.label); - response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), label.clone())); + response.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), label.clone())); // The address, where there is one. Two colleagues share a display name // often enough that a chip reading "Ann Reed" is not an identity. let hint = match &chosen.detail { @@ -1358,7 +1358,7 @@ fn row(ui: &mut Ui, avatars: &HashMap, contact: &Contact, labels ui.painter().set(background, egui::Shape::rect_filled(response.rect, CornerRadius::same(4), ui.visuals().widgets.hovered.bg_fill)); } let label = contact.name.clone(); - response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), label.clone())); + response.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), label.clone())); response }