diff --git a/crates/composition/src/builder.rs b/crates/composition/src/builder.rs index e438b29..88790a2 100644 --- a/crates/composition/src/builder.rs +++ b/crates/composition/src/builder.rs @@ -1,5 +1,5 @@ use crate::Result; -use crate::system::App; +use crate::system::SingleWindowShell; use layer_shika_adapters::platform::slint_interpreter::{CompilationResult, Compiler}; use layer_shika_domain::errors::DomainError; use layer_shika_domain::prelude::{ @@ -202,7 +202,7 @@ impl LayerShika { self } - pub fn build(self) -> Result { + pub fn build(self) -> Result { let component_definition = self .state .compilation_result @@ -214,7 +214,7 @@ impl LayerShika { ), })?; - App::new( + SingleWindowShell::new( component_definition, Some(self.state.compilation_result), self.config, diff --git a/crates/composition/src/lib.rs b/crates/composition/src/lib.rs index 1357861..4308ffb 100644 --- a/crates/composition/src/lib.rs +++ b/crates/composition/src/lib.rs @@ -27,7 +27,7 @@ pub use layer_shika_domain::value_objects::popup_request::{ PopupHandle, PopupPlacement, PopupRequest, PopupSize, }; pub use popup_builder::PopupBuilder; -pub use system::{App, EventContext, EventLoopHandle, ShellControl}; +pub use system::{EventContext, EventLoopHandle, ShellControl, SingleWindowShell}; pub use shell::{ LayerSurfaceHandle, Shell, ShellEventContext, ShellEventLoopHandle, ShellWindowConfigHandler, @@ -57,10 +57,10 @@ pub enum Error { pub mod prelude { pub use crate::{ - AnchorEdges, AnchorStrategy, App, EventContext, EventLoopHandle, KeyboardInteractivity, - Layer, LayerShika, OutputGeometry, OutputHandle, OutputInfo, OutputPolicy, OutputRegistry, + AnchorEdges, AnchorStrategy, EventContext, EventLoopHandle, KeyboardInteractivity, Layer, + LayerShika, OutputGeometry, OutputHandle, OutputInfo, OutputPolicy, OutputRegistry, PopupBuilder, PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest, PopupSize, - PopupWindow, Result, ShellControl, + PopupWindow, Result, ShellControl, SingleWindowShell, }; pub use crate::{ diff --git a/crates/composition/src/popup_builder.rs b/crates/composition/src/popup_builder.rs index 361f74f..97babe2 100644 --- a/crates/composition/src/popup_builder.rs +++ b/crates/composition/src/popup_builder.rs @@ -1,12 +1,12 @@ use crate::Result; -use crate::system::App; +use crate::system::SingleWindowShell; use layer_shika_adapters::platform::slint_interpreter::Value; use layer_shika_domain::prelude::AnchorStrategy; use layer_shika_domain::value_objects::popup_positioning_mode::PopupPositioningMode; use layer_shika_domain::value_objects::popup_request::{PopupPlacement, PopupRequest, PopupSize}; pub struct PopupBuilder<'a> { - app: &'a App, + shell: &'a SingleWindowShell, component: String, reference: PopupPlacement, anchor: PopupPositioningMode, @@ -17,9 +17,9 @@ pub struct PopupBuilder<'a> { } impl<'a> PopupBuilder<'a> { - pub(crate) fn new(app: &'a App, component: String) -> Self { + pub(crate) fn new(shell: &'a SingleWindowShell, component: String) -> Self { Self { - app, + shell, component, reference: PopupPlacement::AtCursor, anchor: PopupPositioningMode::TopLeft, @@ -146,9 +146,9 @@ impl<'a> PopupBuilder<'a> { pub fn bind(self, trigger_callback: &str) -> Result<()> { let request = self.build_request(); - let control = self.app.control(); + let control = self.shell.control(); - self.app.with_all_component_instances(|instance| { + self.shell.with_all_component_instances(|instance| { let request_clone = request.clone(); let control_clone = control.clone(); @@ -171,10 +171,10 @@ impl<'a> PopupBuilder<'a> { pub fn toggle(self, trigger_callback: &str) -> Result<()> { let request = self.build_request(); - let control = self.app.control(); + let control = self.shell.control(); let component_name = request.component.clone(); - self.app.with_all_component_instances(|instance| { + self.shell.with_all_component_instances(|instance| { let request_clone = request.clone(); let control_clone = control.clone(); let component_clone = component_name.clone(); @@ -203,9 +203,9 @@ impl<'a> PopupBuilder<'a> { let grab = self.grab; let close_callback = self.close_callback.clone(); let resize_callback = self.resize_callback.clone(); - let control = self.app.control(); + let control = self.shell.control(); - self.app.with_all_component_instances(|instance| { + self.shell.with_all_component_instances(|instance| { let component_clone = component_name.clone(); let control_clone = control.clone(); let close_cb = close_callback.clone(); diff --git a/crates/composition/src/system.rs b/crates/composition/src/system.rs index 9932fcc..28e4e12 100644 --- a/crates/composition/src/system.rs +++ b/crates/composition/src/system.rs @@ -308,12 +308,18 @@ impl EventContext<'_> { }) })?; - log::debug!("Got compilation result, looking for component '{}'", req.component); + log::debug!( + "Got compilation result, looking for component '{}'", + req.component + ); let definition = compilation_result .component(&req.component) .ok_or_else(|| { - log::error!("Component '{}' not found in compilation result", req.component); + log::error!( + "Component '{}' not found in compilation result", + req.component + ); Error::Domain(DomainError::Configuration { message: format!( "{} component not found in compilation result", @@ -637,12 +643,12 @@ impl EventContext<'_> { } } -pub struct App { +pub struct SingleWindowShell { inner: Rc>, popup_command_sender: channel::Sender, } -impl App { +impl SingleWindowShell { pub(crate) fn new( component_definition: ComponentDefinition, compilation_result: Option>, @@ -659,14 +665,14 @@ impl App { let (sender, receiver) = channel::channel(); - let system = Self { + let shell = Self { inner: Rc::clone(&inner_rc), popup_command_sender: sender, }; - system.setup_popup_command_handler(receiver)?; + shell.setup_popup_command_handler(receiver)?; - Ok(system) + Ok(shell) } fn setup_popup_command_handler(&self, receiver: channel::Channel) -> Result<()> { diff --git a/src/lib.rs b/src/lib.rs index 28ab3ca..a8a50c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -63,10 +63,10 @@ pub mod prelude; pub use layer_shika_composition::{ - AnchorEdges, AnchorStrategy, App, Error, EventContext, EventLoopHandle, KeyboardInteractivity, + AnchorEdges, AnchorStrategy, Error, EventContext, EventLoopHandle, KeyboardInteractivity, Layer, LayerShika, OutputGeometry, OutputHandle, OutputInfo, OutputPolicy, OutputRegistry, PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest, PopupSize, PopupWindow, - Result, ShellControl, + Result, ShellControl, SingleWindowShell, }; pub use layer_shika_composition::{ diff --git a/src/prelude.rs b/src/prelude.rs index 6fa7b77..4850c1a 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -9,7 +9,8 @@ #![allow(clippy::pub_use)] pub use crate::{ - App, Error, EventContext, EventLoopHandle, LayerShika, PopupWindow, Result, ShellControl, + Error, EventContext, EventLoopHandle, LayerShika, PopupWindow, Result, ShellControl, + SingleWindowShell, }; pub use crate::{