fix: change ManuallyDonate, ManuallyKeep names & updates help texts

This commit is contained in:
mostafaei2002 2024-06-11 20:57:14 +03:30
parent cda7c975b6
commit 4cdf87f671
6 changed files with 31 additions and 31 deletions

View file

@ -14,9 +14,9 @@ use crate::regex::num_lines;
use crate::utils::constants::{
GREEN, LIGHT_GRAY, ORANGE, RED, XVB_DONATED_1H_FIELD, XVB_DONATED_24H_FIELD, XVB_FAILURE_FIELD,
XVB_HELP, XVB_ROUND_TYPE_FIELD, XVB_TOKEN_FIELD, XVB_TOKEN_LEN, XVB_URL_RULES,
XVB_WINNER_FIELD, XVB_HERO_SELECT, XVB_MODE_MANUALLY_DONATE, XVB_MODE_MANUALLY_KEEP, XVB_MODE_MANUAL_DONATION_LEVEL,
XVB_WINNER_FIELD, XVB_HERO_SELECT, XVB_MODE_MANUAL_XVB_HELP, XVB_MODE_MANUAL_P2POOL_HELP, XVB_MODE_MANUAL_DONATION_LEVEL_HELP,
XVB_DONATION_LEVEL_DONOR_HELP, XVB_DONATION_LEVEL_VIP_DONOR_HELP, XVB_DONATION_LEVEL_WHALE_DONOR_HELP,
XVB_DONATION_LEVEL_MEGA_DONOR_HELP, XVB_MANUAL_SLIDER_DONATE_HELP, XVB_MANUAL_SLIDER_KEEP_HELP
XVB_DONATION_LEVEL_MEGA_DONOR_HELP, XVB_MANUAL_SLIDER_MANUAL_XVB_HELP, XVB_MANUAL_SLIDER_MANUAL_P2POOL_HELP
};
use crate::utils::macros::lock;
use crate::utils::regex::Regexes;
@ -154,16 +154,16 @@ impl crate::disk::state::Xvb {
egui::ComboBox::from_label("")
.selected_text(format!("{:?}", self.mode))
.show_ui(ui, |ui| {
ui.selectable_value(&mut self.mode, XvbMode::Auto, "Automatic");
ui.selectable_value(&mut self.mode, XvbMode::Hero, "Hero Mode");
ui.selectable_value(&mut self.mode, XvbMode::ManuallyDonate, "Manually Donate")
.on_hover_text(XVB_MODE_MANUALLY_DONATE);
ui.selectable_value(&mut self.mode, XvbMode::ManuallyKeep, "Manually Keep")
.on_hover_text(XVB_MODE_MANUALLY_KEEP);
ui.selectable_value(&mut self.mode, XvbMode::ManualDonationLevel, "Manual Donation Level")
.on_hover_text(XVB_MODE_MANUAL_DONATION_LEVEL);
ui.selectable_value(&mut self.mode, XvbMode::Auto, "Auto");
ui.selectable_value(&mut self.mode, XvbMode::Hero, "Hero");
ui.selectable_value(&mut self.mode, XvbMode::ManualXvb, "ManualXvb")
.on_hover_text(XVB_MODE_MANUAL_XVB_HELP);
ui.selectable_value(&mut self.mode, XvbMode::ManualP2pool, "ManualP2pool")
.on_hover_text(XVB_MODE_MANUAL_P2POOL_HELP);
ui.selectable_value(&mut self.mode, XvbMode::ManualDonationLevel, "ManualDonationLevel")
.on_hover_text(XVB_MODE_MANUAL_DONATION_LEVEL_HELP);
});
if self.mode == XvbMode::ManuallyDonate || self.mode == XvbMode::ManuallyKeep {
if self.mode == XvbMode::ManualXvb || self.mode == XvbMode::ManualP2pool {
ui.add_space(space_h);
@ -181,10 +181,10 @@ impl crate::disk::state::Xvb {
hashrate_xmrig /= 1000.0;
}
let slider_help_text = if self.mode == XvbMode::ManuallyDonate {
XVB_MANUAL_SLIDER_DONATE_HELP
let slider_help_text = if self.mode == XvbMode::ManualXvb {
XVB_MANUAL_SLIDER_MANUAL_XVB_HELP
} else {
XVB_MANUAL_SLIDER_KEEP_HELP
XVB_MANUAL_SLIDER_MANUAL_P2POOL_HELP
};
ui.add_enabled_ui(is_alive, |ui| {

View file

@ -258,8 +258,8 @@ pub struct Xvb {
pub enum XvbMode {
#[default]
Auto,
ManuallyDonate,
ManuallyKeep,
ManualXvb,
ManualP2pool,
Hero,
ManualDonationLevel,
}

View file

@ -788,7 +788,7 @@ Uptime = 0h 2m 4s
lock!(gui_api_p2pool).p2pool_difficulty_u64 = 95000000;
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 0.0;
lock!(gui_api_xmrig).hashrate_raw_15m = 5000.0;
lock!(gui_api_xvb).stats_priv.runtime_mode = RuntimeMode::ManuallyDonate;
lock!(gui_api_xvb).stats_priv.runtime_mode = RuntimeMode::ManualXvb;
lock!(gui_api_xvb).stats_priv.runtime_manual_amount = 500.0;
let given_time = calcul_donated_time(
@ -801,7 +801,7 @@ Uptime = 0h 2m 4s
assert_eq!(given_time, 60);
lock!(gui_api_xvb).stats_priv.runtime_mode = RuntimeMode::ManuallyKeep;
lock!(gui_api_xvb).stats_priv.runtime_mode = RuntimeMode::ManualP2pool;
let given_time = calcul_donated_time(
lock!(gui_api_xmrig).hashrate_raw_15m,

View file

@ -83,15 +83,15 @@ pub(crate) fn calcul_donated_time(
output_console(gui_api_xvb, "Hero mode is enabled for this decision");
default_spared_time
},
RuntimeMode::ManuallyDonate => {
RuntimeMode::ManualXvb => {
let donate_hr = lock!(gui_api_xvb).stats_priv.runtime_manual_amount;
info!("RuntimeMode::ManuallyDonate - lhr:{lhr} donate_hr:{donate_hr}");
info!("RuntimeMode::ManualXvb - lhr:{lhr} donate_hr:{donate_hr}");
XVB_TIME_ALGO * (donate_hr as u32) / (lhr as u32)
},
RuntimeMode::ManuallyKeep => {
RuntimeMode::ManualP2pool => {
let keep_hr = lock!(gui_api_xvb).stats_priv.runtime_manual_amount;
info!("RuntimeMode::ManuallyDonate - lhr:{lhr} keep_hr:{keep_hr}");
info!("RuntimeMode::ManualXvb - lhr:{lhr} keep_hr:{keep_hr}");
XVB_TIME_ALGO - (XVB_TIME_ALGO * (keep_hr as u32) / (lhr as u32))
},

View file

@ -21,8 +21,8 @@ use super::{nodes::XvbNode, rounds::XvbRound, PubXvbApi};
pub enum RuntimeMode {
#[default]
Auto,
ManuallyDonate,
ManuallyKeep,
ManualXvb,
ManualP2pool,
Hero,
ManualDonationLevel
}
@ -135,8 +135,8 @@ impl From<XvbMode> for RuntimeMode {
fn from(mode: XvbMode) -> Self {
match mode {
XvbMode::Auto => Self::Auto,
XvbMode::ManuallyDonate => Self::ManuallyDonate,
XvbMode::ManuallyKeep => Self::ManuallyKeep,
XvbMode::ManualXvb => Self::ManualXvb,
XvbMode::ManualP2pool => Self::ManualP2pool,
XvbMode::Hero => Self::Hero,
XvbMode::ManualDonationLevel => Self::ManualDonationLevel
}

View file

@ -412,8 +412,8 @@ pub const XMRIG_PATH_EMPTY: &str = "XMRig PATH is empty! To fix: goto the [G
// XvB
pub const XVB_HELP: &str = "You need to register an account by clicking on the link above to get your token with the same p2pool XMR address you use for payment.";
pub const XVB_MANUAL_SLIDER_DONATE_HELP: &str = "Set the hashrate amount to donate to XvB manually";
pub const XVB_MANUAL_SLIDER_KEEP_HELP: &str = "Set the hashrate amount to keep on p2pool manually";
pub const XVB_MANUAL_SLIDER_MANUAL_XVB_HELP: &str = "Set the hashrate amount to donate to XvB manually, The remaining hashrate will be sent to p2pool";
pub const XVB_MANUAL_SLIDER_MANUAL_P2POOL_HELP: &str = "Set the hashrate amount to keep on p2pool manually, The remaining hasrate will be donated to xvb";
pub const XVB_URL: &str = "https://xmrvsbeast.com";
pub const XVB_URL_PUBLIC_API: &str = "https://xmrvsbeast.com/p2pool/stats";
@ -443,9 +443,9 @@ 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_MANUALLY_DONATE: &str = "Set the amount donated to XvB manually";
pub const XVB_MODE_MANUALLY_KEEP: &str = "Set the p2pool hashrate manually";
pub const XVB_MODE_MANUAL_DONATION_LEVEL: &str = "Set the XvB donation level manually";
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_DONATION_LEVEL_HELP: &str = "Manually set the XvB donation level";
// Manual Donation Levels