parent
de0722b430
commit
b03382f687
6 changed files with 33 additions and 32 deletions
|
@ -1,6 +1,6 @@
|
|||
use std::mem::replace;
|
||||
|
||||
use miette::{Result, miette};
|
||||
use miette::{miette, Result};
|
||||
use sqlx::{Connection, SqliteConnection};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
@ -181,7 +181,7 @@ impl TryFrom<PathBuf> for Background {
|
|||
}
|
||||
}
|
||||
Err(e) => {
|
||||
error!("Couldn't canonicalize: {e} {:?}", path);
|
||||
// error!("Couldn't canonicalize: {e} {:?}", path);
|
||||
Err(ParseError::CannotCanonicalize)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ use crisp::types::{Keyword, Symbol, Value};
|
|||
use miette::{IntoDiagnostic, Result};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{
|
||||
Sqlite, SqliteConnection, SqlitePool, pool::PoolConnection,
|
||||
query, query_as,
|
||||
pool::PoolConnection, query, query_as, Sqlite, SqliteConnection,
|
||||
SqlitePool,
|
||||
};
|
||||
use std::path::PathBuf;
|
||||
use tracing::error;
|
||||
|
|
16
src/main.rs
16
src/main.rs
|
@ -1,4 +1,4 @@
|
|||
use clap::{Parser, command};
|
||||
use clap::{command, Parser};
|
||||
use core::service_items::ServiceItem;
|
||||
use core::slide::{
|
||||
Background, BackgroundKind, Slide, SlideBuilder, TextAlignment,
|
||||
|
@ -9,24 +9,24 @@ use cosmic::app::{Core, Settings, Task};
|
|||
use cosmic::iced::alignment::Vertical;
|
||||
use cosmic::iced::keyboard::{Key, Modifiers};
|
||||
use cosmic::iced::window::{Mode, Position};
|
||||
use cosmic::iced::{self, Length, Point, event, window};
|
||||
use cosmic::iced::{self, event, window, Length, Point};
|
||||
use cosmic::iced_futures::Subscription;
|
||||
use cosmic::iced_widget::{column, row, stack};
|
||||
use cosmic::theme;
|
||||
use cosmic::widget::Container;
|
||||
use cosmic::widget::dnd_destination::dnd_destination;
|
||||
use cosmic::widget::nav_bar::nav_bar_style;
|
||||
use cosmic::widget::text;
|
||||
use cosmic::widget::tooltip::Position as TPosition;
|
||||
use cosmic::widget::Container;
|
||||
use cosmic::widget::{
|
||||
Space, button, horizontal_space, mouse_area, nav_bar,
|
||||
search_input, tooltip, vertical_space,
|
||||
button, horizontal_space, mouse_area, nav_bar, search_input,
|
||||
tooltip, vertical_space, Space,
|
||||
};
|
||||
use cosmic::widget::{icon, slider};
|
||||
use cosmic::{Application, ApplicationExt, Element, executor};
|
||||
use cosmic::{executor, Application, ApplicationExt, Element};
|
||||
use crisp::types::Value;
|
||||
use lisp::parse_lisp;
|
||||
use miette::{Result, miette};
|
||||
use miette::{miette, Result};
|
||||
use rayon::prelude::*;
|
||||
use resvg::usvg::fontdb;
|
||||
use std::fs::read_to_string;
|
||||
|
@ -35,10 +35,10 @@ use std::sync::Arc;
|
|||
use tracing::{debug, level_filters::LevelFilter};
|
||||
use tracing::{error, warn};
|
||||
use tracing_subscriber::EnvFilter;
|
||||
use ui::EditorMode;
|
||||
use ui::library::{self, Library};
|
||||
use ui::presenter::{self, Presenter};
|
||||
use ui::song_editor::{self, SongEditor};
|
||||
use ui::EditorMode;
|
||||
|
||||
use crate::core::kinds::ServiceItemKind;
|
||||
use crate::ui::text_svg::{self};
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use cosmic::{
|
||||
Element, Task,
|
||||
iced::{
|
||||
Background, Border, Color, Length, alignment::Vertical,
|
||||
clipboard::dnd::DndAction, futures::FutureExt,
|
||||
alignment::Vertical, clipboard::dnd::DndAction,
|
||||
futures::FutureExt, Background, Border, Color, Length,
|
||||
},
|
||||
iced_core::widget::tree::State,
|
||||
iced_widget::{column, row as rowm, text as textm},
|
||||
theme,
|
||||
widget::{
|
||||
Container, DndSource, Space, button, container, context_menu,
|
||||
horizontal_space, icon,
|
||||
button, container, context_menu, horizontal_space, icon,
|
||||
menu::{self, Action as MenuAction},
|
||||
mouse_area, responsive, row, scrollable, text, text_input,
|
||||
Container, DndSource, Space,
|
||||
},
|
||||
Element, Task,
|
||||
};
|
||||
use miette::{IntoDiagnostic, Result};
|
||||
use rapidfuzz::distance::levenshtein;
|
||||
use sqlx::{Sqlite, SqlitePool, pool::PoolConnection};
|
||||
use sqlx::{migrate, pool::PoolConnection, Sqlite, SqlitePool};
|
||||
use tracing::{debug, error, warn};
|
||||
|
||||
use crate::core::{
|
||||
content::Content,
|
||||
images::{Image, update_image_in_db},
|
||||
images::{update_image_in_db, Image},
|
||||
model::{LibraryKind, Model},
|
||||
presentations::{Presentation, update_presentation_in_db},
|
||||
presentations::{update_presentation_in_db, Presentation},
|
||||
service_items::ServiceItem,
|
||||
songs::{Song, update_song_in_db},
|
||||
videos::{Video, update_video_in_db},
|
||||
songs::{update_song_in_db, Song},
|
||||
videos::{update_video_in_db, Video},
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct Library {
|
||||
pub struct Library {
|
||||
song_library: Model<Song>,
|
||||
image_library: Model<Image>,
|
||||
video_library: Model<Video>,
|
||||
|
@ -41,7 +41,6 @@ pub(crate) struct Library {
|
|||
library_hovered: Option<LibraryKind>,
|
||||
selected_item: Option<(LibraryKind, i32)>,
|
||||
hovered_item: Option<(LibraryKind, i32)>,
|
||||
pub dragged_item: Option<(LibraryKind, i32)>,
|
||||
editing_item: Option<(LibraryKind, i32)>,
|
||||
db: SqlitePool,
|
||||
menu_keys: std::collections::HashMap<menu::KeyBind, MenuMessage>,
|
||||
|
@ -69,7 +68,7 @@ impl MenuAction for MenuMessage {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) enum Action {
|
||||
pub enum Action {
|
||||
OpenItem(Option<(LibraryKind, i32)>),
|
||||
DraggedItem(ServiceItem),
|
||||
Task(Task<Message>),
|
||||
|
@ -77,7 +76,7 @@ pub(crate) enum Action {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) enum Message {
|
||||
pub enum Message {
|
||||
AddItem,
|
||||
DeleteItem((LibraryKind, i32)),
|
||||
OpenItem(Option<(LibraryKind, i32)>),
|
||||
|
@ -102,6 +101,9 @@ pub(crate) enum Message {
|
|||
impl<'a> Library {
|
||||
pub async fn new() -> Self {
|
||||
let mut db = add_db().await.expect("probs");
|
||||
if let Err(e) = migrate!("./migrations").run(&db).await {
|
||||
error!(?e)
|
||||
}
|
||||
Self {
|
||||
song_library: Model::new_song_model(&mut db).await,
|
||||
image_library: Model::new_image_model(&mut db).await,
|
||||
|
@ -114,7 +116,6 @@ impl<'a> Library {
|
|||
library_hovered: None,
|
||||
selected_item: None,
|
||||
hovered_item: None,
|
||||
dragged_item: None,
|
||||
editing_item: None,
|
||||
db,
|
||||
menu_keys: HashMap::new(),
|
||||
|
@ -465,7 +466,7 @@ impl<'a> Library {
|
|||
if index == context_id as usize {
|
||||
let context_menu = context_menu(
|
||||
mouse_area,
|
||||
self.context_menu.map_or_else(|| None, |id| {
|
||||
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)))]))
|
||||
})
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
use std::{io, path::PathBuf, sync::Arc};
|
||||
|
||||
use cosmic::{
|
||||
Element, Task,
|
||||
dialog::file_chooser::open::Dialog,
|
||||
iced::{
|
||||
Font, Length,
|
||||
font::{Family, Stretch, Style, Weight},
|
||||
Font, Length,
|
||||
},
|
||||
iced_wgpu::graphics::text::cosmic_text::fontdb,
|
||||
iced_widget::row,
|
||||
|
@ -14,14 +13,15 @@ use cosmic::{
|
|||
button, column, combo_box, container, horizontal_space, icon,
|
||||
text, text_editor, text_input,
|
||||
},
|
||||
Element, Task,
|
||||
};
|
||||
use dirs::font_dir;
|
||||
use iced_video_player::Video;
|
||||
use tracing::{debug, error};
|
||||
|
||||
use crate::{
|
||||
Background, BackgroundKind, core::songs::Song,
|
||||
ui::slide_editor::SlideEditor,
|
||||
core::songs::Song, ui::slide_editor::SlideEditor, Background,
|
||||
BackgroundKind,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue