diff --git a/src/gui/views/network/network.rs b/src/gui/views/network/content.rs similarity index 98% rename from src/gui/views/network/network.rs rename to src/gui/views/network/content.rs index e06b593..2b838df 100644 --- a/src/gui/views/network/network.rs +++ b/src/gui/views/network/content.rs @@ -25,14 +25,14 @@ use crate::gui::views::types::{NetworkTab, NetworkTabType}; use crate::node::Node; /// Network content. -pub struct Network { +pub struct NetworkContent { /// Current tab view to show at ui. current_tab: Box, /// [`Modal`] ids allowed at this ui container. modal_ids: Vec<&'static str>, } -impl Default for Network { +impl Default for NetworkContent { fn default() -> Self { Self { current_tab: Box::new(NetworkNode::default()), @@ -75,13 +75,13 @@ impl Default for Network { } } -impl ModalContainer for Network { +impl ModalContainer for NetworkContent { fn modal_ids(&self) -> &Vec<&'static str> { self.modal_ids.as_ref() } } -impl Network { +impl NetworkContent { pub fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cb: &dyn PlatformCallbacks) { // Show modal content for current ui container. if self.can_draw_modal() { diff --git a/src/gui/views/network/metrics.rs b/src/gui/views/network/metrics.rs index 8433ccd..927d2b1 100644 --- a/src/gui/views/network/metrics.rs +++ b/src/gui/views/network/metrics.rs @@ -19,7 +19,7 @@ use grin_servers::DiffBlock; use crate::gui::Colors; use crate::gui::icons::{AT, COINS, CUBE_TRANSPARENT, HASH, HOURGLASS_LOW, HOURGLASS_MEDIUM, TIMER}; use crate::gui::platform::PlatformCallbacks; -use crate::gui::views::{Modal, Network, View}; +use crate::gui::views::{Modal, NetworkContent, View}; use crate::gui::views::types::{NetworkTab, NetworkTabType}; use crate::node::Node; @@ -40,7 +40,7 @@ impl NetworkTab for NetworkMetrics { let server_stats = Node::get_stats(); // Show message to enable node when it's not running. if !Node::is_running() { - Network::disabled_node_ui(ui); + NetworkContent::disabled_node_ui(ui); return; } diff --git a/src/gui/views/network/mining.rs b/src/gui/views/network/mining.rs index b14f113..d719c82 100644 --- a/src/gui/views/network/mining.rs +++ b/src/gui/views/network/mining.rs @@ -20,7 +20,7 @@ use grin_servers::WorkerStats; use crate::gui::Colors; use crate::gui::icons::{BARBELL, CLOCK_AFTERNOON, CPU, CUBE, FADERS, FOLDER_DASHED, FOLDER_SIMPLE_MINUS, FOLDER_SIMPLE_PLUS, HARD_DRIVES, PLUGS, PLUGS_CONNECTED, POLYGON}; use crate::gui::platform::PlatformCallbacks; -use crate::gui::views::{Modal, Network, View}; +use crate::gui::views::{Modal, NetworkContent, View}; use crate::gui::views::network::setup::StratumSetup; use crate::gui::views::types::{NetworkTab, NetworkTabType}; use crate::node::{Node, NodeConfig}; @@ -41,7 +41,7 @@ impl NetworkTab for NetworkMining { // Show message to enable node when it's not running. if !Node::is_running() { - Network::disabled_node_ui(ui); + NetworkContent::disabled_node_ui(ui); return; } diff --git a/src/gui/views/network/mod.rs b/src/gui/views/network/mod.rs index ac162d0..59ca12f 100644 --- a/src/gui/views/network/mod.rs +++ b/src/gui/views/network/mod.rs @@ -27,8 +27,8 @@ pub use node::*; mod setup; pub use setup::*; -mod network; -pub use network::*; +mod content; +pub use content::*; mod connections; pub use connections::*; diff --git a/src/gui/views/network/node.rs b/src/gui/views/network/node.rs index df63f74..11c4a3c 100644 --- a/src/gui/views/network/node.rs +++ b/src/gui/views/network/node.rs @@ -12,14 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -use eframe::epaint::Stroke; use egui::{RichText, Rounding, ScrollArea}; use grin_servers::PeerStats; use crate::gui::Colors; use crate::gui::icons::{AT, CUBE, DEVICES, FLOW_ARROW, HANDSHAKE, PACKAGE, PLUGS_CONNECTED, SHARE_NETWORK}; use crate::gui::platform::PlatformCallbacks; -use crate::gui::views::{Modal, Network, View}; +use crate::gui::views::{Modal, NetworkContent, View}; use crate::gui::views::types::{NetworkTab, NetworkTabType}; use crate::node::Node; @@ -36,7 +35,7 @@ impl NetworkTab for NetworkNode { let server_stats = Node::get_stats(); // Show message to enable node when it's not running. if !Node::is_running() { - Network::disabled_node_ui(ui); + NetworkContent::disabled_node_ui(ui); return; } diff --git a/src/gui/views/network/setup/node.rs b/src/gui/views/network/setup/node.rs index fa92c77..8b7211f 100644 --- a/src/gui/views/network/setup/node.rs +++ b/src/gui/views/network/setup/node.rs @@ -20,7 +20,7 @@ use crate::AppConfig; use crate::gui::Colors; use crate::gui::icons::{CLIPBOARD_TEXT, CLOCK_CLOCKWISE, COMPUTER_TOWER, COPY, PLUG, POWER, SHIELD, SHIELD_SLASH}; use crate::gui::platform::PlatformCallbacks; -use crate::gui::views::{Modal, ModalPosition, Network, View}; +use crate::gui::views::{Modal, ModalPosition, NetworkContent, View}; use crate::gui::views::network::settings::NetworkSettings; use crate::node::{Node, NodeConfig}; @@ -114,7 +114,7 @@ impl NodeSetup { // Autorun node setup. ui.vertical_centered(|ui| { ui.add_space(6.0); - Network::autorun_node_ui(ui); + NetworkContent::autorun_node_ui(ui); if Node::is_running() { ui.add_space(2.0); ui.label(RichText::new(t!("network_settings.restart_node_required")) diff --git a/src/gui/views/root.rs b/src/gui/views/root.rs index 0582936..c0d722c 100644 --- a/src/gui/views/root.rs +++ b/src/gui/views/root.rs @@ -20,18 +20,18 @@ use lazy_static::lazy_static; use crate::gui::Colors; use crate::gui::platform::PlatformCallbacks; -use crate::gui::views::{Modal, ModalContainer, Network, View, WalletsContent}; +use crate::gui::views::{Modal, ModalContainer, NetworkContent, View, WalletsContent}; use crate::node::Node; lazy_static! { - /// Global state to check if [`Network`] panel is open. + /// Global state to check if [`NetworkContent`] panel is open. static ref NETWORK_PANEL_OPEN: AtomicBool = AtomicBool::new(false); } /// Contains main ui content, handles side panel state. pub struct Root { - /// Side panel [`Network`] content. - network: Network, + /// Side panel [`NetworkContent`] content. + network: NetworkContent, /// Central panel [`WalletsContent`] content. wallets: WalletsContent, @@ -51,7 +51,7 @@ impl Default for Root { let os = OperatingSystem::from_target_os(); let exit_allowed = os == OperatingSystem::Android || os == OperatingSystem::IOS; Self { - network: Network::default(), + network: NetworkContent::default(), wallets: WalletsContent::default(), exit_allowed, show_exit_progress: false, @@ -105,7 +105,7 @@ impl Root { }); } - /// Get [`Network`] panel state and width. + /// Get [`NetworkContent`] panel state and width. fn network_panel_state_width(frame: &mut eframe::Frame) -> (bool, f32) { let dual_panel_mode = Self::is_dual_panel_mode(frame); let is_panel_open = dual_panel_mode || Self::is_network_panel_open(); @@ -117,7 +117,7 @@ impl Root { (is_panel_open, panel_width) } - /// Check if ui can show [`Network`] and [`WalletsContent`] at same time. + /// Check if ui can show [`NetworkContent`] and [`WalletsContent`] at same time. pub fn is_dual_panel_mode(frame: &mut eframe::Frame) -> bool { let w = frame.info().window_info.size.x; let h = frame.info().window_info.size.y; @@ -129,13 +129,13 @@ impl Root { is_wide_screen && w >= (Self::SIDE_PANEL_WIDTH * 2.0) + side_insets } - /// Toggle [`Network`] panel state. + /// Toggle [`NetworkContent`] panel state. pub fn toggle_network_panel() { let is_open = NETWORK_PANEL_OPEN.load(Ordering::Relaxed); NETWORK_PANEL_OPEN.store(!is_open, Ordering::Relaxed); } - /// Check if [`Network`] panel is open. + /// Check if [`NetworkContent`] panel is open. pub fn is_network_panel_open() -> bool { NETWORK_PANEL_OPEN.load(Ordering::Relaxed) } diff --git a/src/gui/views/wallets/wallets.rs b/src/gui/views/wallets/content.rs similarity index 100% rename from src/gui/views/wallets/wallets.rs rename to src/gui/views/wallets/content.rs diff --git a/src/gui/views/wallets/mod.rs b/src/gui/views/wallets/mod.rs index 3ca8cb0..a5dcfe2 100644 --- a/src/gui/views/wallets/mod.rs +++ b/src/gui/views/wallets/mod.rs @@ -16,5 +16,5 @@ mod creation; mod wallet; mod setup; -mod wallets; -pub use wallets::*; \ No newline at end of file +mod content; +pub use content::*; \ No newline at end of file