This commit is contained in:
parent
29c4f9de92
commit
32c49a59a9
14 changed files with 78 additions and 87 deletions
|
|
@ -38,7 +38,7 @@ pub enum Message {
|
|||
}
|
||||
|
||||
impl ImageEditor {
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
image: None,
|
||||
|
|
@ -93,7 +93,7 @@ impl ImageEditor {
|
|||
Action::None
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn view(&self) -> Element<Message> {
|
||||
let container = if let Some(pic) = &self.image {
|
||||
let image = widget::image(pic.path.clone());
|
||||
|
|
@ -132,7 +132,7 @@ impl ImageEditor {
|
|||
.into()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub const fn editing(&self) -> bool {
|
||||
self.editing
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ impl<'a> Library {
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn get_song(&self, index: i32) -> Option<&Song> {
|
||||
self.song_library.get_item(index)
|
||||
}
|
||||
|
|
@ -813,7 +813,7 @@ impl<'a> Library {
|
|||
Action::None
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn view(&self) -> Element<Message> {
|
||||
let cosmic::cosmic_theme::Spacing { space_s, .. } =
|
||||
cosmic::theme::spacing();
|
||||
|
|
@ -1263,17 +1263,17 @@ impl<'a> Library {
|
|||
items.into_iter().map(|item| item.1).collect()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn get_video(&self, index: i32) -> Option<&Video> {
|
||||
self.video_library.get_item(index)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn get_image(&self, index: i32) -> Option<&Image> {
|
||||
self.image_library.get_item(index)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn get_presentation(
|
||||
&self,
|
||||
index: i32,
|
||||
|
|
@ -1281,7 +1281,10 @@ impl<'a> Library {
|
|||
self.presentation_library.get_item(index)
|
||||
}
|
||||
|
||||
pub const fn set_modifiers(&mut self, modifiers: Option<Modifiers>) {
|
||||
pub const fn set_modifiers(
|
||||
&mut self,
|
||||
modifiers: Option<Modifiers>,
|
||||
) {
|
||||
self.modifiers_pressed = modifiers;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ impl menu::Action for MenuAction {
|
|||
}
|
||||
|
||||
impl PresentationEditor {
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub const fn new() -> Self {
|
||||
Self {
|
||||
presentation: None,
|
||||
|
|
@ -205,9 +205,9 @@ impl PresentationEditor {
|
|||
if let Some(presentation) = self.presentation.as_ref()
|
||||
&& let PresKind::Pdf { ending_index, .. } =
|
||||
presentation.kind
|
||||
{
|
||||
last_index = ending_index;
|
||||
}
|
||||
{
|
||||
last_index = ending_index;
|
||||
}
|
||||
|
||||
if next_index > last_index {
|
||||
return Action::None;
|
||||
|
|
@ -248,9 +248,9 @@ impl PresentationEditor {
|
|||
if let Some(presentation) = self.presentation.as_ref()
|
||||
&& let PresKind::Pdf { starting_index, .. } =
|
||||
presentation.kind
|
||||
{
|
||||
first_index = starting_index;
|
||||
}
|
||||
{
|
||||
first_index = starting_index;
|
||||
}
|
||||
|
||||
if previous_index < first_index {
|
||||
return Action::None;
|
||||
|
|
|
|||
|
|
@ -271,7 +271,9 @@ impl Presenter {
|
|||
let audio = items
|
||||
.first()
|
||||
.and_then(|item| {
|
||||
item.slides.first().map(super::super::core::slide::Slide::audio)
|
||||
item.slides
|
||||
.first()
|
||||
.map(super::super::core::slide::Slide::audio)
|
||||
})
|
||||
.flatten();
|
||||
|
||||
|
|
@ -984,28 +986,28 @@ impl Presenter {
|
|||
|
||||
if let Some(map) = &self.slide_action_map
|
||||
&& let Some(actions) = map.get(&(item_index, slide_index))
|
||||
{
|
||||
for action in actions {
|
||||
match action {
|
||||
slide_actions::Action::Obs { action } => {
|
||||
debug!("found obs slide actions");
|
||||
if let Some(obs) = &self.obs_client {
|
||||
let obs = Arc::clone(obs);
|
||||
let action = action.to_owned();
|
||||
let task = Task::perform(
|
||||
async move { action.run(obs).await },
|
||||
|res| {
|
||||
debug!(?res);
|
||||
Message::None
|
||||
},
|
||||
);
|
||||
tasks.push(task);
|
||||
}
|
||||
{
|
||||
for action in actions {
|
||||
match action {
|
||||
slide_actions::Action::Obs { action } => {
|
||||
debug!("found obs slide actions");
|
||||
if let Some(obs) = &self.obs_client {
|
||||
let obs = Arc::clone(obs);
|
||||
let action = action.to_owned();
|
||||
let task = Task::perform(
|
||||
async move { action.run(obs).await },
|
||||
|res| {
|
||||
debug!(?res);
|
||||
Message::None
|
||||
},
|
||||
);
|
||||
tasks.push(task);
|
||||
}
|
||||
slide_actions::Action::Other => todo!(),
|
||||
}
|
||||
slide_actions::Action::Other => todo!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Task::batch(tasks)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use tracing::debug;
|
|||
|
||||
use crate::core::service_items::ServiceItem;
|
||||
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub const fn service<Message: Clone + 'static>(
|
||||
service: &Vec<ServiceItem>,
|
||||
) -> Service<'_, Message> {
|
||||
|
|
@ -35,7 +35,7 @@ pub struct Service<'a, Message> {
|
|||
}
|
||||
|
||||
impl<'a, Message: Clone + 'static> Service<'a, Message> {
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub const fn new(service: &'a Vec<ServiceItem>) -> Self {
|
||||
Self {
|
||||
service,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ pub enum Message {
|
|||
}
|
||||
|
||||
impl VideoEditor {
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
video: None,
|
||||
|
|
|
|||
|
|
@ -101,13 +101,13 @@ where
|
|||
Theme: Catalog,
|
||||
{
|
||||
/// Creates an empty [`Column`].
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn new() -> Self {
|
||||
Self::from_vec(Vec::new())
|
||||
}
|
||||
|
||||
/// Creates a [`Column`] with the given capacity.
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn with_capacity(capacity: usize) -> Self {
|
||||
Self::from_vec(Vec::with_capacity(capacity))
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ where
|
|||
///
|
||||
/// If any of the children have a [`Length::Fill`] strategy, you will need to
|
||||
/// call [`Column::width`] or [`Column::height`] accordingly.
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn from_vec(
|
||||
children: Vec<Element<'a, Message, Theme, Renderer>>,
|
||||
) -> Self {
|
||||
|
|
@ -896,7 +896,7 @@ impl Catalog for cosmic::Theme {
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn default(theme: &Theme) -> Style {
|
||||
Style {
|
||||
scale: 1.05,
|
||||
|
|
|
|||
|
|
@ -95,13 +95,13 @@ where
|
|||
Theme: Catalog,
|
||||
{
|
||||
/// Creates an empty [`Row`].
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn new() -> Self {
|
||||
Self::from_vec(Vec::new())
|
||||
}
|
||||
|
||||
/// Creates a [`Row`] with the given capacity.
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn with_capacity(capacity: usize) -> Self {
|
||||
Self::from_vec(Vec::with_capacity(capacity))
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ where
|
|||
///
|
||||
/// If any of the children have a [`Length::Fill`] strategy, you will need to
|
||||
/// call [`Row::width`] or [`Row::height`] accordingly.
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn from_vec(
|
||||
children: Vec<Element<'a, Message, Theme, Renderer>>,
|
||||
) -> Self {
|
||||
|
|
@ -257,7 +257,9 @@ where
|
|||
/// Turns the [`Row`] into a [`Wrapping`] row.
|
||||
///
|
||||
/// The original alignment of the [`Row`] is preserved per row wrapped.
|
||||
pub const fn wrap(self) -> Wrapping<'a, Message, Theme, Renderer> {
|
||||
pub const fn wrap(
|
||||
self,
|
||||
) -> Wrapping<'a, Message, Theme, Renderer> {
|
||||
Wrapping { row: self }
|
||||
}
|
||||
|
||||
|
|
@ -314,8 +316,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<Message, Renderer> Default
|
||||
for Row<'_, Message, Theme, Renderer>
|
||||
impl<Message, Renderer> Default for Row<'_, Message, Theme, Renderer>
|
||||
where
|
||||
Renderer: renderer::Renderer,
|
||||
Theme: Catalog,
|
||||
|
|
@ -1044,7 +1045,7 @@ impl Catalog for cosmic::Theme {
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn default(theme: &cosmic::Theme) -> Style {
|
||||
Style {
|
||||
scale: 1.05,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ pub enum Action {
|
|||
}
|
||||
|
||||
impl VerseEditor {
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn new(verse: VerseName, lyric: String) -> Self {
|
||||
Self {
|
||||
verse_name: verse,
|
||||
|
|
@ -50,16 +50,7 @@ impl VerseEditor {
|
|||
|
||||
pub fn view(&self) -> Element<Message> {
|
||||
let cosmic::cosmic_theme::Spacing {
|
||||
space_none,
|
||||
space_xxxs,
|
||||
space_xxs,
|
||||
space_xs,
|
||||
space_s,
|
||||
space_m,
|
||||
space_l,
|
||||
space_xl,
|
||||
space_xxl,
|
||||
space_xxxl,
|
||||
space_s, space_m, ..
|
||||
} = theme::spacing();
|
||||
|
||||
let verse_title =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue