fix: slider always enabled

This commit is contained in:
mostafaei2002 2024-06-12 18:39:32 +03:30
parent 9949a4c4fb
commit ce9e378633

View file

@ -177,7 +177,6 @@ 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
@ -186,7 +185,6 @@ impl crate::disk::state::Xvb {
} else if lock!(gui_api_xmrig).hashrate_raw > 0.0 { } else if lock!(gui_api_xmrig).hashrate_raw > 0.0 {
lock!(gui_api_xmrig).hashrate_raw lock!(gui_api_xmrig).hashrate_raw
} else { } else {
is_slider_enabled = false;
1000.0 1000.0
} }
}; };
@ -204,7 +202,6 @@ impl crate::disk::state::Xvb {
XVB_MANUAL_SLIDER_MANUAL_P2POOL_HELP XVB_MANUAL_SLIDER_MANUAL_P2POOL_HELP
}; };
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(
@ -216,7 +213,7 @@ impl crate::disk::state::Xvb {
self.manual_donation_metric = ManualDonationMetric::Hash; self.manual_donation_metric = ManualDonationMetric::Hash;
self.manual_slider_amount = self.manual_amount_raw; self.manual_slider_amount = self.manual_amount_raw;
} }
if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Kilo, "kH/s")).clicked() { if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Kilo, "KH/s")).clicked() {
self.manual_donation_metric = ManualDonationMetric::Kilo; self.manual_donation_metric = ManualDonationMetric::Kilo;
self.manual_slider_amount = self.manual_amount_raw / 1000.0; self.manual_slider_amount = self.manual_amount_raw / 1000.0;
}; };
@ -225,7 +222,6 @@ impl crate::disk::state::Xvb {
self.manual_slider_amount = self.manual_amount_raw / 1_000_000.0; self.manual_slider_amount = self.manual_amount_raw / 1_000_000.0;
}; };
}); });
});
} }
if self.mode == XvbMode::ManualDonationLevel { if self.mode == XvbMode::ManualDonationLevel {