now it builds with the song_editor loaded just not visible

This commit is contained in:
Chris Cochrun 2025-02-20 07:18:48 -06:00
parent 09b62afc91
commit b01f29f5b8
2 changed files with 24 additions and 7 deletions

View file

@ -1,5 +1,6 @@
use clap::{command, Parser}; use clap::{command, Parser};
use core::service_items::{ServiceItem, ServiceItemModel}; use core::service_items::{ServiceItem, ServiceItemModel};
use core::slide::*;
use cosmic::app::context_drawer::ContextDrawer; use cosmic::app::context_drawer::ContextDrawer;
use cosmic::app::{Core, Settings, Task}; use cosmic::app::{Core, Settings, Task};
use cosmic::iced::clipboard::dnd::DndAction; use cosmic::iced::clipboard::dnd::DndAction;
@ -29,14 +30,13 @@ use std::path::PathBuf;
use tracing::{debug, level_filters::LevelFilter}; use tracing::{debug, level_filters::LevelFilter};
use tracing::{error, warn}; use tracing::{error, warn};
use tracing_subscriber::EnvFilter; use tracing_subscriber::EnvFilter;
use ui::editor::SongEditor;
use ui::library::{self, Library}; use ui::library::{self, Library};
use ui::presenter::{self, Presenter};
use ui::song_editor::{self, SongEditor};
pub mod core; pub mod core;
pub mod lisp; pub mod lisp;
pub mod ui; pub mod ui;
use core::slide::*;
use ui::presenter::{self, Presenter};
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[command(name = "lumina", version, about)] #[command(name = "lumina", version, about)]
@ -105,7 +105,7 @@ struct App {
enum Message { enum Message {
Present(presenter::Message), Present(presenter::Message),
Library(library::Message), Library(library::Message),
SongEditor(editor::Message), SongEditor(song_editor::Message),
File(PathBuf), File(PathBuf),
DndEnter(Entity, Vec<String>), DndEnter(Entity, Vec<String>),
DndDrop(Entity, Option<ServiceItem>, DndAction), DndDrop(Entity, Option<ServiceItem>, DndAction),

View file

@ -1,30 +1,47 @@
use cosmic::{Element, Task}; use cosmic::{
iced::Font,
iced_widget::row,
widget::{dropdown, Container},
Element, Task,
};
use crate::core::songs::Song; use crate::core::songs::Song;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct SongEditor { pub struct SongEditor {
song: Option<Song>, song: Option<Song>,
fonts: Vec<Font>,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum Message { pub enum Message {
ChangeSong(Song), ChangeSong(Song),
UpdateSong(Song), UpdateSong(Song),
ChangeFont(usize),
} }
impl SongEditor { impl SongEditor {
pub fn new() -> Self { pub fn new() -> Self {
Self { song: None } let fonts = vec![
Font::with_name("Quicksand"),
Font::with_name("Noto Sans"),
];
Self { song: None, fonts }
} }
pub fn update(&self, message: Message) -> Task<Message> { pub fn update(&self, message: Message) -> Task<Message> {
match message { match message {
Message::ChangeSong(song) => todo!(), Message::ChangeSong(song) => todo!(),
Message::UpdateSong(song) => todo!(), Message::UpdateSong(song) => todo!(),
Message::ChangeFont(font) => todo!(),
} }
} }
pub fn view(&self) -> Element<Message> { pub fn view(&self) -> Element<Message> {
todo!() let font_selector =
dropdown(&["Quicksand", "Noto Sans"], None, |font| {
Message::ChangeFont(font)
});
let toolbar = row![font_selector];
toolbar.into()
} }
} }