trying to tweak song editor to work
This commit is contained in:
parent
2fcfadb7f4
commit
3f9a1714c4
2 changed files with 66 additions and 76 deletions
|
@ -475,48 +475,16 @@ Item {
|
||||||
repeat: true
|
repeat: true
|
||||||
running: false
|
running: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (lyricsEditor.text === song.lyrics)
|
if (lyricsEditor.text === songEditorModel.lyrics)
|
||||||
return;
|
return;
|
||||||
updateLyrics(lyricsEditor.text);
|
else
|
||||||
|
songEditorModel.lyrics = lyricsEditor.text;
|
||||||
|
/* updateLyrics(lyricsEditor.text); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function newSong(index) {
|
|
||||||
clearSlides();
|
|
||||||
let thisSong = songProxyModel.getSong(index);
|
|
||||||
songEditorModel.title = thisSong.title;
|
|
||||||
songEditorModel.lyrics = thisSong.lyrics;
|
|
||||||
songEditorModel.author = thisSong.author;
|
|
||||||
songEditorModel.ccli = thisSong.ccli;
|
|
||||||
songEditorModel.audio = thisSong.audio;
|
|
||||||
songEditorModel.verseOrder = thisSong.vorder;
|
|
||||||
songEditorModel.background = thisSong.background;
|
|
||||||
songEditorModel.backgroundType = thisSong.backgroundType;
|
|
||||||
songEditorModel.horizontalTextAlignment = thisSong.horizontalTextAlignment;
|
|
||||||
songEditorModel.verticalTextAlignment = thisSong.verticalTextAlignment;
|
|
||||||
songEditorModel.font = thisSong.font;
|
|
||||||
songEditorModel.fontSize = thisSong.fontSize;
|
|
||||||
songEditorModel.checkFiles();
|
|
||||||
songID = thisSong.id;
|
|
||||||
|
|
||||||
updateHorizontalTextAlignment("Center");
|
|
||||||
changeSlideHAlignment("Center");
|
|
||||||
updateVerticalTextAlignment("Center");
|
|
||||||
changeSlideVAlignment("Center");
|
|
||||||
updateFont("Noto Sans");
|
|
||||||
changeSlideFont("Noto Sans", true);
|
|
||||||
updateFontSize(50);
|
|
||||||
changeSlideFontSize(50, true);
|
|
||||||
updateLyrics("Lyrics");
|
|
||||||
songList.loadVideo();
|
|
||||||
console.log("New song with ID: " + song.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
function changeSong(index) {
|
function changeSong(index) {
|
||||||
console.log("Preparing to change song: " + index + 1 + " out of " + songProxyModel.songModel.count);
|
console.log("Preparing to change song: " + index + 1 + " out of " + songProxyModel.songModel.count);
|
||||||
if (songProxyModel.songModel.count - 1 === index)
|
|
||||||
newSong(index)
|
|
||||||
else {
|
|
||||||
clearSlides();
|
clearSlides();
|
||||||
const updatedSong = songProxyModel.getSong(index);
|
const updatedSong = songProxyModel.getSong(index);
|
||||||
console.log(updatedSong.vorder + " " + updatedSong.title + " " + updatedSong.audio);
|
console.log(updatedSong.vorder + " " + updatedSong.title + " " + updatedSong.audio);
|
||||||
|
@ -546,6 +514,15 @@ Item {
|
||||||
footerSecondText = song.title;
|
footerSecondText = song.title;
|
||||||
songList.loadVideo();
|
songList.loadVideo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: songEditorModel
|
||||||
|
function onLyricsChanged() {
|
||||||
|
showPassiveNotification("Lyrics changed");
|
||||||
|
songProxyModel.songModel.updateLyrics(songID, lyricsEditor.text);
|
||||||
|
clearSlides();
|
||||||
|
changeSlideText(songID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateLyrics(lyrics) {
|
function updateLyrics(lyrics) {
|
||||||
|
|
|
@ -248,7 +248,7 @@ use self::song_model::{
|
||||||
SongRoles,
|
SongRoles,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Default, Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Song {
|
pub struct Song {
|
||||||
id: i32,
|
id: i32,
|
||||||
title: String,
|
title: String,
|
||||||
|
@ -265,6 +265,18 @@ pub struct Song {
|
||||||
font_size: i32,
|
font_size: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for Song {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
horizontal_text_alignment: String::from("Center"),
|
||||||
|
vertical_text_alignment: String::from("Center"),
|
||||||
|
font: String::from("Quicksand Bold"),
|
||||||
|
font_size: 50,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
pub struct SongModelRust {
|
pub struct SongModelRust {
|
||||||
count: i32,
|
count: i32,
|
||||||
|
@ -451,18 +463,19 @@ impl song_model::SongModel {
|
||||||
) -> (usize, QModelIndex, QVector_i32) {
|
) -> (usize, QModelIndex, QVector_i32) {
|
||||||
let mut vector_roles = QVector_i32::default();
|
let mut vector_roles = QVector_i32::default();
|
||||||
vector_roles.append(self.as_ref().get_role(role));
|
vector_roles.append(self.as_ref().get_role(role));
|
||||||
let index = self
|
if let Some(index) =
|
||||||
.as_ref()
|
self.as_ref().songs.iter().position(|x| x.id == song_id)
|
||||||
.songs
|
{
|
||||||
.iter()
|
|
||||||
.position(|x| x.id == song_id)
|
|
||||||
.unwrap();
|
|
||||||
let model_index = self.as_ref().index(
|
let model_index = self.as_ref().index(
|
||||||
index as i32,
|
index as i32,
|
||||||
0,
|
0,
|
||||||
&QModelIndex::default(),
|
&QModelIndex::default(),
|
||||||
);
|
);
|
||||||
(index, model_index, vector_roles)
|
(index, model_index, vector_roles)
|
||||||
|
} else {
|
||||||
|
error!(song_id, "This song appears to be missing");
|
||||||
|
(0, QModelIndex::default(), vector_roles)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_title(
|
pub fn update_title(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue