Introduce daemon API and unify shell runtimes
This commit is contained in:
parent
368b15f708
commit
341c9a3c12
54 changed files with 1352 additions and 2677 deletions
|
|
@ -1,30 +1,17 @@
|
|||
//! Configure your application.
|
||||
use crate::window;
|
||||
use crate::{Font, Pixels};
|
||||
|
||||
use std::borrow::Cow;
|
||||
|
||||
/// The settings of an iced [`Program`].
|
||||
///
|
||||
/// [`Program`]: crate::Program
|
||||
/// The settings of an iced program.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Settings<Flags = ()> {
|
||||
pub struct Settings {
|
||||
/// The identifier of the application.
|
||||
///
|
||||
/// If provided, this identifier may be used to identify the application or
|
||||
/// communicate with it through the windowing system.
|
||||
pub id: Option<String>,
|
||||
|
||||
/// The window settings.
|
||||
///
|
||||
/// They will be ignored on the Web.
|
||||
pub window: window::Settings,
|
||||
|
||||
/// The data needed to initialize the [`Program`].
|
||||
///
|
||||
/// [`Program`]: crate::Program
|
||||
pub flags: Flags,
|
||||
|
||||
/// The fonts to load on boot.
|
||||
pub fonts: Vec<Cow<'static, [u8]>>,
|
||||
|
||||
|
|
@ -50,34 +37,10 @@ pub struct Settings<Flags = ()> {
|
|||
pub antialiasing: bool,
|
||||
}
|
||||
|
||||
impl<Flags> Settings<Flags> {
|
||||
/// Initialize [`Program`] settings using the given data.
|
||||
///
|
||||
/// [`Program`]: crate::Program
|
||||
pub fn with_flags(flags: Flags) -> Self {
|
||||
let default_settings = Settings::<()>::default();
|
||||
|
||||
Self {
|
||||
flags,
|
||||
id: default_settings.id,
|
||||
window: default_settings.window,
|
||||
fonts: default_settings.fonts,
|
||||
default_font: default_settings.default_font,
|
||||
default_text_size: default_settings.default_text_size,
|
||||
antialiasing: default_settings.antialiasing,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<Flags> Default for Settings<Flags>
|
||||
where
|
||||
Flags: Default,
|
||||
{
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
id: None,
|
||||
window: window::Settings::default(),
|
||||
flags: Default::default(),
|
||||
fonts: Vec::new(),
|
||||
default_font: Font::default(),
|
||||
default_text_size: Pixels(16.0),
|
||||
|
|
@ -86,12 +49,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<Flags> From<Settings<Flags>> for iced_winit::Settings<Flags> {
|
||||
fn from(settings: Settings<Flags>) -> iced_winit::Settings<Flags> {
|
||||
impl From<Settings> for iced_winit::Settings {
|
||||
fn from(settings: Settings) -> iced_winit::Settings {
|
||||
iced_winit::Settings {
|
||||
id: settings.id,
|
||||
window: settings.window,
|
||||
flags: settings.flags,
|
||||
fonts: settings.fonts,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue