Add ThemeChanged variant to Event in iced_sentinel
This commit is contained in:
parent
7f7c5ea337
commit
c856d2b513
13 changed files with 69 additions and 4 deletions
|
|
@ -1,3 +1,4 @@
|
|||
use crate::style::theme;
|
||||
use crate::{Input, Timing, SOCKET_ADDRESS};
|
||||
|
||||
use tokio::io::{self, AsyncWriteExt};
|
||||
|
|
@ -11,6 +12,10 @@ pub struct Client {
|
|||
}
|
||||
|
||||
impl Client {
|
||||
pub fn report_theme_change(&mut self, palette: theme::Palette) {
|
||||
let _ = self.sender.try_send(Input::ThemeChanged(palette));
|
||||
}
|
||||
|
||||
pub fn report_timing(&mut self, timing: Timing) {
|
||||
let _ = self.sender.try_send(Input::TimingMeasured(timing));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
pub use iced_core as core;
|
||||
pub use iced_style as style;
|
||||
|
||||
pub mod client;
|
||||
pub mod timing;
|
||||
|
||||
use crate::style::theme;
|
||||
use crate::timing::Timing;
|
||||
|
||||
use futures::future;
|
||||
|
|
@ -18,6 +20,7 @@ pub const SOCKET_ADDRESS: &str = "127.0.0.1:9167";
|
|||
pub enum Input {
|
||||
Connected(Version),
|
||||
TimingMeasured(Timing),
|
||||
ThemeChanged(theme::Palette),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
@ -25,6 +28,7 @@ pub enum Event {
|
|||
Connected(Version),
|
||||
Disconnected,
|
||||
TimingMeasured(Timing),
|
||||
ThemeChanged(theme::Palette),
|
||||
}
|
||||
|
||||
pub fn run() -> impl Stream<Item = Event> {
|
||||
|
|
@ -87,6 +91,9 @@ async fn receive(
|
|||
Input::TimingMeasured(timing) => {
|
||||
Event::TimingMeasured(timing)
|
||||
}
|
||||
Input::ThemeChanged(palette) => {
|
||||
Event::ThemeChanged(palette)
|
||||
}
|
||||
},
|
||||
))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue