MCPcopy Index your code
hub / github.com/RizeCrime/linuxblaster_control / update

Method update

src/app.rs:40–129  ·  view source on GitHub ↗
(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame)

Source from the content-addressed store, hash-verified

38
39impl eframe::App for BlasterApp {
40 fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
41 #[cfg(debug_assertions)]
42 if ctx.input(|i| i.key_pressed(egui::Key::D)) {
43 ctx.set_debug_on_hover(!ctx.debug_on_hover());
44 }
45
46 egui::TopBottomPanel::top("top_panel")
47 .resizable(false)
48 .exact_height(56.0)
49 .show(ctx, |ui| {
50 ui.horizontal_centered(|ui| {
51 // Reset All Button
52 if ui.button("Reset All").clicked() {
53 let _ = self.0.reset();
54 }
55
56 // Profile Management
57 ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
58 if ui.button("Load Profile").clicked() {
59 let Some(path) = rfd::FileDialog::new()
60 .add_filter("Profile", &["json"])
61 .set_directory(DEFAULT_BASE_PATH.join("profiles"))
62 .pick_file()
63 else {
64 debug!("No path selected");
65 return;
66 };
67
68 if let Err(error) = self.0.apply_profile(path.clone()) {
69 error!("Failed to apply profile from file");
70 error!("Path: {}", path.display());
71 error!("Error: {}", error);
72 }
73 }
74
75 if ui.button("Save Profile").clicked() {
76 let Some(path) = rfd::FileDialog::new()
77 .set_file_name("profile.json")
78 .add_filter("Profile", &["json"])
79 .set_directory(DEFAULT_BASE_PATH.join("profiles"))
80 .save_file()
81 else {
82 debug!("No path selected");
83 return;
84 };
85
86 if let Err(error) = self.0.save_profile(path.clone()) {
87 error!("Failed to save profile to file");
88 error!("Path: {}", path.display());
89 error!("Error: {}", error);
90 }
91 }
92 });
93 });
94 },
95 );
96 egui::SidePanel::left("left_panel")
97 .resizable(false)

Callers

nothing calls this directly

Calls 7

nav_paneFunction · 0.85
autoeq_paneFunction · 0.85
sbx_paneFunction · 0.85
resetMethod · 0.80
apply_profileMethod · 0.80
cloneMethod · 0.80
save_profileMethod · 0.80

Tested by

no test coverage detected