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/video_model.rs")
.file("src/rust/presentation_model.rs") .file("src/rust/presentation_model.rs")
.file("src/rust/songs/song_model.rs") .file("src/rust/songs/song_model.rs")
.file("src/rust/songs/song_editor.rs")
.file("src/rust/ytdl.rs") .file("src/rust/ytdl.rs")
.file("src/rust/utils.rs") .file("src/rust/utils.rs")
.build(); .build();

View file

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

View file

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

View file

@ -1,21 +1,62 @@
#[cxx_qt::bridge]
mod song_editor { mod song_editor {
pub enum Yes { use crate::songs::song_model::qobject::SongModel;
Yes,
No, 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 { #[derive(Clone, Debug)]
title: String, #[cxx_qt::qobject]
lyrics: String, pub struct SongEditor {
author: String, #[qproperty]
ccli: String, title: QString,
audio: String, #[qproperty]
verse_order: String, lyrics: QString,
background: String, #[qproperty]
background_type: String, author: QString,
horizontal_text_alignment: String, #[qproperty]
vertical_text_alignment: String, ccli: QString,
font: String, #[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, 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!();
}
} }
} }