make the thing nicer

This commit is contained in:
2025-04-10 18:14:24 +01:00
parent 1283f34174
commit 31ac09cd25
+25 -23
View File
@@ -210,31 +210,33 @@ 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().show(ui, |ui| { egui::Frame::new()
let response = ui.add_enabled_ui(self.flags.elevated, |ui| { .outer_margin(egui::vec2(0.0, -2.0))
let label = ui.label("Game's network access"); .show(ui, |ui| {
ui.horizontal(|ui| { let response = ui.add_enabled_ui(self.flags.elevated, |ui| {
let available_width = label.rect.width(); let label = ui.label("Game's network access");
let spacing = ui.spacing().item_spacing.x; ui.horizontal(|ui| {
let button_width = (available_width - spacing) / 2.0; let available_width = label.rect.width();
if ui let spacing = ui.spacing().item_spacing.x;
.add_sized([button_width, 18.0], egui::Button::new("Block")) let button_width = (available_width - spacing) / 2.0;
.clicked() if ui
{ .add_sized([button_width, 18.0], egui::Button::new("Block"))
features::game_networking::block_all(&mut self.sysinfo); .clicked()
}; {
if ui features::game_networking::block_all(&mut self.sysinfo);
.add_sized([button_width, 18.0], egui::Button::new("Unblock")) };
.clicked() if ui
{ .add_sized([button_width, 18.0], egui::Button::new("Unblock"))
features::game_networking::unblock_all(); .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)]