From 9759b5677cc85d34456dd9137c1fa6413c47481b Mon Sep 17 00:00:00 2001 From: mostafaei2002 Date: Tue, 11 Jun 2024 21:06:49 +0330 Subject: [PATCH] fix: modify slider behaviour --- src/app/panels/middle/xvb.rs | 8 ++++++-- src/utils/constants.rs | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/panels/middle/xvb.rs b/src/app/panels/middle/xvb.rs index 86adcaa..9fec213 100644 --- a/src/app/panels/middle/xvb.rs +++ b/src/app/panels/middle/xvb.rs @@ -167,13 +167,17 @@ impl crate::disk::state::Xvb { ui.add_space(space_h); + let mut is_slider_enabled = true; let mut hashrate_xmrig = { if lock!(gui_api_xmrig).hashrate_raw_15m > 0.0 { lock!(gui_api_xmrig).hashrate_raw_15m } else if lock!(gui_api_xmrig).hashrate_raw_1m > 0.0 { lock!(gui_api_xmrig).hashrate_raw_1m - } else { + } else if lock!(gui_api_xmrig).hashrate_raw { lock!(gui_api_xmrig).hashrate_raw + } else { + is_slider_enabled = false; + 1000.0 } }; @@ -187,7 +191,7 @@ impl crate::disk::state::Xvb { XVB_MANUAL_SLIDER_MANUAL_P2POOL_HELP }; - ui.add_enabled_ui(is_alive, |ui| { + ui.add_enabled_ui(is_slider_enabled, |ui| { ui.horizontal(|ui| { ui.spacing_mut().slider_width = width * 0.5; ui.add_sized( diff --git a/src/utils/constants.rs b/src/utils/constants.rs index 48fef19..37762ba 100644 --- a/src/utils/constants.rs +++ b/src/utils/constants.rs @@ -443,8 +443,8 @@ pub const XVB_ROUND_DONOR_WHALE_MIN_HR: u32 = 100000; pub const XVB_ROUND_DONOR_MEGA_MIN_HR: u32 = 1000000; // Manual Mode -pub const XVB_MODE_MANUAL_XVB_HELP: &str = "Manually set the amount to donate to XmrVsBeast, The remaining hashrate will be sent to p2pool"; -pub const XVB_MODE_MANUAL_P2POOL_HELP: &str = "Manually set the amount to keep on P2pool, The remaining hashrate will be donated to xvb"; +pub const XVB_MODE_MANUAL_XVB_HELP: &str = "Manually set the amount to donate to XmrVsBeast, If value is more than xmrig hashrate it might be changed"; +pub const XVB_MODE_MANUAL_P2POOL_HELP: &str = "Manually set the amount to keep on P2pool, If value is more than xmrig hashrate it might be changed"; pub const XVB_MODE_MANUAL_DONATION_LEVEL_HELP: &str = "Manually set the XvB donation level";