diff --git a/src/core/thumbnail.rs b/src/core/thumbnail.rs index 2ff2f70..108ed52 100644 --- a/src/core/thumbnail.rs +++ b/src/core/thumbnail.rs @@ -95,7 +95,10 @@ mod test { let screenshot = bg_path_from_video(video); let screenshot_string = screenshot.to_str().expect("Should be thing"); - assert_eq!(screenshot_string, "/home/chris/.local/share/lumina/thumbnails/moms-funeral.png"); + assert_eq!( + screenshot_string, + "/home/chris/.local/share/lumina/thumbnails/moms-funeral.png" + ); // let runtime = tokio::runtime::Runtime::new().unwrap(); let result = bg_from_video(video, &screenshot); @@ -118,6 +121,9 @@ mod test { let screenshot = bg_path_from_video(video); let screenshot_string = screenshot.to_str().expect("Should be thing"); - assert_ne!(screenshot_string, "/home/chris/.local/share/lumina/thumbnails/All WebDev Sucks and you know it.webm"); + assert_ne!( + screenshot_string, + "/home/chris/.local/share/lumina/thumbnails/All WebDev Sucks and you know it.webm" + ); } } diff --git a/src/main.rs b/src/main.rs index 323ff31..3ea3e38 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1290,8 +1290,7 @@ impl cosmic::Application for App { let song_editor = self.song_editor.view().map(Message::SongEditor); - let row = row![ - library, + let service_row = row![ service_list, Container::new( button::icon(icon_left) @@ -1325,23 +1324,33 @@ impl cosmic::Application for App { .height(Length::Fill) .spacing(20); - let column = column![ - Container::new(row).center_y(Length::Fill), + let preview_bar = if self.editor_mode.is_none() { Container::new( - self.presenter.preview_bar().map(Message::Present) + self.presenter.preview_bar().map(Message::Present), ) .clip(true) .width(Length::Fill) .center_y(180) - ]; + } else { + Container::new(horizontal_space()) + }; - if let Some(_editor) = &self.editor_mode { + let main_area = if let Some(editor) = &self.editor_mode { container(song_editor) .padding(cosmic::theme::spacing().space_xxl) - .into() } else { - Element::from(column) - } + Container::new(service_row).center_y(Length::Fill) + }; + + let column = column![ + row![ + library.width(Length::FillPortion(1)), + main_area.width(Length::FillPortion(4)) + ], + preview_bar + ]; + + column.into() } // View for presentation diff --git a/src/ui/library.rs b/src/ui/library.rs index 947ad42..641bb07 100644 --- a/src/ui/library.rs +++ b/src/ui/library.rs @@ -488,40 +488,43 @@ impl<'a> Library { column({ model.items.iter().enumerate().map( |(index, item)| { + let service_item = item.to_service_item(); let visual_item = self .single_item(index, item, model) .map(|()| Message::None); + DndSource::::new({ - let mouse_area = Element::from(mouse_area(visual_item) - .on_drag(Message::DragItem(service_item.clone())) - .on_enter(Message::HoverItem( - Some(( - model.kind, - index as i32, - )), - )) - .on_double_click( - Message::OpenItem(Some(( - model.kind, - index as i32, - ))), - ) - .on_right_press(Message::OpenContext(index as i32)) - .on_exit(Message::HoverItem(None)) - .on_press(Message::SelectItem( - Some(( - model.kind, - index as i32, - )), - ))); + let mouse_area = mouse_area(visual_item); + let mouse_area = mouse_area.on_enter(Message::HoverItem( + Some(( + model.kind, + index as i32, + )), + )) + .on_double_click( + Message::OpenItem(Some(( + model.kind, + index as i32, + ))), + ) + .on_right_press(Message::OpenContext(index as i32)) + .on_exit(Message::HoverItem(None)) + .on_press(Message::SelectItem( + Some(( + model.kind, + index as i32, + )), + )); + if let Some(context_id) = self.context_menu { if index == context_id as usize { + let menu_items = vec![menu::Item::Button("Delete", None, MenuMessage::Delete((model.kind, index as i32)))]; let context_menu = context_menu( mouse_area, self.context_menu.map_or_else(|| None, |_| { Some(menu::items(&self.menu_keys, - vec![menu::Item::Button("Delete", None, MenuMessage::Delete((model.kind, index as i32)))])) + menu_items)) }) ); Element::from(context_menu) diff --git a/src/ui/text_svg.rs b/src/ui/text_svg.rs index 7b01846..58c574a 100644 --- a/src/ui/text_svg.rs +++ b/src/ui/text_svg.rs @@ -256,11 +256,13 @@ impl TextSvg { path.push(PathBuf::from("temp")); let shadow = if let Some(shadow) = &self.shadow { - format!("", + format!( + "", shadow.offset_x, shadow.offset_y, shadow.spread, - shadow.color) + shadow.color + ) } else { String::new() }; @@ -299,13 +301,17 @@ impl TextSvg { .collect(); let text: String = text_pieces.join("\n"); - let final_svg = format!("{}{}", - size.width, - size.height, - shadow, - self.font.name, - font_size, - self.fill, stroke, text); + let final_svg = format!( + "{}{}", + size.width, + size.height, + shadow, + self.font.name, + font_size, + self.fill, + stroke, + text + ); let hashed_title = rapidhash_v3(final_svg.as_bytes()); path.push(PathBuf::from(hashed_title.to_string())); diff --git a/todo.org b/todo.org index 29b539e..e8c4616 100644 --- a/todo.org +++ b/todo.org @@ -1,7 +1,7 @@ #+TITLE: The Task list for Lumina -* TODO [#A] Add removal and reordering of service_items +* DONE [#A] Add removal and reordering of service_items Reordering is finished * TODO Add OBS integration This will be based on each slide having the ability to activate an OBS scene when it is active.