ui: rename wallets and network content files
This commit is contained in:
parent
00767dd7e0
commit
5add102637
9 changed files with 25 additions and 26 deletions
|
@ -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<dyn NetworkTab>,
|
||||
/// [`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() {
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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::*;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -16,5 +16,5 @@ mod creation;
|
|||
mod wallet;
|
||||
mod setup;
|
||||
|
||||
mod wallets;
|
||||
pub use wallets::*;
|
||||
mod content;
|
||||
pub use content::*;
|
Loading…
Reference in a new issue