mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 22:59:27 +00:00
feat: add H/s & kH/s labels for slider
This commit is contained in:
parent
acff995c20
commit
2e18c4c5fb
2 changed files with 39 additions and 25 deletions
|
@ -6,7 +6,7 @@ use log::debug;
|
|||
use readable::num::Float;
|
||||
use readable::up::Uptime;
|
||||
|
||||
use crate::disk::state::{XvbMode, ManualDonationLevel};
|
||||
use crate::disk::state::{XvbMode, ManualDonationLevel, ManualDonationMetric};
|
||||
use crate::helper::xmrig::PubXmrigApi;
|
||||
use crate::helper::xvb::priv_stats::RuntimeMode;
|
||||
use crate::helper::xvb::PubXvbApi;
|
||||
|
@ -28,6 +28,7 @@ use crate::{
|
|||
|
||||
impl crate::disk::state::Xvb {
|
||||
#[inline(always)] // called once
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn show(
|
||||
&mut self,
|
||||
size: Vec2,
|
||||
|
@ -184,11 +185,17 @@ impl crate::disk::state::Xvb {
|
|||
|
||||
ui.add_enabled_ui(is_alive, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.spacing_mut().slider_width = width * 0.7;
|
||||
ui.spacing_mut().slider_width = width * 0.5;
|
||||
ui.add_sized(
|
||||
[width, text_edit],
|
||||
egui::Slider::new(&mut self.amount, 0.0..=(hashrate_xmrig as f64)).text("H/s")
|
||||
egui::Slider::new(&mut self.amount, 0.0..=(hashrate_xmrig as f64))
|
||||
).on_hover_text(slider_help_text);
|
||||
|
||||
ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Hash, "H/s"));
|
||||
if ui.add(egui::SelectableLabel::new(self.manual_donation_metric == ManualDonationMetric::Kilo, "kH/s")).clicked() {
|
||||
self.amount *= 1000.0;
|
||||
};
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -243,26 +243,6 @@ pub struct Xmrig {
|
|||
pub token: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize, Default)]
|
||||
pub enum XvbMode {
|
||||
#[default]
|
||||
Auto,
|
||||
ManuallyDonate,
|
||||
ManuallyKeep,
|
||||
Hero,
|
||||
ManualDonationLevel
|
||||
}
|
||||
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize, Default)]
|
||||
pub enum ManualDonationLevel {
|
||||
#[default]
|
||||
Donor,
|
||||
DonorVIP,
|
||||
DonorWhale,
|
||||
DonorMega
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Debug, Deserialize, Serialize, Default)]
|
||||
pub struct Xvb {
|
||||
pub simple: bool,
|
||||
|
@ -270,7 +250,34 @@ pub struct Xvb {
|
|||
pub simple_hero_mode: bool,
|
||||
pub mode: XvbMode,
|
||||
pub amount: f64,
|
||||
pub manual_donation_level: ManualDonationLevel
|
||||
pub manual_donation_level: ManualDonationLevel,
|
||||
pub manual_donation_metric: ManualDonationMetric,
|
||||
}
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize, Default)]
|
||||
pub enum XvbMode {
|
||||
#[default]
|
||||
Auto,
|
||||
ManuallyDonate,
|
||||
ManuallyKeep,
|
||||
Hero,
|
||||
ManualDonationLevel,
|
||||
}
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize, Default)]
|
||||
pub enum ManualDonationLevel {
|
||||
#[default]
|
||||
Donor,
|
||||
DonorVIP,
|
||||
DonorWhale,
|
||||
DonorMega,
|
||||
}
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize, Default)]
|
||||
pub enum ManualDonationMetric {
|
||||
#[default]
|
||||
Hash,
|
||||
Kilo,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
|
@ -398,4 +405,4 @@ impl Default for Version {
|
|||
xmrig: XMRIG_VERSION.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue