IMPL EXISTS U DOG
parent
f310b53a98
commit
df0e16797c
BIN
src/.gui.rs.swp
BIN
src/.gui.rs.swp
Binary file not shown.
21
src/gui.rs
21
src/gui.rs
|
|
@ -5,14 +5,26 @@ use iced::event;
|
||||||
use iced::subscription;
|
use iced::subscription;
|
||||||
use iced::{Alignment, Element, Application, Settings, Subscription, Theme, Command};
|
use iced::{Alignment, Element, Application, Settings, Subscription, Theme, Command};
|
||||||
|
|
||||||
pub fn main() -> iced::Result {
|
pub fn main(outputEngine: dyn FnMut(Vec<char>)) -> iced::Result {
|
||||||
Main::run(Settings::default())
|
let settings = Settings{
|
||||||
|
flags: Flags {
|
||||||
|
outputEngine: outputEngine,
|
||||||
|
},
|
||||||
|
..Settings::<Flags>::default()
|
||||||
|
};
|
||||||
|
Main::run(settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Main {
|
struct Main {
|
||||||
ntfy: String,
|
ntfy: String,
|
||||||
configuring: Option<Message>,
|
configuring: Option<Message>,
|
||||||
inputs: Inputs,
|
inputs: Inputs,
|
||||||
|
flags: Flags,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct Flags {
|
||||||
|
outputEngine: dyn FnMut(Vec<char>),
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Inputs {
|
struct Inputs {
|
||||||
|
|
@ -53,11 +65,11 @@ fn controller_button_to_string(msg: Message) -> String {
|
||||||
|
|
||||||
impl Application for Main {
|
impl Application for Main {
|
||||||
type Message = Message;
|
type Message = Message;
|
||||||
type Flags = ();
|
type Flags = Flags;
|
||||||
type Theme = Theme;
|
type Theme = Theme;
|
||||||
type Executor = executor::Default;
|
type Executor = executor::Default;
|
||||||
|
|
||||||
fn new(_flags: ()) -> (Self, Command<Message>) {
|
fn new(flags: Self::Flags) -> (Self, Command<Message>) {
|
||||||
return (Self {
|
return (Self {
|
||||||
ntfy: String::from(":wave:"),
|
ntfy: String::from(":wave:"),
|
||||||
configuring: None,
|
configuring: None,
|
||||||
|
|
@ -75,6 +87,7 @@ impl Application for Main {
|
||||||
l: iced::keyboard::KeyCode::Q,
|
l: iced::keyboard::KeyCode::Q,
|
||||||
r: iced::keyboard::KeyCode::E,
|
r: iced::keyboard::KeyCode::E,
|
||||||
},
|
},
|
||||||
|
flags: flags,
|
||||||
}, Command::none())
|
}, Command::none())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,10 @@ mod gui;
|
||||||
fn main() {
|
fn main() {
|
||||||
let cfg = config::build_config().unwrap();
|
let cfg = config::build_config().unwrap();
|
||||||
if cfg.streams.input.engine.name == "gui" {
|
if cfg.streams.input.engine.name == "gui" {
|
||||||
gui::main().unwrap();
|
let output_engine = engine::build_output_engine(&cfg.streams.output.engine);
|
||||||
|
let mut output_engine = output_engine.unwrap();
|
||||||
|
let cb = |v: Vec<char>| output_engine.put(v);
|
||||||
|
gui::main(cb).unwrap();
|
||||||
} else {
|
} else {
|
||||||
main_cli(cfg);
|
main_cli(cfg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue