feat: add xvb simple & advanced submenus

This commit is contained in:
mostafaei2002 2024-06-06 17:32:22 +03:30
parent 41999f098f
commit 4ad48308e3
3 changed files with 78 additions and 43 deletions

View file

@ -112,14 +112,17 @@ impl crate::app::App {
wants_input,
);
}
Tab::Xvb => self.xvb_run_actions(
Tab::Xvb => {
self.xvb_submenu(ui, size);
self.xvb_run_actions(
ui,
height,
xvb_is_waiting,
xvb_is_alive,
key,
wants_input,
),
);
},
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) {

View file

@ -117,6 +117,8 @@ impl crate::disk::state::Xvb {
ui.style_mut().spacing.icon_spacing = space_h;
if !self.simple {
ui.group(|ui| {
ui.vertical_centered(|ui| {
ui.horizontal(|ui| {
@ -157,6 +159,8 @@ impl crate::disk::state::Xvb {
});
});
}

View file

@ -253,6 +253,7 @@ pub enum XvbMode {
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize, Default)]
pub struct Xvb {
pub simple: bool,
pub token: String,
pub mode: XvbMode,
pub amount: String