adding some tweaks to making song_editor working better
This commit is contained in:
parent
96d5bdac73
commit
f34e8cbd7e
4 changed files with 71 additions and 67 deletions
|
@ -754,6 +754,7 @@ QStringList SongProxyModel::getLyricList(const int &row) {
|
||||||
|
|
||||||
QVariantMap SongProxyModel::getSong(const int &row) {
|
QVariantMap SongProxyModel::getSong(const int &row) {
|
||||||
QVariantMap song = m_songModel->getItem(mapToSource(index(row, 0)).row());
|
QVariantMap song = m_songModel->getItem(mapToSource(index(row, 0)).row());
|
||||||
|
qDebug() << song;
|
||||||
return song;
|
return song;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,7 +302,7 @@ Item {
|
||||||
onEditingFinished: updateVerseOrder(text);
|
onEditingFinished: updateVerseOrder(text);
|
||||||
background: Presenter.TextBackground {
|
background: Presenter.TextBackground {
|
||||||
control: songVorderField
|
control: songVorderField
|
||||||
errorCondition: song.vorder.length === 0
|
errorCondition: song.verseOrderError
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,7 +473,19 @@ Item {
|
||||||
|
|
||||||
function newSong(index) {
|
function newSong(index) {
|
||||||
clearSlides();
|
clearSlides();
|
||||||
song = songProxyModel.getSong(index);
|
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;
|
||||||
|
|
||||||
changeSlideHAlignment("Center");
|
changeSlideHAlignment("Center");
|
||||||
changeSlideVAlignment("Center");
|
changeSlideVAlignment("Center");
|
||||||
|
@ -485,22 +497,26 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeSong(index) {
|
function changeSong(index) {
|
||||||
|
if (songProxyModel.songModel.count === index)
|
||||||
|
newSong(index)
|
||||||
|
else {
|
||||||
clearSlides();
|
clearSlides();
|
||||||
const updatedSong = songProxyModel.getSong(index);
|
const updatedSong = songProxyModel.getSong(index);
|
||||||
console.log(updatedSong.verseOrder + " " + updatedSong.title);
|
console.log(updatedSong.vorder + " " + updatedSong.title + " " + updatedSong.audio);
|
||||||
songEditorModel.title = updatedSong.title;
|
songEditorModel.title = updatedSong.title;
|
||||||
songEditorModel.lyrics = updatedSong.lyrics;
|
songEditorModel.lyrics = updatedSong.lyrics;
|
||||||
songEditorModel.author = updatedSong.author;
|
songEditorModel.author = updatedSong.author;
|
||||||
songEditorModel.ccli = updatedSong.ccli;
|
songEditorModel.ccli = updatedSong.ccli;
|
||||||
songEditorModel.audio = updatedSong.audio;
|
songEditorModel.audio = updatedSong.audio;
|
||||||
songEditorModel.verseOrder = updatedSong.verseOrder;
|
songEditorModel.verseOrder = updatedSong.vorder;
|
||||||
songEditorModel.background = updatedSong.background;
|
songEditorModel.background = updatedSong.background;
|
||||||
songEditorModel.backgroundType = updatedSong.backgroundType;
|
songEditorModel.backgroundType = updatedSong.backgroundType;
|
||||||
songEditorModel.horizontalTextAlignment = updatedSong.horizontalTextAlignment;
|
songEditorModel.horizontalTextAlignment = updatedSong.horizontalTextAlignment;
|
||||||
songEditorModel.verticalTextAlignment = updatedSong.verticalTextAlignment;
|
songEditorModel.verticalTextAlignment = updatedSong.verticalTextAlignment;
|
||||||
songEditorModel.font = updatedSong.font;
|
songEditorModel.font = updatedSong.font;
|
||||||
songEditorModel.fontSize = updatedSong.fontSize;
|
songEditorModel.fontSize = updatedSong.fontSize;
|
||||||
songIndex = song.id;
|
songEditorModel.checkVerseOrder();
|
||||||
|
songIndex = updatedSong.id;
|
||||||
|
|
||||||
changeSlideHAlignment(song.horizontalTextAlignment);
|
changeSlideHAlignment(song.horizontalTextAlignment);
|
||||||
changeSlideVAlignment(song.verticalTextAlignment);
|
changeSlideVAlignment(song.verticalTextAlignment);
|
||||||
|
@ -512,6 +528,7 @@ Item {
|
||||||
footerSecondText = song.title;
|
footerSecondText = song.title;
|
||||||
songList.loadVideo();
|
songList.loadVideo();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateLyrics(lyrics) {
|
function updateLyrics(lyrics) {
|
||||||
songProxyModel.songModel.updateLyrics(songIndex, lyrics);
|
songProxyModel.songModel.updateLyrics(songIndex, lyrics);
|
||||||
|
@ -537,6 +554,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateVerseOrder(vorder) {
|
function updateVerseOrder(vorder) {
|
||||||
|
songEditorModel.verseOrder = vorder;
|
||||||
|
songEditorModel.checkVerseOrder();
|
||||||
songProxyModel.songModel.updateVerseOrder(songIndex, vorder)
|
songProxyModel.songModel.updateVerseOrder(songIndex, vorder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#[cxx_qt::bridge]
|
#[cxx_qt::bridge]
|
||||||
pub mod song_editor {
|
pub mod song_editor {
|
||||||
|
use tracing::{debug, debug_span, error, info, instrument};
|
||||||
|
|
||||||
unsafe extern "C++" {
|
unsafe extern "C++" {
|
||||||
include!("cxx-qt-lib/qmap.h");
|
include!("cxx-qt-lib/qmap.h");
|
||||||
|
@ -31,13 +32,13 @@ pub mod song_editor {
|
||||||
#[qproperty]
|
#[qproperty]
|
||||||
ccli: QString,
|
ccli: QString,
|
||||||
#[qproperty]
|
#[qproperty]
|
||||||
audio: QUrl,
|
audio: QString,
|
||||||
#[qproperty]
|
#[qproperty]
|
||||||
verse_order: QString,
|
verse_order: QString,
|
||||||
#[qproperty]
|
#[qproperty]
|
||||||
verse_order_format: bool,
|
verse_order_error: bool,
|
||||||
#[qproperty]
|
#[qproperty]
|
||||||
background: QUrl,
|
background: QString,
|
||||||
#[qproperty]
|
#[qproperty]
|
||||||
background_type: QString,
|
background_type: QString,
|
||||||
#[qproperty]
|
#[qproperty]
|
||||||
|
@ -59,10 +60,10 @@ pub mod song_editor {
|
||||||
lyrics: QString::default(),
|
lyrics: QString::default(),
|
||||||
author: QString::default(),
|
author: QString::default(),
|
||||||
ccli: QString::default(),
|
ccli: QString::default(),
|
||||||
audio: QUrl::default(),
|
audio: QString::default(),
|
||||||
verse_order: QString::default(),
|
verse_order: QString::default(),
|
||||||
verse_order_format: true,
|
verse_order_error: false,
|
||||||
background: QUrl::default(),
|
background: QString::default(),
|
||||||
background_type: QString::default(),
|
background_type: QString::default(),
|
||||||
horizontal_text_alignment: QString::default(),
|
horizontal_text_alignment: QString::default(),
|
||||||
vertical_text_alignment: QString::default(),
|
vertical_text_alignment: QString::default(),
|
||||||
|
@ -80,38 +81,21 @@ pub mod song_editor {
|
||||||
// pinned_model.update_ccli(0, QString::from("idk"));
|
// pinned_model.update_ccli(0, QString::from("idk"));
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
// #[qinvokable]
|
|
||||||
// fn set_song(
|
#[qinvokable]
|
||||||
// mut self: Pin<&mut Self>,
|
pub fn check_verse_order(mut self: Pin<&mut Self>) {
|
||||||
// title: QString,
|
let vo = self.verse_order().to_string();
|
||||||
// lyrics: QString,
|
let split = vo.split(" ");
|
||||||
// author: QString,
|
debug!(verse_order = ?vo, iterator = ?split);
|
||||||
// ccli: QString,
|
for s in split {
|
||||||
// audio: QUrl,
|
if s.contains(",") {
|
||||||
// verse_order: QString,
|
self.as_mut().set_verse_order_error(true);
|
||||||
// background: QUrl,
|
} else if s.is_empty() {
|
||||||
// background_type: QString,
|
self.as_mut().set_verse_order_error(true);
|
||||||
// horizontal_text_alignment: QString,
|
} else {
|
||||||
// vertical_text_alignment: QString,
|
self.as_mut().set_verse_order_error(false);
|
||||||
// font: QString,
|
}
|
||||||
// font_size: i32,
|
}
|
||||||
// ) -> bool {
|
}
|
||||||
// self.as_mut().set_title(title);
|
|
||||||
// self.as_mut().set_lyrics(lyrics);
|
|
||||||
// self.as_mut().set_author(author);
|
|
||||||
// self.as_mut().set_ccli(ccli);
|
|
||||||
// self.as_mut().set_audio(audio);
|
|
||||||
// self.as_mut().set_verse_order(verse_order);
|
|
||||||
// self.as_mut().set_background(background);
|
|
||||||
// self.as_mut().set_background_type(background_type);
|
|
||||||
// self.as_mut().set_horizontal_text_alignment(
|
|
||||||
// horizontal_text_alignment,
|
|
||||||
// );
|
|
||||||
// self.as_mut()
|
|
||||||
// .set_vertical_text_alignment(vertical_text_alignment);
|
|
||||||
// self.as_mut().set_font(font);
|
|
||||||
// self.as_mut().set_font_size(font_size);
|
|
||||||
// true
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -793,7 +793,7 @@ pub mod song_model {
|
||||||
let role_names_iter = role_names.iter();
|
let role_names_iter = role_names.iter();
|
||||||
if let Some(song) = self.rust().songs.get(index as usize)
|
if let Some(song) = self.rust().songs.get(index as usize)
|
||||||
{
|
{
|
||||||
debug!(song);
|
debug!(?song);
|
||||||
for i in role_names_iter {
|
for i in role_names_iter {
|
||||||
qvariantmap.insert(
|
qvariantmap.insert(
|
||||||
QString::from(&i.1.to_string()),
|
QString::from(&i.1.to_string()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue