refactor: renaming

This commit is contained in:
drendog 2025-12-03 04:26:24 +01:00
parent 736d4d0905
commit e6a087a385
Signed by: dwenya
GPG key ID: 8DD77074645332D0
6 changed files with 34 additions and 27 deletions

View file

@ -1,5 +1,5 @@
use crate::Result; use crate::Result;
use crate::system::App; use crate::system::SingleWindowShell;
use layer_shika_adapters::platform::slint_interpreter::{CompilationResult, Compiler}; use layer_shika_adapters::platform::slint_interpreter::{CompilationResult, Compiler};
use layer_shika_domain::errors::DomainError; use layer_shika_domain::errors::DomainError;
use layer_shika_domain::prelude::{ use layer_shika_domain::prelude::{
@ -202,7 +202,7 @@ impl LayerShika<HasComponent> {
self self
} }
pub fn build(self) -> Result<App> { pub fn build(self) -> Result<SingleWindowShell> {
let component_definition = self let component_definition = self
.state .state
.compilation_result .compilation_result
@ -214,7 +214,7 @@ impl LayerShika<HasComponent> {
), ),
})?; })?;
App::new( SingleWindowShell::new(
component_definition, component_definition,
Some(self.state.compilation_result), Some(self.state.compilation_result),
self.config, self.config,

View file

@ -27,7 +27,7 @@ pub use layer_shika_domain::value_objects::popup_request::{
PopupHandle, PopupPlacement, PopupRequest, PopupSize, PopupHandle, PopupPlacement, PopupRequest, PopupSize,
}; };
pub use popup_builder::PopupBuilder; pub use popup_builder::PopupBuilder;
pub use system::{App, EventContext, EventLoopHandle, ShellControl}; pub use system::{EventContext, EventLoopHandle, ShellControl, SingleWindowShell};
pub use shell::{ pub use shell::{
LayerSurfaceHandle, Shell, ShellEventContext, ShellEventLoopHandle, ShellWindowConfigHandler, LayerSurfaceHandle, Shell, ShellEventContext, ShellEventLoopHandle, ShellWindowConfigHandler,
@ -57,10 +57,10 @@ pub enum Error {
pub mod prelude { pub mod prelude {
pub use crate::{ pub use crate::{
AnchorEdges, AnchorStrategy, App, EventContext, EventLoopHandle, KeyboardInteractivity, AnchorEdges, AnchorStrategy, EventContext, EventLoopHandle, KeyboardInteractivity, Layer,
Layer, LayerShika, OutputGeometry, OutputHandle, OutputInfo, OutputPolicy, OutputRegistry, LayerShika, OutputGeometry, OutputHandle, OutputInfo, OutputPolicy, OutputRegistry,
PopupBuilder, PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest, PopupSize, PopupBuilder, PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest, PopupSize,
PopupWindow, Result, ShellControl, PopupWindow, Result, ShellControl, SingleWindowShell,
}; };
pub use crate::{ pub use crate::{

View file

@ -1,12 +1,12 @@
use crate::Result; use crate::Result;
use crate::system::App; use crate::system::SingleWindowShell;
use layer_shika_adapters::platform::slint_interpreter::Value; use layer_shika_adapters::platform::slint_interpreter::Value;
use layer_shika_domain::prelude::AnchorStrategy; use layer_shika_domain::prelude::AnchorStrategy;
use layer_shika_domain::value_objects::popup_positioning_mode::PopupPositioningMode; use layer_shika_domain::value_objects::popup_positioning_mode::PopupPositioningMode;
use layer_shika_domain::value_objects::popup_request::{PopupPlacement, PopupRequest, PopupSize}; use layer_shika_domain::value_objects::popup_request::{PopupPlacement, PopupRequest, PopupSize};
pub struct PopupBuilder<'a> { pub struct PopupBuilder<'a> {
app: &'a App, shell: &'a SingleWindowShell,
component: String, component: String,
reference: PopupPlacement, reference: PopupPlacement,
anchor: PopupPositioningMode, anchor: PopupPositioningMode,
@ -17,9 +17,9 @@ pub struct PopupBuilder<'a> {
} }
impl<'a> 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 { Self {
app, shell,
component, component,
reference: PopupPlacement::AtCursor, reference: PopupPlacement::AtCursor,
anchor: PopupPositioningMode::TopLeft, anchor: PopupPositioningMode::TopLeft,
@ -146,9 +146,9 @@ impl<'a> PopupBuilder<'a> {
pub fn bind(self, trigger_callback: &str) -> Result<()> { pub fn bind(self, trigger_callback: &str) -> Result<()> {
let request = self.build_request(); 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 request_clone = request.clone();
let control_clone = control.clone(); let control_clone = control.clone();
@ -171,10 +171,10 @@ impl<'a> PopupBuilder<'a> {
pub fn toggle(self, trigger_callback: &str) -> Result<()> { pub fn toggle(self, trigger_callback: &str) -> Result<()> {
let request = self.build_request(); let request = self.build_request();
let control = self.app.control(); let control = self.shell.control();
let component_name = request.component.clone(); 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 request_clone = request.clone();
let control_clone = control.clone(); let control_clone = control.clone();
let component_clone = component_name.clone(); let component_clone = component_name.clone();
@ -203,9 +203,9 @@ impl<'a> PopupBuilder<'a> {
let grab = self.grab; let grab = self.grab;
let close_callback = self.close_callback.clone(); let close_callback = self.close_callback.clone();
let resize_callback = self.resize_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 component_clone = component_name.clone();
let control_clone = control.clone(); let control_clone = control.clone();
let close_cb = close_callback.clone(); let close_cb = close_callback.clone();

View file

@ -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 let definition = compilation_result
.component(&req.component) .component(&req.component)
.ok_or_else(|| { .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 { Error::Domain(DomainError::Configuration {
message: format!( message: format!(
"{} component not found in compilation result", "{} component not found in compilation result",
@ -637,12 +643,12 @@ impl EventContext<'_> {
} }
} }
pub struct App { pub struct SingleWindowShell {
inner: Rc<RefCell<WindowingSystemFacade>>, inner: Rc<RefCell<WindowingSystemFacade>>,
popup_command_sender: channel::Sender<PopupCommand>, popup_command_sender: channel::Sender<PopupCommand>,
} }
impl App { impl SingleWindowShell {
pub(crate) fn new( pub(crate) fn new(
component_definition: ComponentDefinition, component_definition: ComponentDefinition,
compilation_result: Option<Rc<CompilationResult>>, compilation_result: Option<Rc<CompilationResult>>,
@ -659,14 +665,14 @@ impl App {
let (sender, receiver) = channel::channel(); let (sender, receiver) = channel::channel();
let system = Self { let shell = Self {
inner: Rc::clone(&inner_rc), inner: Rc::clone(&inner_rc),
popup_command_sender: sender, 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<PopupCommand>) -> Result<()> { fn setup_popup_command_handler(&self, receiver: channel::Channel<PopupCommand>) -> Result<()> {

View file

@ -63,10 +63,10 @@
pub mod prelude; pub mod prelude;
pub use layer_shika_composition::{ 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, Layer, LayerShika, OutputGeometry, OutputHandle, OutputInfo, OutputPolicy, OutputRegistry,
PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest, PopupSize, PopupWindow, PopupHandle, PopupPlacement, PopupPositioningMode, PopupRequest, PopupSize, PopupWindow,
Result, ShellControl, Result, ShellControl, SingleWindowShell,
}; };
pub use layer_shika_composition::{ pub use layer_shika_composition::{

View file

@ -9,7 +9,8 @@
#![allow(clippy::pub_use)] #![allow(clippy::pub_use)]
pub use crate::{ pub use crate::{
App, Error, EventContext, EventLoopHandle, LayerShika, PopupWindow, Result, ShellControl, Error, EventContext, EventLoopHandle, LayerShika, PopupWindow, Result, ShellControl,
SingleWindowShell,
}; };
pub use crate::{ pub use crate::{