fix: modify slider behaviour

This commit is contained in:
mostafaei2002 2024-06-11 21:06:49 +03:30
parent 4cdf87f671
commit 9759b5677c
2 changed files with 8 additions and 4 deletions

View file

@ -167,13 +167,17 @@ impl crate::disk::state::Xvb {
ui.add_space(space_h); ui.add_space(space_h);
let mut is_slider_enabled = true;
let mut hashrate_xmrig = { let mut hashrate_xmrig = {
if lock!(gui_api_xmrig).hashrate_raw_15m > 0.0 { if lock!(gui_api_xmrig).hashrate_raw_15m > 0.0 {
lock!(gui_api_xmrig).hashrate_raw_15m lock!(gui_api_xmrig).hashrate_raw_15m
} else if lock!(gui_api_xmrig).hashrate_raw_1m > 0.0 { } else if lock!(gui_api_xmrig).hashrate_raw_1m > 0.0 {
lock!(gui_api_xmrig).hashrate_raw_1m lock!(gui_api_xmrig).hashrate_raw_1m
} else { } else if lock!(gui_api_xmrig).hashrate_raw {
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 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.horizontal(|ui| {
ui.spacing_mut().slider_width = width * 0.5; ui.spacing_mut().slider_width = width * 0.5;
ui.add_sized( ui.add_sized(

View file

@ -443,8 +443,8 @@ pub const XVB_ROUND_DONOR_WHALE_MIN_HR: u32 = 100000;
pub const XVB_ROUND_DONOR_MEGA_MIN_HR: u32 = 1000000; pub const XVB_ROUND_DONOR_MEGA_MIN_HR: u32 = 1000000;
// Manual Mode // 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_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, The remaining hashrate will be donated to xvb"; 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"; pub const XVB_MODE_MANUAL_DONATION_LEVEL_HELP: &str = "Manually set the XvB donation level";