Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 24 additions & 25 deletions gpui/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ mod safety;
mod settings_page;
mod stage_panel;
mod status_icons;
mod supported_page;
mod text_controls;
mod theme_studio;
mod travel_panel;
Expand Down Expand Up @@ -93,7 +94,7 @@ impl Page {
Page::UsbMap => "USB Routing",
Page::Games => "Games",
Page::Plugins => "Marketplace",
Page::Supported => "Supported mice",
Page::Supported => "Supported devices",
Page::Settings => "Settings",
Page::Updates => "Updates",
Page::About => "About",
Expand Down Expand Up @@ -216,6 +217,15 @@ pub struct AppView {
/// Sponsors, contributors and open-source credits for the About page.
credits: crate::credits::Credits,
credits_refreshed: bool,
/// Search box on the Supported devices page, made the first time the page renders.
supported_search: Option<(Entity<InputState>, Subscription)>,
/// Brand chip picked on the Supported devices page; `None` shows every brand.
supported_brand: Option<String>,
/// Device type id picked on the Supported devices page; empty shows the first type.
supported_kind: String,
/// Supported devices catalog: bundled, then the cached or freshly downloaded copy.
supported_catalog: crate::supported_catalog::Catalog,
supported_refreshed: bool,
/// The on-screen game overlay while one is up.
overlay: Option<AnyWindowHandle>,
/// Newest scheduled presence update wins (Discord rate-limits them).
Expand Down Expand Up @@ -359,6 +369,11 @@ impl AppView {
checking_for_updates: false,
credits: crate::credits::load(),
credits_refreshed: false,
supported_search: None,
supported_brand: None,
supported_kind: String::new(),
supported_catalog: crate::supported_catalog::load(),
supported_refreshed: false,
overlay: None,
presence_seq: 0,
startup_error: None,
Expand Down Expand Up @@ -435,6 +450,7 @@ impl AppView {
}
self.rebind_name_editor(window, cx);
self.rebind_device_name_editor(window, cx);
self.rebind_supported_search(window, cx);
self.rebind_curve_editor(window, cx);

let opacity_slider = self.opacity_slider.as_ref().expect("opacity slider is built").clone();
Expand Down Expand Up @@ -566,6 +582,11 @@ impl Default for AppView {
checking_for_updates: false,
credits: crate::credits::load(),
credits_refreshed: false,
supported_search: None,
supported_brand: None,
supported_kind: String::new(),
supported_catalog: crate::supported_catalog::load(),
supported_refreshed: false,
overlay: None,
presence_seq: 0,
startup_error: None,
Expand Down Expand Up @@ -928,30 +949,7 @@ impl AppView {
if self.page == Page::UsbMap {
return self.render_usb_map(cx);
}
let (title, body): (&str, &str) = match self.page {
Page::Supported => ("Supported mice", "Supported device catalog lives here."),
_ => unreachable!(),
};
div()
.flex()
.flex_col()
.size_full()
.p_4()
.gap_2()
.child(
div()
.text_xl()
.font_weight(FontWeight::SEMIBOLD)
.text_color(cx.theme().foreground)
.child(title),
)
.child(
div()
.text_sm()
.text_color(cx.theme().muted_foreground)
.child(body),
)
.into_any_element()
self.render_supported(cx)
}
}

Expand All @@ -969,6 +967,7 @@ impl Render for AppView {
self.ensure_stage_sliders(window, cx);
self.ensure_text_controls(window, cx);
self.ensure_macro_recorder(cx);
self.prepare_supported_page(window, cx);
self.ensure_name_editor(window, cx);
self.ensure_device_name_editor(window, cx);
self.ensure_curve_editor(window, cx);
Expand Down
Loading