feat: add new tab Xvb

empty tab
This commit is contained in:
Louis-Marie Baer 2024-02-27 18:47:10 +01:00
parent dd55d87b2e
commit 2c7a1174b7
4 changed files with 44 additions and 5 deletions

View file

@ -270,6 +270,7 @@ impl State {
gupax: Gupax::default(),
p2pool: P2pool::default(),
xmrig: Xmrig::with_threads(max_threads, current_threads),
xvb: Xvb::default(),
version: arc_mut!(Version::default()),
}
}
@ -1145,6 +1146,7 @@ pub struct State {
pub gupax: Gupax,
pub p2pool: P2pool,
pub xmrig: Xmrig,
pub xvb: Xvb,
pub version: Arc<Mutex<Version>>,
}
@ -1227,6 +1229,12 @@ pub struct Xmrig {
pub selected_port: String,
}
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize)]
#[derive(Default)]
pub struct Xvb {
pub token: u32,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Version {
pub gupax: String,
@ -1333,6 +1341,9 @@ impl Default for Xmrig {
}
}
}
impl Default for Version {
fn default() -> Self {
Self {
@ -1438,6 +1449,8 @@ mod test {
selected_ip = "192.168.1.122"
selected_port = "3333"
[xvb]
token = 0
[version]
gupax = "v1.3.0"
p2pool = "v2.5"
@ -1559,6 +1572,8 @@ mod test {
selected_ip = "localhost"
selected_port = "3333"
[xvb]
token = 0
[version]
gupax = "v1.0.0"
p2pool = "v2.5"

View file

@ -18,7 +18,8 @@
use crate::State;
use crate::{constants::*, macros::*, update::*, ErrorState, Restart, Tab};
use egui::{
Button, Checkbox, Label, ProgressBar, RichText, SelectableLabel, Slider, Spinner, TextEdit, Vec2,
Button, Checkbox, Label, ProgressBar, RichText, SelectableLabel, Slider, Spinner, TextEdit,
Vec2,
};
use log::*;
use serde::{Deserialize, Serialize};

View file

@ -70,6 +70,7 @@ mod status;
mod update;
mod xmr;
mod xmrig;
mod xvb;
use {
crate::regex::*, constants::*, disk::*, ferris::*, gupax::*, helper::*, macros::*, node::*,
update::*,
@ -657,6 +658,7 @@ pub enum Tab {
Gupax,
P2pool,
Xmrig,
Xvb
}
impl Default for Tab {
@ -1510,11 +1512,12 @@ impl eframe::App for App {
// Change Tabs LEFT
} else if key.is_z() && !wants_input {
match self.tab {
Tab::About => self.tab = Tab::Xmrig,
Tab::About => self.tab = Tab::Xvb,
Tab::Status => self.tab = Tab::About,
Tab::Gupax => self.tab = Tab::Status,
Tab::P2pool => self.tab = Tab::Gupax,
Tab::Xmrig => self.tab = Tab::P2pool,
Tab::Xvb => self.tab = Tab::Xmrig
};
// Change Tabs RIGHT
} else if key.is_x() && !wants_input {
@ -1523,7 +1526,8 @@ impl eframe::App for App {
Tab::Status => self.tab = Tab::Gupax,
Tab::Gupax => self.tab = Tab::P2pool,
Tab::P2pool => self.tab = Tab::Xmrig,
Tab::Xmrig => self.tab = Tab::About,
Tab::Xmrig => self.tab = Tab::Xvb,
Tab::Xvb => self.tab = Tab::About
};
// Change Submenu LEFT
} else if key.is_c() && !wants_input {
@ -1845,13 +1849,14 @@ impl eframe::App for App {
|| og.gupax != self.state.gupax
|| og.p2pool != self.state.p2pool
|| og.xmrig != self.state.xmrig
|| og.xvb != self.state.xvb
|| self.og_node_vec != self.node_vec || self.og_pool_vec != self.pool_vec;
drop(og);
// Top: Tabs
debug!("App | Rendering TOP tabs");
TopBottomPanel::top("top").show(ctx, |ui| {
let width = (self.width - (SPACE * 10.0)) / 5.0;
let width = (self.width - (SPACE * 12.0)) / 6.0;
let height = self.height / 15.0;
ui.add_space(4.0);
ui.horizontal(|ui| {
@ -1905,7 +1910,17 @@ impl eframe::App for App {
{
self.tab = Tab::Xmrig;
}
});
ui.separator();
if ui
.add_sized(
[width, height],
SelectableLabel::new(self.tab == Tab::Xvb, "XvB"),
)
.clicked()
{
self.tab = Tab::Xvb;
}
});
ui.add_space(4.0);
});
@ -2524,6 +2539,10 @@ path_xmr: {:#?}\n
debug!("App | Entering [XMRig] Tab");
crate::disk::Xmrig::show(&mut self.state.xmrig, &mut self.pool_vec, &self.xmrig, &self.xmrig_api, &mut self.xmrig_stdin, self.width, self.height, ctx, ui);
}
Tab::Xvb => {
debug!("App | Entering [XvB] Tab");
crate::disk::Xvb::show(self.width, self.height, ctx, ui);
}
}
});
}

4
src/xvb.rs Normal file
View file

@ -0,0 +1,4 @@
impl crate::disk::Xvb {
#[inline(always)] // called once
pub fn show(_width: f32, _height: f32, _ctx: &egui::Context, _ui: &mut egui::Ui) {}
}