make Frame of "Game's network access" area invisible

This commit is contained in:
2025-04-10 17:40:40 +01:00
parent 072c8ae406
commit 1283f34174
+23 -29
View File
@@ -210,37 +210,31 @@ impl App {
fn show_network(&mut self, _ctx: &egui::Context, ui: &mut egui::Ui) { fn show_network(&mut self, _ctx: &egui::Context, ui: &mut egui::Ui) {
header(ui, "Network"); header(ui, "Network");
egui::Frame::new() egui::Frame::new().show(ui, |ui| {
.inner_margin(egui::vec2(4.0, 4.0)) let response = ui.add_enabled_ui(self.flags.elevated, |ui| {
.stroke(egui::Stroke::new( let label = ui.label("Game's network access");
1.0, ui.horizontal(|ui| {
self.settings.theme.to_catppuccin().overlay1, let available_width = label.rect.width();
)) let spacing = ui.spacing().item_spacing.x;
.show(ui, |ui| { let button_width = (available_width - spacing) / 2.0;
let response = ui.add_enabled_ui(self.flags.elevated, |ui| { if ui
let label = ui.label("Game's network access"); .add_sized([button_width, 18.0], egui::Button::new("Block"))
ui.horizontal(|ui| { .clicked()
let available_width = label.rect.width(); {
let spacing = ui.spacing().item_spacing.x; features::game_networking::block_all(&mut self.sysinfo);
let button_width = (available_width - spacing) / 2.0; };
if ui if ui
.add_sized([button_width, 18.0], egui::Button::new("Block")) .add_sized([button_width, 18.0], egui::Button::new("Unblock"))
.clicked() .clicked()
{ {
features::game_networking::block_all(&mut self.sysinfo); features::game_networking::unblock_all();
}; };
if ui
.add_sized([button_width, 18.0], egui::Button::new("Unblock"))
.clicked()
{
features::game_networking::unblock_all();
};
});
}); });
response.response.on_disabled_hover_text(
"This requires administrator.\nUse the Elevate button.",
);
}); });
response
.response
.on_disabled_hover_text("This requires administrator.\nUse the Elevate button.");
});
} }
#[allow(clippy::unused_self)] #[allow(clippy::unused_self)]