From f97935d1e8aabc44aaeed95e7f9f7a17929e936a Mon Sep 17 00:00:00 2001 From: hinto-janaiyo Date: Sun, 1 Jan 2023 14:51:10 -0500 Subject: [PATCH] Status Submenu: remove [Monero] submenu, fix [P2Pool] spacing There's not much interesting data I could display that regular Monero GUI or a block explorer can't do, so I'm scrapping the [Monero] tab. Maybe it'll come back if I rewrite [Status] to include graphs (never). The [P2Pool] submenu is pretty much done, this changed the spacing to make the logs larger and so all the elements fit correctly. --- src/constants.rs | 12 ++++++------ src/disk.rs | 1 - src/helper.rs | 38 ++++---------------------------------- src/main.rs | 12 +++--------- src/status.rs | 8 ++++---- 5 files changed, 17 insertions(+), 54 deletions(-) diff --git a/src/constants.rs b/src/constants.rs index 2f548c9..2d7056b 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -175,13 +175,13 @@ pub const STATUS_XMRIG_THREADS: &str = "The amount of threads XMRig is curre pub const STATUS_SUBMENU_PROCESSES: &str = "View the status of process related data for [Gupax|P2Pool|XMRig]"; pub const STATUS_SUBMENU_P2POOL: &str = "View P2Pool specific data"; pub const STATUS_SUBMENU_MONERO: &str = "View general Monero blockchain data"; -pub const STATUS_SUBMENU_PAYOUT: &str = "The total amount of payouts received via P2Pool across all time"; //-- P2Pool -pub const STATUS_SUBMENU_XMR: &str = "The total of XMR mined via P2Pool across all time"; -pub const STATUS_SUBMENU_LATEST: &str = "Sort the logs latest to oldest"; -pub const STATUS_SUBMENU_OLDEST: &str = "Sort the logs oldest to latest"; -pub const STATUS_SUBMENU_BIGGEST: &str = "Sort the logs by the biggest payouts first"; -pub const STATUS_SUBMENU_SMALLEST: &str = "Sort the logs by the smallest payouts first"; +pub const STATUS_SUBMENU_PAYOUT: &str = "The total amount of payouts received via P2Pool across all time. This includes all payouts you have ever received using Gupax and P2Pool."; +pub const STATUS_SUBMENU_XMR: &str = "The total of XMR mined via P2Pool across all time. This includes all the XMR you have ever mined using Gupax and P2Pool."; +pub const STATUS_SUBMENU_LATEST: &str = "Sort the payouts from latest to oldest"; +pub const STATUS_SUBMENU_OLDEST: &str = "Sort the payouts from oldest to latest"; +pub const STATUS_SUBMENU_BIGGEST: &str = "Sort the payouts from biggest to smallest"; +pub const STATUS_SUBMENU_SMALLEST: &str = "Sort the payouts from smallest to biggest"; pub const STATUS_SUBMENU_AUTOMATIC: &str = "Automatically calculate share/block time with your current P2Pool 1 hour average hashrate"; pub const STATUS_SUBMENU_MANUAL: &str = "Manually input a hashrate to calculate share/block time with current P2Pool/Monero network stats"; pub const STATUS_SUBMENU_HASH: &str = "Use [Hash] as the hashrate metric"; diff --git a/src/disk.rs b/src/disk.rs index bd245ac..70ff0e8 100644 --- a/src/disk.rs +++ b/src/disk.rs @@ -823,7 +823,6 @@ pub enum File { pub enum Submenu { Processes, P2pool, - Monero, } impl Default for Submenu { diff --git a/src/helper.rs b/src/helper.rs index b7d78a4..1dd58f4 100644 --- a/src/helper.rs +++ b/src/helper.rs @@ -200,6 +200,8 @@ pub enum ProcessState { Waiting, // Process was successfully killed by a restart, and is ready to be started again, YELLOW! } +impl Default for ProcessState { fn default() -> Self { Self::Dead } } + #[derive(Copy,Clone,Eq,PartialEq,Debug)] pub enum ProcessSignal { None, @@ -208,6 +210,8 @@ pub enum ProcessSignal { Restart, } +impl Default for ProcessSignal { fn default() -> Self { Self::None } } + #[derive(Copy,Clone,Eq,PartialEq,Debug)] pub enum ProcessName { P2pool, @@ -1828,40 +1832,6 @@ impl Hashrate { } } -//---------------------------------------------------------------------------------------------------- PubMoneroApi -#[derive(Debug,Clone)] -struct PubMoneroApi { - size: HumanNumber, // Blockchain size in GB - diff: HumanNumber, // Current difficulty - height: HumanNumber, // Current height - incoming: HumanNumber, // In-peers - outgoing: HumanNumber, // Out-peers - restricted: bool, // Is RPC in restricted mode? - synchronized: bool, // Are we synced? - tx_pool_size: HumanNumber, // Current amout of TX in TX pool -} - -//---------------------------------------------------------------------------------------------------- PrivMoneroApi -// This matches some stats from monerod's JSON-RPC HTTP call [get_info] -// It _seems_ monerod initializes stats with [0], so no [Option], hopefully nothing panics :D -#[derive(Debug, Serialize, Deserialize, Clone)] -struct PrivMoneroApi { - result: Result, -} -#[derive(Debug, Serialize, Deserialize, Clone)] -struct Result { - database_size: u128, // bytes - difficulty: u128, - height: u64, - incoming_connections_count: u32, - nettype: String, // mainnet, stagenet, testnet - outgoing_connections_count: u32, - restricted: bool, - status: String, // OK - synchronized: bool, - tx_pool_size: u32, // tx pool -} - //---------------------------------------------------------------------------------------------------- TESTS #[cfg(test)] mod test { diff --git a/src/main.rs b/src/main.rs index d31a543..7bd0d23 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1058,9 +1058,8 @@ impl eframe::App for App { match self.tab { Tab::Status => { match self.state.status.submenu { - Submenu::Processes => self.state.status.submenu = Submenu::Monero, + Submenu::Processes => self.state.status.submenu = Submenu::P2pool, Submenu::P2pool => self.state.status.submenu = Submenu::Processes, - Submenu::Monero => self.state.status.submenu = Submenu::P2pool, } }, Tab::Gupax => flip!(self.state.gupax.simple), @@ -1074,8 +1073,7 @@ impl eframe::App for App { Tab::Status => { match self.state.status.submenu { Submenu::Processes => self.state.status.submenu = Submenu::P2pool, - Submenu::P2pool => self.state.status.submenu = Submenu::Monero, - Submenu::Monero => self.state.status.submenu = Submenu::Processes, + Submenu::P2pool => self.state.status.submenu = Submenu::Processes, } }, Tab::Gupax => flip!(self.state.gupax.simple), @@ -1473,11 +1471,7 @@ impl eframe::App for App { match self.tab { Tab::Status => { ui.group(|ui| { - let width = (ui.available_width() / 3.0)-14.25; - if ui.add_sized([width, height], SelectableLabel::new(self.state.status.submenu == Submenu::Monero, "Monero")).on_hover_text(STATUS_SUBMENU_MONERO).clicked() { - self.state.status.submenu = Submenu::Monero; - } - ui.separator(); + let width = (ui.available_width() / 2.0)-10.5; if ui.add_sized([width, height], SelectableLabel::new(self.state.status.submenu == Submenu::P2pool, "P2Pool")).on_hover_text(STATUS_SUBMENU_P2POOL).clicked() { self.state.status.submenu = Submenu::P2pool; } diff --git a/src/status.rs b/src/status.rs index 44d016b..0523251 100644 --- a/src/status.rs +++ b/src/status.rs @@ -133,7 +133,7 @@ pub fn show(&mut self, sys: &Arc>, p2pool_api: &Arc>, p2pool_api: &Arc ui.add_sized([width, log], TextEdit::multiline(&mut api.log_rev.as_str())), PayoutView::Oldest => ui.add_sized([width, log], TextEdit::multiline(&mut api.log.as_str())), @@ -175,6 +176,7 @@ pub fn show(&mut self, sys: &Arc>, p2pool_api: &Arc>, p2pool_api: &Arc>, p2pool_api: &Arc