feat: update about tab
Some checks failed
Lockbud / lockbud (push) Has been cancelled
Rust / fmt (push) Has been cancelled
Rust / test (push) Has been cancelled
Rust / clippy (macos-latest) (push) Has been cancelled
Rust / clippy (ubuntu-latest) (push) Has been cancelled
Rust / check (macos-latest) (push) Has been cancelled
Rust / check (ubuntu-latest) (push) Has been cancelled
Rust / doc (push) Has been cancelled
Typo / typo (push) Has been cancelled

This commit is contained in:
Cyrix126 2024-11-23 23:05:11 +01:00
parent 207c236b64
commit 2b49c4c0a3
2 changed files with 269 additions and 161 deletions

View file

@ -0,0 +1,156 @@
use egui::{Image, Label, ScrollArea, TextStyle, Ui, Vec2};
use log::debug;
use crate::{
BYTES_BANNER, COMMIT, GUPAX_VERSION, KEYBOARD_SHORTCUTS, OS_NAME, P2POOL_VERSION, SPACE,
XMRIG_PROXY_VERSION, XMRIG_VERSION,
app::keys::KeyPressed,
errors::{ErrorButtons, ErrorFerris},
};
impl crate::app::App {
#[allow(clippy::too_many_arguments)]
pub fn about_show(&mut self, key: KeyPressed, ui: &mut Ui) {
ScrollArea::vertical().show(ui, |ui|{
debug!("App | Entering [About] Tab");
// If [D], show some debug info with [ErrorState]
if key.is_d() {
debug!("App | Entering [Debug Info]");
#[cfg(feature = "distro")]
let distro = true;
#[cfg(not(feature = "distro"))]
let distro = false;
let node_gui_len = self.node_api.lock().unwrap().output.len();
let p2pool_gui_len = self.p2pool_api.lock().unwrap().output.len();
let xmrig_gui_len = self.xmrig_api.lock().unwrap().output.len();
let xmrig_proxy_gui_len = self.xmrig_proxy_api.lock().unwrap().output.len();
let gupax_p2pool_api = self.gupax_p2pool_api.lock().unwrap();
let debug_info = format!(
"Gupax version: {}\n
Bundled Node version: {}\n
Bundled P2Pool version: {}\n
Bundled XMRig version: {}\n
Bundled XMRig-Proxy version: {}\n
Gupax uptime: {} seconds\n
Selected resolution: {}x{}\n
Internal resolution: {}x{}\n
Operating system: {}\n
Max detected threads: {}\n
Gupax PID: {}\n
State diff: {}\n
Node list length: {}\n
Pool list length: {}\n
Admin privilege: {}\n
Release build: {}\n
Debug build: {}\n
Distro build: {}\n
Build commit: {}\n
OS Data PATH: {}\n
Gupax PATH: {}\n
P2Pool PATH: {}\n
XMRig PATH: {}\n
XMRig-Proxy PATH: {}\n
P2Pool console byte length: {}\n
XMRig console byte length: {}\n
XMRig-Proxy console byte length: {}\n
------------------------------------------ P2POOL IMAGE ------------------------------------------
{:#?}\n
------------------------------------------ XMRIG IMAGE ------------------------------------------
{:#?}\n
------------------------------------------ GUPAX-P2POOL API ------------------------------------------
payout: {:#?}
payout_u64: {:#?}
xmr: {:#?}
path_log: {:#?}
path_payout: {:#?}
path_xmr: {:#?}\n
------------------------------------------ WORKING STATE ------------------------------------------
{:#?}\n
------------------------------------------ ORIGINAL STATE ------------------------------------------
{:#?}",
GUPAX_VERSION,
P2POOL_VERSION,
XMRIG_VERSION,
XMRIG_PROXY_VERSION,
self.now.elapsed().as_secs_f32(),
self.state.gupax.selected_width,
self.state.gupax.selected_height,
self.size.x,
self.size.y,
OS_NAME,
self.max_threads,
self.pid,
self.diff,
self.node_vec.len(),
self.pool_vec.len(),
self.admin,
!cfg!(debug_assertions),
cfg!(debug_assertions),
distro,
COMMIT,
self.os_data_path.display(),
self.exe,
self.state.gupax.absolute_p2pool_path.display(),
self.state.gupax.absolute_xmrig_path.display(),
self.state.gupax.absolute_xp_path.display(),
node_gui_len,
p2pool_gui_len,
xmrig_gui_len,
xmrig_proxy_gui_len,
self.p2pool_img.lock().unwrap(),
self.xmrig_img.lock().unwrap(),
gupax_p2pool_api.payout,
gupax_p2pool_api.payout_u64,
gupax_p2pool_api.xmr,
gupax_p2pool_api.path_log,
gupax_p2pool_api.path_payout,
gupax_p2pool_api.path_xmr,
self.state,
self.og.lock().unwrap(),
);
self.error_state
.set(debug_info, ErrorFerris::Cute, ErrorButtons::Debug);
}
ui.add_space(10.0);
ui.vertical_centered(|ui| {
let space = SPACE * 2.0;
ui.style_mut().override_text_style = Some(TextStyle::Heading);
// ui.set_max_height(max_height);
// Display [Gupaxx] banner
// let link_width = width / 14.0;
ui.add_sized(
Vec2::new(ui.text_style_height(&TextStyle::Heading) * 20.0, 226.0),
Image::from_bytes("bytes://banner.png", BYTES_BANNER),
);
ui.label("is a GUI for mining");
ui.add_space(space);
ui.hyperlink_to("[Monero]", "https://www.getmonero.org");
ui.label("on");
ui.hyperlink_to("[P2Pool]", "https://www.github.com/SChernykh/p2pool");
ui.add_space(space);
ui.label("using");
ui.add_space(space);
ui.hyperlink_to("[Monerod]", "https://github.com/monero-project/monero");
ui.hyperlink_to("[Xmrig]", "https://www.github.com/xmrig/xmrig");
ui.hyperlink_to("[Xmrig-Proxy]", "https://www.github.com/xmrig/xmrig-proxy");
ui.add_space(space);
ui.label(" and participating in");
ui.hyperlink_to("[XvB Bonus Hashrate Raffle]", "https://xmrvsbeast.com");
ui.add_space(space);
ui.add_sized([ui.available_width(), 0.0], Label::new(KEYBOARD_SHORTCUTS));
ui.add_space(space);
if cfg!(debug_assertions) {
ui.label(format!(
"Gupaxx is running in debug mode - {}",
self.now.elapsed().as_secs_f64()
));
}
ui.label(format!(
"Gupaxx has been running for {}",
self.pub_sys.lock().unwrap().gupax_uptime
));
});
});
}
}

View file

@ -3,10 +3,9 @@ use crate::app::eframe_impl::ProcessStatesGui;
use crate::app::keys::KeyPressed; use crate::app::keys::KeyPressed;
use crate::helper::ProcessName; use crate::helper::ProcessName;
use crate::utils::constants::*; use crate::utils::constants::*;
use crate::utils::errors::{ErrorButtons, ErrorFerris};
use egui::*; use egui::*;
use log::debug; use log::debug;
mod about;
mod gupax; mod gupax;
mod node; mod node;
mod p2pool; mod p2pool;
@ -26,164 +25,117 @@ impl crate::app::App {
// Middle panel, contents of the [Tab] // Middle panel, contents of the [Tab]
debug!("App | Rendering CENTRAL_PANEL (tab contents)"); debug!("App | Rendering CENTRAL_PANEL (tab contents)");
CentralPanel::default().show(ctx, |ui| { CentralPanel::default().show(ctx, |ui| {
// This sets the Ui dimensions after Top/Bottom are filled self.size.x = ui.available_width();
self.size.x = ui.available_width(); self.size.y = ui.available_height();
self.size.y = ui.available_height(); // This sets the Ui dimensions after Top/Bottom are filled
ui.style_mut().override_text_style = Some(TextStyle::Body); ui.style_mut().override_text_style = Some(TextStyle::Body);
match self.tab { match self.tab {
Tab::About => { Tab::About => self.about_show(key, ui),
debug!("App | Entering [About] Tab"); Tab::Status => {
// If [D], show some debug info with [ErrorState] debug!("App | Entering [Status] Tab");
if key.is_d() { crate::disk::state::Status::show(
debug!("App | Entering [Debug Info]"); &mut self.state.status,
#[cfg(feature = "distro")] &self.pub_sys,
let distro = true; &self.node_api,
#[cfg(not(feature = "distro"))] &self.p2pool_api,
let distro = false; &self.xmrig_api,
let node_gui_len = self.node_api.lock().unwrap().output.len(); &self.xmrig_proxy_api,
let p2pool_gui_len = self.p2pool_api.lock().unwrap().output.len(); &self.xvb_api,
let xmrig_gui_len = self.xmrig_api.lock().unwrap().output.len(); &self.p2pool_img,
let xmrig_proxy_gui_len = self.xmrig_proxy_api.lock().unwrap().output.len(); &self.xmrig_img,
let gupax_p2pool_api = self.gupax_p2pool_api.lock().unwrap(); states,
let debug_info = format!( self.max_threads,
"Gupax version: {}\n &self.gupax_p2pool_api,
Bundled Node version: {}\n &self.benchmarks,
Bundled P2Pool version: {}\n self.size,
Bundled XMRig version: {}\n ctx,
Bundled XMRig-Proxy version: {}\n ui,
Gupax uptime: {} seconds\n );
Selected resolution: {}x{}\n }
Internal resolution: {}x{}\n Tab::Gupax => {
Operating system: {}\n debug!("App | Entering [Gupax] Tab");
Max detected threads: {}\n crate::disk::state::Gupax::show(
Gupax PID: {}\n &mut self.state.gupax,
State diff: {}\n &self.og,
Node list length: {}\n &self.state_path,
Pool list length: {}\n &self.update,
Admin privilege: {}\n &self.file_window,
Release build: {}\n &mut self.error_state,
Debug build: {}\n &self.restart,
Distro build: {}\n self.size,
Build commit: {}\n frame,
OS Data PATH: {}\n ctx,
Gupax PATH: {}\n ui,
P2Pool PATH: {}\n &mut self.must_resize,
XMRig PATH: {}\n );
XMRig-Proxy PATH: {}\n }
P2Pool console byte length: {}\n Tab::Node => {
XMRig console byte length: {}\n debug!("App | Entering [Node] Tab");
XMRig-Proxy console byte length: {}\n crate::disk::state::Node::show(
------------------------------------------ P2POOL IMAGE ------------------------------------------ &mut self.state.node,
{:#?}\n &self.node,
------------------------------------------ XMRIG IMAGE ------------------------------------------ &self.node_api,
{:#?}\n &mut self.node_stdin,
------------------------------------------ GUPAX-P2POOL API ------------------------------------------ self.size,
payout: {:#?} &self.file_window,
payout_u64: {:#?} ui,
xmr: {:#?} );
path_log: {:#?} }
path_payout: {:#?} Tab::P2pool => {
path_xmr: {:#?}\n debug!("App | Entering [P2Pool] Tab");
------------------------------------------ WORKING STATE ------------------------------------------ crate::disk::state::P2pool::show(
{:#?}\n &mut self.state.p2pool,
------------------------------------------ ORIGINAL STATE ------------------------------------------ &mut self.node_vec,
{:#?}", &self.og,
GUPAX_VERSION, &self.ping,
P2POOL_VERSION, &self.p2pool,
XMRIG_VERSION, &self.p2pool_api,
XMRIG_PROXY_VERSION, &mut self.p2pool_stdin,
self.now.elapsed().as_secs_f32(), self.size,
self.state.gupax.selected_width, ctx,
self.state.gupax.selected_height, ui,
self.size.x, );
self.size.y, }
OS_NAME, Tab::Xmrig => {
self.max_threads, debug!("App | Entering [XMRig] Tab");
self.pid, crate::disk::state::Xmrig::show(
self.diff, &mut self.state.xmrig,
self.node_vec.len(), &mut self.pool_vec,
self.pool_vec.len(), &self.xmrig,
self.admin, &self.xmrig_api,
!cfg!(debug_assertions), &mut self.xmrig_stdin,
cfg!(debug_assertions), self.size,
distro, ctx,
COMMIT, ui,
self.os_data_path.display(), );
self.exe, }
self.state.gupax.absolute_p2pool_path.display(), Tab::XmrigProxy => {
self.state.gupax.absolute_xmrig_path.display(), debug!("App | Entering [XMRig-Proxy] Tab");
self.state.gupax.absolute_xp_path.display(), crate::disk::state::XmrigProxy::show(
node_gui_len, &mut self.state.xmrig_proxy,
p2pool_gui_len, &self.xmrig_proxy,
xmrig_gui_len, &mut self.pool_vec,
xmrig_proxy_gui_len, &self.xmrig_proxy_api,
self.p2pool_img.lock().unwrap(), &mut self.xmrig_proxy_stdin,
self.xmrig_img.lock().unwrap(), self.size,
gupax_p2pool_api.payout, ui,
gupax_p2pool_api.payout_u64, );
gupax_p2pool_api.xmr, }
gupax_p2pool_api.path_log, Tab::Xvb => {
gupax_p2pool_api.path_payout, debug!("App | Entering [XvB] Tab");
gupax_p2pool_api.path_xmr, crate::disk::state::Xvb::show(
self.state, &mut self.state.xvb,
self.og.lock().unwrap(), self.size,
); &self.state.p2pool.address,
self.error_state.set(debug_info, ErrorFerris::Cute, ErrorButtons::Debug); ctx,
} ui,
let width = self.size.x; &self.xvb_api,
let height = self.size.y/30.0; &self.xmrig_api,
let max_height = self.size.y; &self.xmrig_proxy_api,
let size = vec2(width, height); states.is_alive(ProcessName::Xvb),
ui.add_space(10.0); );
ui.vertical_centered(|ui| { }
ui.set_max_height(max_height); }
// Display [Gupax] banner });
let link_width = width/14.0;
ui.add_sized(Vec2::new(width, height*3.0), Image::from_bytes("bytes://banner.png", BYTES_BANNER));
ui.add_sized(size, Label::new("is a GUI for mining"));
ui.add_sized([link_width, height], Hyperlink::from_label_and_url("[Monero]", "https://www.github.com/monero-project/monero"));
ui.add_sized(size, Label::new("on"));
ui.add_sized([link_width, height], Hyperlink::from_label_and_url("[P2Pool]", "https://www.github.com/SChernykh/p2pool"));
ui.add_sized(size, Label::new("using"));
ui.add_sized([link_width, height], Hyperlink::from_label_and_url("[XMRig]", "https://www.github.com/xmrig/xmrig"));
ui.add_space(SPACE*2.0);
ui.add_sized(size, Label::new(KEYBOARD_SHORTCUTS));
ui.add_space(SPACE*2.0);
if cfg!(debug_assertions) { ui.label(format!("Gupax is running in debug mode - {}", self.now.elapsed().as_secs_f64())); }
ui.label(format!("Gupax has been running for {}", self.pub_sys.lock().unwrap().gupax_uptime));
});
}
Tab::Status => {
debug!("App | Entering [Status] Tab");
crate::disk::state::Status::show(&mut self.state.status, &self.pub_sys, &self.node_api, &self.p2pool_api, &self.xmrig_api,&self.xmrig_proxy_api, &self.xvb_api,&self.p2pool_img, &self.xmrig_img, states, self.max_threads, &self.gupax_p2pool_api, &self.benchmarks, self.size, ctx, ui);
}
Tab::Gupax => {
debug!("App | Entering [Gupax] Tab");
crate::disk::state::Gupax::show(&mut self.state.gupax, &self.og, &self.state_path, &self.update, &self.file_window, &mut self.error_state, &self.restart, self.size, frame, ctx, ui, &mut self.must_resize);
}
Tab::Node=> {
debug!("App | Entering [Node] Tab");
crate::disk::state::Node::show(&mut self.state.node, &self.node, &self.node_api, &mut self.node_stdin, self.size, &self.file_window, ui);
}
Tab::P2pool => {
debug!("App | Entering [P2Pool] Tab");
crate::disk::state::P2pool::show(&mut self.state.p2pool, &mut self.node_vec, &self.og, &self.ping, &self.p2pool, &self.p2pool_api, &mut self.p2pool_stdin, self.size, ctx, ui);
}
Tab::Xmrig => {
debug!("App | Entering [XMRig] Tab");
crate::disk::state::Xmrig::show(&mut self.state.xmrig, &mut self.pool_vec, &self.xmrig, &self.xmrig_api, &mut self.xmrig_stdin, self.size, ctx, ui);
}
Tab::XmrigProxy => {
debug!("App | Entering [XMRig-Proxy] Tab");
crate::disk::state::XmrigProxy::show(&mut self.state.xmrig_proxy, &self.xmrig_proxy, &mut self.pool_vec, &self.xmrig_proxy_api, &mut self.xmrig_proxy_stdin, self.size, ui);
}
Tab::Xvb => {
debug!("App | Entering [XvB] Tab");
crate::disk::state::Xvb::show(&mut self.state.xvb, self.size, &self.state.p2pool.address, ctx, ui, &self.xvb_api, &self.xmrig_api, &self.xmrig_proxy_api, states.is_alive(ProcessName::Xvb));
}
}
});
} }
} }