diff --git a/src/main.rs b/src/main.rs index f800e2e..fbbeb84 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ use clap::{command, Parser}; use core::service_items::{ServiceItem, ServiceItemModel}; +use core::slide::*; use cosmic::app::context_drawer::ContextDrawer; use cosmic::app::{Core, Settings, Task}; use cosmic::iced::clipboard::dnd::DndAction; @@ -29,14 +30,13 @@ use std::path::PathBuf; use tracing::{debug, level_filters::LevelFilter}; use tracing::{error, warn}; use tracing_subscriber::EnvFilter; -use ui::editor::SongEditor; use ui::library::{self, Library}; +use ui::presenter::{self, Presenter}; +use ui::song_editor::{self, SongEditor}; pub mod core; pub mod lisp; pub mod ui; -use core::slide::*; -use ui::presenter::{self, Presenter}; #[derive(Debug, Parser)] #[command(name = "lumina", version, about)] @@ -105,7 +105,7 @@ struct App { enum Message { Present(presenter::Message), Library(library::Message), - SongEditor(editor::Message), + SongEditor(song_editor::Message), File(PathBuf), DndEnter(Entity, Vec), DndDrop(Entity, Option, DndAction), diff --git a/src/ui/song_editor.rs b/src/ui/song_editor.rs index 797e3d8..d7f39b1 100644 --- a/src/ui/song_editor.rs +++ b/src/ui/song_editor.rs @@ -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; #[derive(Debug, Clone)] pub struct SongEditor { song: Option, + fonts: Vec, } #[derive(Debug, Clone)] pub enum Message { ChangeSong(Song), UpdateSong(Song), + ChangeFont(usize), } impl SongEditor { 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 { match message { Message::ChangeSong(song) => todo!(), Message::UpdateSong(song) => todo!(), + Message::ChangeFont(font) => todo!(), } } pub fn view(&self) -> Element { - todo!() + let font_selector = + dropdown(&["Quicksand", "Noto Sans"], None, |font| { + Message::ChangeFont(font) + }); + let toolbar = row![font_selector]; + toolbar.into() } }