Update server_view_controller.rs

This commit is contained in:
michael-bailey 2020-09-27 16:57:07 +01:00 committed by michael bailey
parent 3fb7c345ba
commit 9a22addbb9
1 changed files with 20 additions and 1 deletions

View File

@ -6,6 +6,15 @@ use crate::server::ui::main_menu::main_menu;
use cursive::event::Event;
// MARK: - ViewModel stuff
#[allow(dead_code)]
pub enum UpdateTypes {
AddClient()
}
/// # ServerViewConroller
///
/// This Struct contains all the controller logic to allow the server to interact with the view
#[allow(dead_code)]
pub struct ServerViewController {
display: Cursive,
@ -17,6 +26,7 @@ pub struct ServerViewController {
running: String,
}
#[allow(dead_code)]
impl ServerViewController {
pub fn new(server: Server) {
@ -31,11 +41,20 @@ impl ServerViewController {
// set global shortcuts
v.display.add_global_callback(Event::CtrlChar('q'), |s| s.quit());
v.display.add_global_callback(Event::CtrlChar('a'), |s| s.add_layer(About::new()));
v.display.add_global_callback(Event::CtrlChar('a'), |s| s.add_layer(about()));
// seting up menubar
v.display.menubar().add_subtree("Server", main_menu());
v.display.set_autohide_menu(false)
// setup the display menubar.
// TODO: - this will be tied to the server run function
// v.display.add_global_callback(Event::Refresh, |s| s.user_data::<Arc<Server>>().unwrap().);
}
fn get_display_channel() -> CbSink {
Cursive::default().cb_sink().clone()
}