🚧 add useless "add port" button

main
_ 2021-10-10 19:44:45 +00:00
parent bfb96e2475
commit 227c9f7ba4
1 changed files with 8 additions and 3 deletions

View File

@ -105,7 +105,7 @@ impl GuiClient <'_> {
.sum () .sum ()
} }
fn sync_status (&mut self) { pub fn sync_status (&mut self) {
let open_ports = self.open_ports (); let open_ports = self.open_ports ();
self.frame_status.set_label (&format! ("Forwarding {} ports", open_ports)); self.frame_status.set_label (&format! ("Forwarding {} ports", open_ports));
@ -124,10 +124,11 @@ fn main () -> anyhow::Result <()> {
let window_title = opt.window_title.clone ().unwrap_or_else (|| "PTTH client proxy".to_string ()); let window_title = opt.window_title.clone ().unwrap_or_else (|| "PTTH client proxy".to_string ());
let mut wind = Window::new (100, 100, 800, 600, None) let mut wind = Window::new (100, 100, 800, 600, None)
.with_label (&window_title); .with_label (&window_title);
wind.make_resizable (true);
let mut col = Flex::default ().column ().size_of_parent (); let mut col = Flex::default ().column ().size_of_parent ();
let mut frame_status = Frame::default ().with_label ("Forwarding 0 ports"); let mut frame_status = Frame::default ();
col.set_size (&mut frame_status, 30); col.set_size (&mut frame_status, 30);
{ {
@ -147,7 +148,6 @@ fn main () -> anyhow::Result <()> {
let ports = (0..3) let ports = (0..3)
.map (|i| { .map (|i| {
let mut gui = GuiPort::new (fltk_tx, i); let mut gui = GuiPort::new (fltk_tx, i);
col.add (&gui.row);
col.set_size (&mut gui.row, 30); col.set_size (&mut gui.row, 30);
Port { Port {
@ -156,6 +156,9 @@ fn main () -> anyhow::Result <()> {
} }
}).collect (); }).collect ();
let mut but_add_port = Button::default ().with_label ("+");
col.set_size (&mut but_add_port, 30);
col.end (); col.end ();
let mut gui_client = GuiClient { let mut gui_client = GuiClient {
@ -164,6 +167,8 @@ fn main () -> anyhow::Result <()> {
ports, ports,
}; };
gui_client.sync_status ();
wind.end (); wind.end ();
wind.show (); wind.show ();