adding song_editor and trying to embed song_model to it

This commit is contained in:
Chris Cochrun 2023-10-06 08:35:02 -05:00
parent 19e3c71ff2
commit e1a6e65295
4 changed files with 62 additions and 15 deletions

View file

@ -12,6 +12,7 @@ fn main() {
.file("src/rust/video_model.rs")
.file("src/rust/presentation_model.rs")
.file("src/rust/songs/song_model.rs")
.file("src/rust/songs/song_editor.rs")
.file("src/rust/ytdl.rs")
.file("src/rust/utils.rs")
.build();

View file

@ -222,6 +222,7 @@ int main(int argc, char *argv[])
qmlRegisterType<ImageProxyModel>("org.presenter", 1, 0, "ImageProxyModel");
qmlRegisterType<PresentationProxyModel>("org.presenter", 1, 0, "PresentationProxyModel");
qmlRegisterType<SongModel>("org.presenter", 1, 0, "SongModel");
qmlRegisterType<SongEditor>("org.presenter", 1, 0, "SongEditor");
qmlRegisterType<VideoModel>("org.presenter", 1, 0, "VideoModel");
qmlRegisterType<ImageModel>("org.presenter", 1, 0, "ImageModel");
qmlRegisterType<PresentationModel>("org.presenter", 1, 0, "PresentationModel");

View file

@ -144,6 +144,10 @@ Controls.Page {
ServiceThing { id: serviceThing }
FileHelper { id: fileHelper }
SlideHelper { id: slideHelper }
SongEditor {
id: songEditor
songModel: songProxyModel.songModel()
}
function changeServiceItem(index) {
console.log("change-service-item: " + index);

View file

@ -1,21 +1,62 @@
#[cxx_qt::bridge]
mod song_editor {
pub enum Yes {
Yes,
No,
use crate::songs::song_model::qobject::SongModel;
unsafe extern "C++" {
include!("cxx-qt-lib/qmap.h");
type QMap_QString_QVariant =
cxx_qt_lib::QMap<cxx_qt_lib::QMapPair_QString_QVariant>;
include!("cxx-qt-lib/qvariant.h");
type QVariant = cxx_qt_lib::QVariant;
include!("cxx-qt-lib/qstring.h");
type QString = cxx_qt_lib::QString;
include!("cxx-qt-lib/qstringlist.h");
type QStringList = cxx_qt_lib::QStringList;
include!("cxx-qt-lib/qlist.h");
type QList_QString = cxx_qt_lib::QList<QString>;
#[cxx_name = "SongModel"]
type SongModel = SongModel;
}
pub struct EditableSong {
title: String,
lyrics: String,
author: String,
ccli: String,
audio: String,
verse_order: String,
background: String,
background_type: String,
horizontal_text_alignment: String,
vertical_text_alignment: String,
font: String,
#[derive(Clone, Debug)]
#[cxx_qt::qobject]
pub struct SongEditor {
#[qproperty]
title: QString,
#[qproperty]
lyrics: QString,
#[qproperty]
author: QString,
#[qproperty]
ccli: QString,
#[qproperty]
audio: QUrl,
#[qproperty]
verse_order: QString,
#[qproperty]
verse_order_format: bool,
#[qproperty]
background: QUrl,
#[qproperty]
background_type: QString,
#[qproperty]
horizontal_text_alignment: QString,
#[qproperty]
vertical_text_alignment: QString,
#[qproperty]
font: QString,
#[qproperty]
font_size: i32,
#[qproperty]
song_model: *mut SongModel,
}
impl SongEditor {
fn idk(mut self: Pin<&mut Self>) {
// let mut model = self.song_model().as_mut().unwrap();
// let pinned_model = Pin::new_unchecked(model);
// pinned_model.update_ccli(0, QString::from("idk"));
todo!();
}
}
}