From acff995c20aee98d6582174beb7d2c1075f55852 Mon Sep 17 00:00:00 2001 From: mostafaei2002 Date: Tue, 11 Jun 2024 12:09:26 +0330 Subject: [PATCH] fix: disable slider when xvb is not started --- src/app/panels/middle/xvb.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/app/panels/middle/xvb.rs b/src/app/panels/middle/xvb.rs index d87f8b1..a6a37a1 100644 --- a/src/app/panels/middle/xvb.rs +++ b/src/app/panels/middle/xvb.rs @@ -36,7 +36,7 @@ impl crate::disk::state::Xvb { ui: &mut egui::Ui, api: &Arc>, gui_api_xmrig: &Arc>, - private_stats: bool, + is_alive: bool, ) { egui::ScrollArea::vertical().show(ui, |ui| { @@ -182,12 +182,14 @@ impl crate::disk::state::Xvb { XVB_MANUAL_SLIDER_KEEP_HELP }; - ui.horizontal(|ui| { - ui.spacing_mut().slider_width = width * 0.7; - ui.add_sized( - [width, text_edit], - egui::Slider::new(&mut self.amount, 0.0..=(hashrate_xmrig as f64)).text("H/s") - ).on_hover_text(slider_help_text); + ui.add_enabled_ui(is_alive, |ui| { + ui.horizontal(|ui| { + ui.spacing_mut().slider_width = width * 0.7; + ui.add_sized( + [width, text_edit], + egui::Slider::new(&mut self.amount, 0.0..=(hashrate_xmrig as f64)).text("H/s") + ).on_hover_text(slider_help_text); + }); }); } @@ -227,8 +229,8 @@ impl crate::disk::state::Xvb { // private stats ui.add_space(space_h); - // ui.add_enabled_ui(private_stats, |ui| { - ui.add_enabled_ui(private_stats, |ui| { + // ui.add_enabled_ui(is_alive, |ui| { + ui.add_enabled_ui(is_alive, |ui| { let api = &lock!(api); let priv_stats = &api.stats_priv; let current_node = &api.current_node;