From be3d84be33fef076d82191bf054fe289b9b2c85c Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 24 Feb 2025 10:00:28 -0600 Subject: [PATCH] preparing more ui pieces --- src/ui/song_editor.rs | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/ui/song_editor.rs b/src/ui/song_editor.rs index 6d90966..7e30dcc 100644 --- a/src/ui/song_editor.rs +++ b/src/ui/song_editor.rs @@ -1,3 +1,5 @@ +use std::path::PathBuf; + use cosmic::{ iced::Length, iced_widget::row, @@ -19,6 +21,8 @@ pub struct SongEditor { fonts: combo_box::State, font_sizes: Vec, font: String, + author: String, + audio: PathBuf, font_size: usize, verse_order: String, lyrics: text_editor::Content, @@ -36,6 +40,7 @@ pub enum Message { ChangeLyrics(text_editor::Action), Edit(bool), None, + ChangeAuthor(String), } impl SongEditor { @@ -54,13 +59,15 @@ impl SongEditor { Self { song: None, fonts: combo_box::State::new(fonts), - title: String::from("Death was Arrested"), - font: String::from("Quicksand"), + title: "Death was Arrested".to_owned(), + font: "Quicksand".to_owned(), font_size: 16, font_sizes, - verse_order: String::from("Death was Arrested"), + verse_order: "Death was Arrested".to_owned(), lyrics: text_editor::Content::new(), editing: false, + author: "North Point Worship".into(), + audio: PathBuf::new(), } } pub fn update(&mut self, message: Message) -> Task { @@ -105,6 +112,11 @@ impl SongEditor { Task::none() } Message::None => Task::none(), + Message::ChangeAuthor(author) => { + debug!(author); + self.author = author; + Task::none() + } } } @@ -124,6 +136,10 @@ impl SongEditor { .on_input(Message::ChangeTitle) .label("Song Title"); + let author_input = text_input("author", &self.author) + .on_input(Message::ChangeAuthor) + .label("Song Author"); + let verse_input = text_input( "Verse order", @@ -144,6 +160,7 @@ order", column::with_children(vec![ title_input.into(), + author_input.into(), verse_input.into(), lyric_input.into(), ]) @@ -192,3 +209,9 @@ order", self.editing } } + +impl Default for SongEditor { + fn default() -> Self { + Self::new() + } +}