diff --git a/src/core/song_search.rs b/src/core/song_search.rs index a4c93db..06507dd 100644 --- a/src/core/song_search.rs +++ b/src/core/song_search.rs @@ -114,10 +114,10 @@ pub async fn get_genius_lyrics( root.inner_html() }) .collect::(); - let lyrics = lyrics.find("[").map_or_else( + let lyrics = lyrics.find('[').map_or_else( || { - lyrics.find("").map_or( - lyrics.clone(), + lyrics.find("").map_or_else( + || lyrics.clone(), |position| { lyrics.split_at(position + 18).1.to_string() }, diff --git a/src/main.rs b/src/main.rs index 62a2c7f..4044772 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,7 +10,7 @@ use cosmic::cosmic_config::{Config, CosmicConfigEntry}; use cosmic::dialog::file_chooser::{open, save}; use cosmic::iced::alignment::Vertical; use cosmic::iced::keyboard::{Key, Modifiers}; -use cosmic::iced::window::{Mode, Position}; +use cosmic::iced::window::Position; use cosmic::iced::{ self, Background as IcedBackground, Border, Color, Length, event, window, @@ -700,7 +700,7 @@ impl cosmic::Application for App { // debug!(?platform_specific); None } - iced::Event::InputMethod(event) => todo!(), + iced::Event::InputMethod(_event) => todo!(), } } event::Status::Captured => None, @@ -1858,6 +1858,7 @@ where }, ) }) + // if let Some(library) = self.library.clone() { // Task::perform( // async move { library.search_items(query).await }, diff --git a/src/ui/library.rs b/src/ui/library.rs index 7c496e7..10b2740 100644 --- a/src/ui/library.rs +++ b/src/ui/library.rs @@ -177,10 +177,19 @@ impl<'a> Library { }) .and_then(move |db| { Task::perform( - add_song_to_db(db), + self.song_library.new_song(db), move |res| { res.map(|song| { - Message::AddSong(song) + let index = (self + .song_library + .items + .len() + - 1) + as i32; + Message::OpenItem(Some(( + LibraryKind::Song, + index, + ))) }) }, ) @@ -214,7 +223,7 @@ impl<'a> Library { // Check if empty let mut tasks = Vec::new(); if let Some(videos) = videos { - let len = videos.len(); + // let len = videos.len(); for video in videos { if let Err(e) = self.video_library.add_item(video.clone()) @@ -290,7 +299,7 @@ impl<'a> Library { // Check if empty let mut tasks = Vec::new(); if let Some(presentations) = presentations { - let len = presentations.len(); + // let len = presentations.len(); for presentation in presentations { if let Err(e) = self .presentation_library @@ -331,7 +340,7 @@ impl<'a> Library { // Check if empty let mut tasks = Vec::new(); if let Some(images) = images { - let len = images.len(); + // let len = images.len(); for image in images { if let Err(e) = self.image_library.add_item(image.clone()) @@ -692,7 +701,7 @@ impl<'a> Library { add_song_to_db(db), { move |res| { - res.map(|song| { + res.map(|_song| { Message::None }) } diff --git a/src/ui/slide_editor.rs b/src/ui/slide_editor.rs index 450721c..8024484 100644 --- a/src/ui/slide_editor.rs +++ b/src/ui/slide_editor.rs @@ -157,11 +157,11 @@ impl<'a> Program }, canvas::Event::Touch(_event) => debug!("test"), canvas::Event::Keyboard(_event) => debug!("test"), - canvas::Event::Window(event) => todo!(), - canvas::Event::InputMethod(event) => todo!(), - canvas::Event::A11y(id, action_request) => todo!(), - canvas::Event::Dnd(dnd_event) => todo!(), - canvas::Event::PlatformSpecific(platform_specific) => { + canvas::Event::Window(_event) => todo!(), + canvas::Event::InputMethod(_event) => todo!(), + canvas::Event::A11y(_id, _action_request) => todo!(), + canvas::Event::Dnd(_dnd_event) => todo!(), + canvas::Event::PlatformSpecific(_platform_specific) => { todo!() } } diff --git a/src/ui/widgets/draggable/column.rs b/src/ui/widgets/draggable/column.rs index 563d5b4..36bfbed 100644 --- a/src/ui/widgets/draggable/column.rs +++ b/src/ui/widgets/draggable/column.rs @@ -27,7 +27,7 @@ use cosmic::iced::advanced::layout::{self, Layout}; use cosmic::iced::advanced::widget::{Operation, Tree, Widget, tree}; use cosmic::iced::advanced::{Clipboard, Shell, overlay, renderer}; use cosmic::iced::alignment::{self, Alignment}; -use cosmic::iced::event::{self, Event}; +use cosmic::iced::event::Event; use cosmic::iced::{self, Transformation, mouse}; use cosmic::iced::{ Background, Border, Color, Element, Length, Padding, Pixels, diff --git a/src/ui/widgets/draggable/row.rs b/src/ui/widgets/draggable/row.rs index 959f069..2f9f3d0 100644 --- a/src/ui/widgets/draggable/row.rs +++ b/src/ui/widgets/draggable/row.rs @@ -27,7 +27,7 @@ use cosmic::iced::advanced::layout::{self, Layout}; use cosmic::iced::advanced::widget::{Operation, Tree, Widget, tree}; use cosmic::iced::advanced::{Clipboard, Shell, overlay, renderer}; use cosmic::iced::alignment::{self, Alignment}; -use cosmic::iced::event::{self, Event}; +use cosmic::iced::event::Event; use cosmic::iced::{self, Transformation, mouse}; use cosmic::iced::{ Background, Border, Color, Element, Length, Padding, Pixels, @@ -535,8 +535,7 @@ where _ => {} } - let child_status = self - .children + self.children .iter_mut() .zip(&mut tree.children) .zip(layout.children()) diff --git a/src/ui/widgets/verse_editor.rs b/src/ui/widgets/verse_editor.rs index d2b39c7..a71adbf 100644 --- a/src/ui/widgets/verse_editor.rs +++ b/src/ui/widgets/verse_editor.rs @@ -5,9 +5,7 @@ use cosmic::{ iced_widget::{column, row}, theme, widget::{ - button, combo_box, container, icon, - space::{self, horizontal}, - text_editor, + button, combo_box, container, icon, space, text_editor, }, };