mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 22:59:27 +00:00
feat: add xvb simple & advanced submenus
This commit is contained in:
parent
41999f098f
commit
4ad48308e3
3 changed files with 78 additions and 43 deletions
|
@ -112,14 +112,17 @@ impl crate::app::App {
|
||||||
wants_input,
|
wants_input,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Tab::Xvb => self.xvb_run_actions(
|
Tab::Xvb => {
|
||||||
ui,
|
self.xvb_submenu(ui, size);
|
||||||
height,
|
self.xvb_run_actions(
|
||||||
xvb_is_waiting,
|
ui,
|
||||||
xvb_is_alive,
|
height,
|
||||||
key,
|
xvb_is_waiting,
|
||||||
wants_input,
|
xvb_is_alive,
|
||||||
),
|
key,
|
||||||
|
wants_input,
|
||||||
|
);
|
||||||
|
},
|
||||||
Tab::About => {}
|
Tab::About => {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -584,6 +587,33 @@ impl crate::app::App {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn xvb_submenu(&mut self, ui: &mut Ui, size: Vec2) {
|
||||||
|
ui.group(|ui| {
|
||||||
|
let width = size.x / 1.5;
|
||||||
|
let size = vec2(width, size.y);
|
||||||
|
if ui
|
||||||
|
.add_sized(
|
||||||
|
size,
|
||||||
|
SelectableLabel::new(!self.state.xvb.simple, "Advanced"),
|
||||||
|
)
|
||||||
|
.clicked()
|
||||||
|
{
|
||||||
|
self.state.xvb.simple = false;
|
||||||
|
}
|
||||||
|
ui.separator();
|
||||||
|
if ui
|
||||||
|
.add_sized(
|
||||||
|
size,
|
||||||
|
SelectableLabel::new(self.state.xvb.simple, "Simple"),
|
||||||
|
)
|
||||||
|
.on_hover_text(XMRIG_SIMPLE)
|
||||||
|
.clicked()
|
||||||
|
{
|
||||||
|
self.state.xvb.simple = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn status_p2pool(state: ProcessState, ui: &mut Ui, size: Vec2) {
|
fn status_p2pool(state: ProcessState, ui: &mut Ui, size: Vec2) {
|
||||||
|
|
|
@ -117,45 +117,49 @@ impl crate::disk::state::Xvb {
|
||||||
ui.style_mut().spacing.icon_spacing = space_h;
|
ui.style_mut().spacing.icon_spacing = space_h;
|
||||||
|
|
||||||
|
|
||||||
ui.group(|ui| {
|
if !self.simple {
|
||||||
ui.vertical_centered(|ui| {
|
|
||||||
ui.horizontal(|ui| {
|
ui.group(|ui| {
|
||||||
|
ui.vertical_centered(|ui| {
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
|
||||||
|
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");
|
||||||
|
ui.selectable_value(&mut self.mode, XvbMode::ManuallyKeep, "Manually Keep");
|
||||||
|
});
|
||||||
|
if self.mode == XvbMode::ManuallyDonate || self.mode == XvbMode::ManuallyKeep {
|
||||||
|
let (text, color) = if self.amount.is_empty() {
|
||||||
|
(
|
||||||
|
format!(""),
|
||||||
|
LIGHT_GRAY,
|
||||||
|
)
|
||||||
|
} else if self.amount.parse::<u32>().is_ok() {
|
||||||
|
(format!("✔"), GREEN)
|
||||||
|
} else {
|
||||||
|
(
|
||||||
|
format!("Invalid hashrate ❌"),
|
||||||
|
RED,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
ui.add_space(space_h);
|
||||||
|
|
||||||
|
ui.colored_label(color, text);
|
||||||
|
ui.add(
|
||||||
|
TextEdit::singleline(&mut self.amount)
|
||||||
|
.vertical_align(egui::Align::Center)
|
||||||
|
).on_hover_text(XVB_MANUAL_HASHRATE_HELP);
|
||||||
|
}
|
||||||
|
|
||||||
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");
|
|
||||||
ui.selectable_value(&mut self.mode, XvbMode::ManuallyKeep, "Manually Keep");
|
|
||||||
});
|
});
|
||||||
if self.mode == XvbMode::ManuallyDonate || self.mode == XvbMode::ManuallyKeep {
|
|
||||||
let (text, color) = if self.amount.is_empty() {
|
|
||||||
(
|
|
||||||
format!(""),
|
|
||||||
LIGHT_GRAY,
|
|
||||||
)
|
|
||||||
} else if self.amount.parse::<u32>().is_ok() {
|
|
||||||
(format!("✔"), GREEN)
|
|
||||||
} else {
|
|
||||||
(
|
|
||||||
format!("Invalid hashrate ❌"),
|
|
||||||
RED,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
ui.add_space(space_h);
|
|
||||||
|
|
||||||
ui.colored_label(color, text);
|
|
||||||
ui.add(
|
|
||||||
TextEdit::singleline(&mut self.amount)
|
|
||||||
.vertical_align(egui::Align::Center)
|
|
||||||
).on_hover_text(XVB_MANUAL_HASHRATE_HELP);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -253,6 +253,7 @@ pub enum XvbMode {
|
||||||
|
|
||||||
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize, Default)]
|
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize, Default)]
|
||||||
pub struct Xvb {
|
pub struct Xvb {
|
||||||
|
pub simple: bool,
|
||||||
pub token: String,
|
pub token: String,
|
||||||
pub mode: XvbMode,
|
pub mode: XvbMode,
|
||||||
pub amount: String
|
pub amount: String
|
||||||
|
|
Loading…
Reference in a new issue