mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 22:59:27 +00:00
fix: slider always enabled
This commit is contained in:
parent
9949a4c4fb
commit
ce9e378633
1 changed files with 18 additions and 22 deletions
|
@ -177,7 +177,6 @@ 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
|
||||
|
@ -186,7 +185,6 @@ impl crate::disk::state::Xvb {
|
|||
} else if lock!(gui_api_xmrig).hashrate_raw > 0.0 {
|
||||
lock!(gui_api_xmrig).hashrate_raw
|
||||
} else {
|
||||
is_slider_enabled = false;
|
||||
1000.0
|
||||
}
|
||||
};
|
||||
|
@ -204,27 +202,25 @@ impl crate::disk::state::Xvb {
|
|||
XVB_MANUAL_SLIDER_MANUAL_P2POOL_HELP
|
||||
};
|
||||
|
||||
ui.add_enabled_ui(is_slider_enabled, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.spacing_mut().slider_width = width * 0.5;
|
||||
ui.add_sized(
|
||||
[width, text_edit],
|
||||
egui::Slider::new(&mut self.manual_slider_amount, 0.0..=(hashrate_xmrig as f64)).max_decimals(3)
|
||||
).on_hover_text(slider_help_text);
|
||||
ui.horizontal(|ui| {
|
||||
ui.spacing_mut().slider_width = width * 0.5;
|
||||
ui.add_sized(
|
||||
[width, text_edit],
|
||||
egui::Slider::new(&mut self.manual_slider_amount, 0.0..=(hashrate_xmrig as f64)).max_decimals(3)
|
||||
).on_hover_text(slider_help_text);
|
||||
|
||||
if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Hash, "H/s")).clicked() {
|
||||
self.manual_donation_metric = ManualDonationMetric::Hash;
|
||||
self.manual_slider_amount = self.manual_amount_raw;
|
||||
}
|
||||
if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Kilo, "kH/s")).clicked() {
|
||||
self.manual_donation_metric = ManualDonationMetric::Kilo;
|
||||
self.manual_slider_amount = self.manual_amount_raw / 1000.0;
|
||||
};
|
||||
if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Mega, "MH/s")).clicked() {
|
||||
self.manual_donation_metric = ManualDonationMetric::Mega;
|
||||
self.manual_slider_amount = self.manual_amount_raw / 1_000_000.0;
|
||||
};
|
||||
});
|
||||
if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Hash, "H/s")).clicked() {
|
||||
self.manual_donation_metric = ManualDonationMetric::Hash;
|
||||
self.manual_slider_amount = self.manual_amount_raw;
|
||||
}
|
||||
if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Kilo, "KH/s")).clicked() {
|
||||
self.manual_donation_metric = ManualDonationMetric::Kilo;
|
||||
self.manual_slider_amount = self.manual_amount_raw / 1000.0;
|
||||
};
|
||||
if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Mega, "MH/s")).clicked() {
|
||||
self.manual_donation_metric = ManualDonationMetric::Mega;
|
||||
self.manual_slider_amount = self.manual_amount_raw / 1_000_000.0;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue