rust side builds but having trouble linking in main.cpp
This commit is contained in:
parent
fbcb6afc7a
commit
92f2b18a20
14 changed files with 377 additions and 140 deletions
125
Cargo.lock
generated
125
Cargo.lock
generated
|
@ -372,12 +372,24 @@ version = "3.16.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytemuck"
|
||||||
|
version = "1.22.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "byteorder-lite"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.7.1"
|
version = "1.7.1"
|
||||||
|
@ -409,8 +421,10 @@ checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android-tzdata",
|
"android-tzdata",
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
|
"js-sys",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"serde",
|
"serde",
|
||||||
|
"wasm-bindgen",
|
||||||
"windows-targets 0.52.6",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -460,6 +474,12 @@ dependencies = [
|
||||||
"tracing-error",
|
"tracing-error",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "color_quant"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "concurrent-queue"
|
name = "concurrent-queue"
|
||||||
version = "2.5.0"
|
version = "2.5.0"
|
||||||
|
@ -567,21 +587,6 @@ dependencies = [
|
||||||
"link-cplusplus",
|
"link-cplusplus",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cxx-build"
|
|
||||||
version = "1.0.128"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c77953e99f01508f89f55c494bfa867171ef3a6c8cea03d26975368f2121a5c1"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"codespan-reporting",
|
|
||||||
"once_cell",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"scratch",
|
|
||||||
"syn 2.0.77",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cxx-gen"
|
name = "cxx-gen"
|
||||||
version = "0.7.128"
|
version = "0.7.128"
|
||||||
|
@ -596,38 +601,41 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cxx-qt"
|
name = "cxx-qt"
|
||||||
version = "0.6.1"
|
version = "0.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "08aa6cda7588b6d17c563b0d2fadc060d4204d04908c0f359ae288857091218d"
|
checksum = "208ad6c4feac92f221fde00796f317b049ba1892b97be0d60ca177d0d3469fc5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cxx",
|
"cxx",
|
||||||
|
"cxx-qt-build",
|
||||||
"cxx-qt-macro",
|
"cxx-qt-macro",
|
||||||
|
"qt-build-utils",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cxx-qt-build"
|
name = "cxx-qt-build"
|
||||||
version = "0.6.1"
|
version = "0.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9e097b99f49792922a72a8ca35d9391762e48e63363d6998255be1f2ca1edf69"
|
checksum = "15f80e109aa68795486c70c302f6c2d921f00028b3b62038a4601efb5c585c1c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"codespan-reporting",
|
"codespan-reporting",
|
||||||
"convert_case",
|
|
||||||
"cxx-gen",
|
"cxx-gen",
|
||||||
"cxx-qt-gen",
|
"cxx-qt-gen",
|
||||||
"cxx-qt-lib-headers",
|
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"qt-build-utils",
|
"qt-build-utils",
|
||||||
"quote",
|
"quote",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cxx-qt-gen"
|
name = "cxx-qt-gen"
|
||||||
version = "0.6.1"
|
version = "0.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ede7c73dbfbcc234d8826919e257830c1789db2cac586546a87d2a82e3cbe5d5"
|
checksum = "dc17d95ca9cc60c2f91f804a4e0ba6a3e1b8ed338c207a1bd8d176133e2fd05d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clang-format",
|
"clang-format",
|
||||||
"convert_case",
|
"convert_case",
|
||||||
|
@ -639,27 +647,30 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cxx-qt-lib"
|
name = "cxx-qt-lib"
|
||||||
version = "0.6.1"
|
version = "0.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "002f1a6119bcb7dfec67eb7c0803a7b1d595dc54610559faeac35133f22a5880"
|
checksum = "f116c5d982bbf3be707acf97f566802c30454d52ca319c745ed39a04834e8bc6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"chrono",
|
||||||
"cxx",
|
"cxx",
|
||||||
"cxx-build",
|
"cxx-qt",
|
||||||
"cxx-qt-lib-headers",
|
"cxx-qt-build",
|
||||||
|
"http 1.1.0",
|
||||||
|
"image 0.24.9",
|
||||||
|
"image 0.25.5",
|
||||||
"qt-build-utils",
|
"qt-build-utils",
|
||||||
|
"rgb",
|
||||||
|
"serde",
|
||||||
|
"time",
|
||||||
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cxx-qt-lib-headers"
|
|
||||||
version = "0.6.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9abdeab6b77cfc5a53b724f3f62a37bcb5ac1423cccc2dba4c134f4273440b8c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cxx-qt-macro"
|
name = "cxx-qt-macro"
|
||||||
version = "0.6.1"
|
version = "0.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "699e8a668c03b03419b084960d72eed253632bb16349b33fd0a0c893b61b664c"
|
checksum = "58a4fe02c0604eda28c605792f5ba0d0251b4947f8f0fc43e55b61c06b2b8ec6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cxx-qt-gen",
|
"cxx-qt-gen",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -1344,6 +1355,29 @@ dependencies = [
|
||||||
"unicode-normalization",
|
"unicode-normalization",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "image"
|
||||||
|
version = "0.24.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck",
|
||||||
|
"byteorder",
|
||||||
|
"color_quant",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "image"
|
||||||
|
version = "0.25.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cd6f44aed642f18953a158afeb30206f4d50da59fbc66ecb53c66488de73563b"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck",
|
||||||
|
"byteorder-lite",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indenter"
|
name = "indenter"
|
||||||
version = "0.3.3"
|
version = "0.3.3"
|
||||||
|
@ -1406,9 +1440,9 @@ checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itertools"
|
name = "itertools"
|
||||||
version = "0.11.0"
|
version = "0.13.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
|
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"either",
|
"either",
|
||||||
]
|
]
|
||||||
|
@ -2093,9 +2127,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "qt-build-utils"
|
name = "qt-build-utils"
|
||||||
version = "0.6.1"
|
version = "0.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d59c828fe2434dad34dd0c30a4ba037509b61dad92a55baf0dc42699e6aa2f10"
|
checksum = "efb239fdd8c036fabb95364320041ef68197cd4ab971bb3b4ca3ea0b7b93d12c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
@ -2281,6 +2315,9 @@ name = "rgb"
|
||||||
version = "0.8.50"
|
version = "0.8.50"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a"
|
checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a"
|
||||||
|
dependencies = [
|
||||||
|
"bytemuck",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rsa"
|
name = "rsa"
|
||||||
|
@ -2365,12 +2402,6 @@ version = "1.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "scratch"
|
|
||||||
version = "1.0.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "security-framework"
|
name = "security-framework"
|
||||||
version = "2.11.1"
|
version = "2.11.1"
|
||||||
|
@ -3305,9 +3336,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "versions"
|
name = "versions"
|
||||||
version = "5.0.1"
|
version = "6.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c73a36bc44e3039f51fbee93e39f41225f6b17b380eb70cc2aab942df06b34dd"
|
checksum = "f25d498b63d1fdb376b4250f39ab3a5ee8d103957346abacd911e2d8b612c139"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools",
|
"itertools",
|
||||||
"nom",
|
"nom",
|
||||||
|
|
|
@ -27,8 +27,8 @@ serde = "1.0.152"
|
||||||
serde_derive = "1.0.152"
|
serde_derive = "1.0.152"
|
||||||
quote = "1.0.27"
|
quote = "1.0.27"
|
||||||
cxx = "1.0.83"
|
cxx = "1.0.83"
|
||||||
cxx-qt = "0.6.1"
|
cxx-qt = "0.7.1"
|
||||||
cxx-qt-lib = "0.6.1"
|
cxx-qt-lib = { version = "0.7.1", features = [ "full" ] }
|
||||||
# home = "0.5.4"
|
# home = "0.5.4"
|
||||||
dirs = "5.0.0"
|
dirs = "5.0.0"
|
||||||
# libsqlite3-sys = { version = ">=0.17.2", features = ["bundled"] }
|
# libsqlite3-sys = { version = ">=0.17.2", features = ["bundled"] }
|
||||||
|
@ -51,8 +51,8 @@ color-eyre = "0.6.3"
|
||||||
# cxx-qt-build generates C++ code from the `#[cxx_qt::bridge]` module
|
# cxx-qt-build generates C++ code from the `#[cxx_qt::bridge]` module
|
||||||
# and compiles it together with the Rust static library
|
# and compiles it together with the Rust static library
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cxx-qt-build = { version = "0.6.1", features = [ "link_qt_object_files" ] }
|
cxx-qt-build = { version = "0.7.1", features = [ "link_qt_object_files" ] }
|
||||||
qt-build-utils = "0.6.1"
|
qt-build-utils = "0.7.1"
|
||||||
|
|
||||||
# [dependencies.confy]
|
# [dependencies.confy]
|
||||||
# features = ["yaml_conf"]
|
# features = ["yaml_conf"]
|
||||||
|
|
88
build.rs
88
build.rs
|
@ -1,3 +1,5 @@
|
||||||
|
use std::{env, path::PathBuf};
|
||||||
|
|
||||||
use cxx_qt_build::{CxxQtBuilder, QmlModule};
|
use cxx_qt_build::{CxxQtBuilder, QmlModule};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -17,6 +19,37 @@ fn main() {
|
||||||
.file("src/rust/obs.rs")
|
.file("src/rust/obs.rs")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// let mut kde_include_dir = String::from("/usr/include/");
|
||||||
|
// let mut kde_lib_dir = String::from("/usr/lib/x86_64-linux-gnu/");
|
||||||
|
|
||||||
|
// if let Ok(mut include_dir) = env::var("CMAKE_INCLUDE_PATH") {
|
||||||
|
// println!("{}", include_dir);
|
||||||
|
// if let Some(include_dir) =
|
||||||
|
// include_dir.split(":").find(|s| s.contains("ki18n"))
|
||||||
|
// {
|
||||||
|
// kde_include_dir = include_dir.to_owned();
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// println!(
|
||||||
|
// "cargo:warning=KDE_INCLUDEDIR is not defined, used default value: {}",
|
||||||
|
// kde_include_dir
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// if let Ok(lib_dir) = env::var("KDE_LIBDIR") {
|
||||||
|
// kde_lib_dir = lib_dir;
|
||||||
|
// } else {
|
||||||
|
// println!(
|
||||||
|
// "cargo:warning=KDE_LIBDIR is not defined, used default value: {}",
|
||||||
|
// kde_lib_dir
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// let ki18n_include_path = PathBuf::from(kde_include_dir)
|
||||||
|
// .canonicalize()
|
||||||
|
// .expect("Cannot get canonical path of KDE_INCLUDEDIR")
|
||||||
|
// .join("KF6")
|
||||||
|
// .join("KI18n");
|
||||||
|
|
||||||
// CxxQtBuilder::new()
|
// CxxQtBuilder::new()
|
||||||
// // Link Qt's Network library
|
// // Link Qt's Network library
|
||||||
// // - Qt Core is always linked
|
// // - Qt Core is always linked
|
||||||
|
@ -27,13 +60,64 @@ fn main() {
|
||||||
// // .qt_module("Kirigami")
|
// // .qt_module("Kirigami")
|
||||||
// // .qt_module("WebEngineQuick")
|
// // .qt_module("WebEngineQuick")
|
||||||
// .qt_module("Network")
|
// .qt_module("Network")
|
||||||
|
// // .qt_module("Quick")
|
||||||
|
// // .qt_module("Test")
|
||||||
|
// // .qt_module("WebEngineQuick")
|
||||||
// // .qt_module("I18n")
|
// // .qt_module("I18n")
|
||||||
// // .qt_module("CoreAddons")
|
// // .qt_module("CoreAddons")
|
||||||
// .qml_module(QmlModule {
|
// .qml_module(QmlModule {
|
||||||
// uri: "com.cochrun.xyz",
|
// uri: "com.cochrun.xyz",
|
||||||
// rust_files: &["src/rust/settings.rs"],
|
// rust_files: &[
|
||||||
// qml_files: &["src/qml/main.qml"],
|
// "src/rust/settings.rs",
|
||||||
|
// "src/rust/service_item_model.rs",
|
||||||
|
// "src/rust/file_helper.rs",
|
||||||
|
// "src/rust/slide_model.rs",
|
||||||
|
// "src/rust/slide_object.rs",
|
||||||
|
// "src/rust/ytdl.rs",
|
||||||
|
// "src/rust/utils.rs",
|
||||||
|
// "src/rust/obs.rs",
|
||||||
|
// "src/rust/video_model.rs",
|
||||||
|
// "src/rust/image_model.rs",
|
||||||
|
// "src/rust/presentation_model.rs",
|
||||||
|
// // "src/rust/songs/song_model.rs",
|
||||||
|
// // "src/rust/songs/song_editor.rs",
|
||||||
|
// ],
|
||||||
|
// qrc_files: &["src/resources.qrc"],
|
||||||
|
// qml_files: &[
|
||||||
|
// "src/qml/main.qml",
|
||||||
|
// "src/qml/presenter/LeftDock.qml",
|
||||||
|
// "src/qml/presenter/ServiceList.qml",
|
||||||
|
// "src/qml/presenter/MainWindow.qml",
|
||||||
|
// "src/qml/presenter/Library.qml",
|
||||||
|
// "src/qml/presenter/LibraryItem.qml",
|
||||||
|
// "src/qml/presenter/Header.qml",
|
||||||
|
// "src/qml/presenter/Actions.qml",
|
||||||
|
// "src/qml/presenter/PanelItem.qml",
|
||||||
|
// "src/qml/presenter/SongEditor.qml",
|
||||||
|
// "src/qml/presenter/VideoEditor.qml",
|
||||||
|
// "src/qml/presenter/ImageEditor.qml",
|
||||||
|
// "src/qml/presenter/PresentationEditor.qml",
|
||||||
|
// "src/qml/presenter/SlideEditor.qml",
|
||||||
|
// "src/qml/presenter/Slide.qml",
|
||||||
|
// "src/qml/presenter/SlidesListView.qml",
|
||||||
|
// "src/qml/presenter/SongEditorSlideList.qml",
|
||||||
|
// "src/qml/presenter/DragHandle.qml",
|
||||||
|
// "src/qml/presenter/Presentation.qml",
|
||||||
|
// "src/qml/presenter/PresentationWindow.qml",
|
||||||
|
// "src/qml/presenter/PreviewSlideListDelegate.qml",
|
||||||
|
// "src/qml/presenter/PreviewSlide.qml",
|
||||||
|
// "src/qml/presenter/Settings.qml",
|
||||||
|
// "src/qml/presenter/RangedSlider.qml",
|
||||||
|
// "src/qml/presenter/NewVideo.qml",
|
||||||
|
// "src/qml/presenter/TextBackground.qml",
|
||||||
|
// "src/qml/presenter/TextBox.qml",
|
||||||
|
// "src/qml/presenter/LoadingSpinner.qml",
|
||||||
|
// ],
|
||||||
// ..Default::default()
|
// ..Default::default()
|
||||||
// })
|
// })
|
||||||
|
// .cc_builder(|cc| {
|
||||||
|
// cc.include("cpp");
|
||||||
|
// cc.include(format!("{}", ki18n_include_path.display()));
|
||||||
|
// })
|
||||||
// .build();
|
// .build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,9 @@
|
||||||
libclang
|
libclang
|
||||||
# libwebp
|
# libwebp
|
||||||
# clang-format
|
# clang-format
|
||||||
qt6.qtbase
|
qt6.full
|
||||||
qt6.qttools
|
qt6.qttools
|
||||||
|
qt6.qtbase
|
||||||
# qt6.qtquickcontrols2
|
# qt6.qtquickcontrols2
|
||||||
# qt6.qtx11extras
|
# qt6.qtx11extras
|
||||||
qt6.qtmultimedia
|
qt6.qtmultimedia
|
||||||
|
@ -63,7 +64,6 @@
|
||||||
qt6.qtwebengine
|
qt6.qtwebengine
|
||||||
qt6.qtimageformats
|
qt6.qtimageformats
|
||||||
kdePackages.kirigami
|
kdePackages.kirigami
|
||||||
kdePackages.mpvqt
|
|
||||||
# kdePackages.kfilemetadata
|
# kdePackages.kfilemetadata
|
||||||
# libsForQt5.breeze-icons
|
# libsForQt5.breeze-icons
|
||||||
# libsForQt5.breeze-qt5
|
# libsForQt5.breeze-qt5
|
||||||
|
@ -106,6 +106,8 @@
|
||||||
CMAKE_C_COMPILER = "${pkgs.gcc}/bin/gcc";
|
CMAKE_C_COMPILER = "${pkgs.gcc}/bin/gcc";
|
||||||
CMAKE_CXX_COMPILER = "${pkgs.gcc}/bin/g++";
|
CMAKE_CXX_COMPILER = "${pkgs.gcc}/bin/g++";
|
||||||
CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG = true;
|
CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG = true;
|
||||||
|
# KDE_INCLUDEDIR = "${pkgs.kdePackages.kirigami.dev}/include";
|
||||||
|
# KDE_QMLDIR = "${pkgs.kdePackages.kirigami.dev}/lib/qt-6/qml/org/kde/kirigami/";
|
||||||
|
|
||||||
# This creates the proper qt env so that plugins are found right.
|
# This creates the proper qt env so that plugins are found right.
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
|
26
src/main.cpp
26
src/main.cpp
|
@ -31,19 +31,19 @@
|
||||||
// #include "cpp/mpv/mpvproperties.h"
|
// #include "cpp/mpv/mpvproperties.h"
|
||||||
|
|
||||||
// RUST
|
// RUST
|
||||||
#include "cxx-qt-gen/file_helper.cxxqt.h"
|
#include <liblumina/src/rust/file_helper.cxxqt.h>
|
||||||
#include "cxx-qt-gen/slide_object.cxxqt.h"
|
#include <liblumina/src/rust/slide_object.cxxqt.h>
|
||||||
#include "cxx-qt-gen/slide_model.cxxqt.h"
|
#include <liblumina/src/rust/slide_model.cxxqt.h>
|
||||||
#include "cxx-qt-gen/service_item_model.cxxqt.h"
|
#include <liblumina/src/rust/service_item_model.cxxqt.h>
|
||||||
#include "cxx-qt-gen/settings.cxxqt.h"
|
#include <liblumina/src/rust/settings.cxxqt.h>
|
||||||
#include "cxx-qt-gen/ytdl.cxxqt.h"
|
#include <liblumina/src/rust/ytdl.cxxqt.h>
|
||||||
#include "cxx-qt-gen/presentation_model.cxxqt.h"
|
#include <liblumina/src/rust/presentation_model.cxxqt.h>
|
||||||
#include "cxx-qt-gen/song_model.cxxqt.h"
|
#include <liblumina/src/rust/songs/song_model.cxxqt.h>
|
||||||
#include "cxx-qt-gen/video_model.cxxqt.h"
|
#include <liblumina/src/rust/video_model.cxxqt.h>
|
||||||
#include "cxx-qt-gen/image_model.cxxqt.h"
|
#include <liblumina/src/rust/image_model.cxxqt.h>
|
||||||
#include "cxx-qt-gen/utils.cxxqt.h"
|
#include <liblumina/src/rust/utils.cxxqt.h>
|
||||||
#include "cxx-qt-gen/song_editor.cxxqt.h"
|
#include <liblumina/src/rust/songs/song_editor.cxxqt.h>
|
||||||
#include "cxx-qt-gen/obs.cxxqt.h"
|
#include <liblumina/src/rust/obs.cxxqt.h>
|
||||||
|
|
||||||
static QWindow *windowFromEngine(QQmlApplicationEngine *engine)
|
static QWindow *windowFromEngine(QQmlApplicationEngine *engine)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
pub mod image_model {
|
pub mod image_model {
|
||||||
unsafe extern "C++" {
|
unsafe extern "C++" {
|
||||||
include!(< QAbstractListModel >);
|
include!(< QAbstractListModel >);
|
||||||
|
type QAbstractListModel;
|
||||||
include!("cxx-qt-lib/qhash.h");
|
include!("cxx-qt-lib/qhash.h");
|
||||||
type QHash_i32_QByteArray =
|
type QHash_i32_QByteArray =
|
||||||
cxx_qt_lib::QHash<cxx_qt_lib::QHashPair_i32_QByteArray>;
|
cxx_qt_lib::QHash<cxx_qt_lib::QHashPair_i32_QByteArray>;
|
||||||
|
@ -33,13 +34,14 @@ pub mod image_model {
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[qobject]
|
#[qobject]
|
||||||
#[base = "QAbstractListModel"]
|
#[base = QAbstractListModel]
|
||||||
#[qml_element]
|
#[qml_element]
|
||||||
#[qproperty(i32, count)]
|
#[qproperty(i32, count)]
|
||||||
type ImageModel = super::ImageModelRust;
|
type ImageModel = super::ImageModelRust;
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
#[qsignal]
|
#[qsignal]
|
||||||
|
#[cxx_name = "dataChanged"]
|
||||||
fn data_changed(
|
fn data_changed(
|
||||||
self: Pin<&mut ImageModel>,
|
self: Pin<&mut ImageModel>,
|
||||||
top_left: &QModelIndex,
|
top_left: &QModelIndex,
|
||||||
|
@ -83,6 +85,7 @@ pub mod image_model {
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginInsertRows"]
|
||||||
unsafe fn begin_insert_rows(
|
unsafe fn begin_insert_rows(
|
||||||
self: Pin<&mut ImageModel>,
|
self: Pin<&mut ImageModel>,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -91,9 +94,11 @@ pub mod image_model {
|
||||||
);
|
);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endInsertRows"]
|
||||||
unsafe fn end_insert_rows(self: Pin<&mut ImageModel>);
|
unsafe fn end_insert_rows(self: Pin<&mut ImageModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginRemoveRows"]
|
||||||
unsafe fn begin_remove_rows(
|
unsafe fn begin_remove_rows(
|
||||||
self: Pin<&mut ImageModel>,
|
self: Pin<&mut ImageModel>,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -102,6 +107,7 @@ pub mod image_model {
|
||||||
);
|
);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginMoveRows"]
|
||||||
unsafe fn begin_move_rows(
|
unsafe fn begin_move_rows(
|
||||||
self: Pin<&mut ImageModel>,
|
self: Pin<&mut ImageModel>,
|
||||||
source_parent: &QModelIndex,
|
source_parent: &QModelIndex,
|
||||||
|
@ -112,18 +118,23 @@ pub mod image_model {
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endMoveRows"]
|
||||||
unsafe fn end_move_rows(self: Pin<&mut ImageModel>);
|
unsafe fn end_move_rows(self: Pin<&mut ImageModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endRemoveRows"]
|
||||||
unsafe fn end_remove_rows(self: Pin<&mut ImageModel>);
|
unsafe fn end_remove_rows(self: Pin<&mut ImageModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginResetModel"]
|
||||||
unsafe fn begin_reset_model(self: Pin<&mut ImageModel>);
|
unsafe fn begin_reset_model(self: Pin<&mut ImageModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endResetModel"]
|
||||||
unsafe fn end_reset_model(self: Pin<&mut ImageModel>);
|
unsafe fn end_reset_model(self: Pin<&mut ImageModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "canFetchMore"]
|
||||||
fn can_fetch_more(
|
fn can_fetch_more(
|
||||||
self: &ImageModel,
|
self: &ImageModel,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -147,10 +158,12 @@ pub mod image_model {
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
#[cxx_override]
|
#[cxx_override]
|
||||||
|
#[cxx_name = "roleNames"]
|
||||||
fn role_names(self: &ImageModel) -> QHash_i32_QByteArray;
|
fn role_names(self: &ImageModel) -> QHash_i32_QByteArray;
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
#[cxx_override]
|
#[cxx_override]
|
||||||
|
#[cxx_name = "rowCount"]
|
||||||
fn row_count(self: &ImageModel, _parent: &QModelIndex)
|
fn row_count(self: &ImageModel, _parent: &QModelIndex)
|
||||||
-> i32;
|
-> i32;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +171,7 @@ pub mod image_model {
|
||||||
|
|
||||||
use cxx_qt::CxxQtType;
|
use cxx_qt::CxxQtType;
|
||||||
use cxx_qt_lib::{QModelIndex, QString, QUrl, QVariant};
|
use cxx_qt_lib::{QModelIndex, QString, QUrl, QVariant};
|
||||||
use sqlx::{query, query_as, Connection, SqliteConnection};
|
use sqlx::{Connection, SqliteConnection, query, query_as};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
|
|
@ -4,8 +4,20 @@ pub mod settings;
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut app = QGuiApplication::new();
|
let mut app = QGuiApplication::new();
|
||||||
let mut engine = QQmlApplicationEngine::new();
|
let mut engine = QQmlApplicationEngine::new();
|
||||||
|
let mut kde_qml_dir =
|
||||||
|
String::from("/usr/lib/x86_64-linux-gnu/qt6/qml/");
|
||||||
|
|
||||||
|
if let Ok(qml_dir) = env::var("NIXPKGS_QT6_QML_IMPORT_PATH") {
|
||||||
|
kde_qml_dir = qml_dir;
|
||||||
|
} else {
|
||||||
|
println!(
|
||||||
|
"cargo:warning=KDE_QMLDIR is not defined, used default value: {}",
|
||||||
|
kde_qml_dir
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(engine) = engine.as_mut() {
|
if let Some(engine) = engine.as_mut() {
|
||||||
|
engine.add_import_path(&QString::from(kde_qml_dir.as_str()));
|
||||||
engine.load(&QUrl::from(
|
engine.load(&QUrl::from(
|
||||||
"qrc:/qt/qml/com/cochrun/xyz/qml/main.qml",
|
"qrc:/qt/qml/com/cochrun/xyz/qml/main.qml",
|
||||||
));
|
));
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
pub mod presentation_model {
|
pub mod presentation_model {
|
||||||
unsafe extern "C++" {
|
unsafe extern "C++" {
|
||||||
include!(< QAbstractListModel >);
|
include!(< QAbstractListModel >);
|
||||||
|
type QAbstractListModel;
|
||||||
include!("cxx-qt-lib/qhash.h");
|
include!("cxx-qt-lib/qhash.h");
|
||||||
type QHash_i32_QByteArray =
|
type QHash_i32_QByteArray =
|
||||||
cxx_qt_lib::QHash<cxx_qt_lib::QHashPair_i32_QByteArray>;
|
cxx_qt_lib::QHash<cxx_qt_lib::QHashPair_i32_QByteArray>;
|
||||||
|
@ -35,13 +36,14 @@ pub mod presentation_model {
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[qobject]
|
#[qobject]
|
||||||
#[base = "QAbstractListModel"]
|
#[base = QAbstractListModel]
|
||||||
#[qml_element]
|
#[qml_element]
|
||||||
#[qproperty(i32, count)]
|
#[qproperty(i32, count)]
|
||||||
type PresentationModel = super::PresentationModelRust;
|
type PresentationModel = super::PresentationModelRust;
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
#[qsignal]
|
#[qsignal]
|
||||||
|
#[cxx_name = "dataChanged"]
|
||||||
fn data_changed(
|
fn data_changed(
|
||||||
self: Pin<&mut PresentationModel>,
|
self: Pin<&mut PresentationModel>,
|
||||||
top_left: &QModelIndex,
|
top_left: &QModelIndex,
|
||||||
|
@ -101,6 +103,7 @@ pub mod presentation_model {
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginInsertRows"]
|
||||||
unsafe fn begin_insert_rows(
|
unsafe fn begin_insert_rows(
|
||||||
self: Pin<&mut PresentationModel>,
|
self: Pin<&mut PresentationModel>,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -109,9 +112,11 @@ pub mod presentation_model {
|
||||||
);
|
);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endInsertRows"]
|
||||||
unsafe fn end_insert_rows(self: Pin<&mut PresentationModel>);
|
unsafe fn end_insert_rows(self: Pin<&mut PresentationModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginRemoveRows"]
|
||||||
unsafe fn begin_remove_rows(
|
unsafe fn begin_remove_rows(
|
||||||
self: Pin<&mut PresentationModel>,
|
self: Pin<&mut PresentationModel>,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -120,6 +125,7 @@ pub mod presentation_model {
|
||||||
);
|
);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginMoveRows"]
|
||||||
unsafe fn begin_move_rows(
|
unsafe fn begin_move_rows(
|
||||||
self: Pin<&mut PresentationModel>,
|
self: Pin<&mut PresentationModel>,
|
||||||
source_parent: &QModelIndex,
|
source_parent: &QModelIndex,
|
||||||
|
@ -130,20 +136,25 @@ pub mod presentation_model {
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endMoveRows"]
|
||||||
unsafe fn end_move_rows(self: Pin<&mut PresentationModel>);
|
unsafe fn end_move_rows(self: Pin<&mut PresentationModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endRemoveRows"]
|
||||||
unsafe fn end_remove_rows(self: Pin<&mut PresentationModel>);
|
unsafe fn end_remove_rows(self: Pin<&mut PresentationModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginResetModel"]
|
||||||
unsafe fn begin_reset_model(
|
unsafe fn begin_reset_model(
|
||||||
self: Pin<&mut PresentationModel>,
|
self: Pin<&mut PresentationModel>,
|
||||||
);
|
);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endResetModel"]
|
||||||
unsafe fn end_reset_model(self: Pin<&mut PresentationModel>);
|
unsafe fn end_reset_model(self: Pin<&mut PresentationModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "canFetchMore"]
|
||||||
fn can_fetch_more(
|
fn can_fetch_more(
|
||||||
self: &PresentationModel,
|
self: &PresentationModel,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -167,12 +178,14 @@ pub mod presentation_model {
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
#[cxx_override]
|
#[cxx_override]
|
||||||
|
#[cxx_name = "roleNames"]
|
||||||
fn role_names(
|
fn role_names(
|
||||||
self: &PresentationModel,
|
self: &PresentationModel,
|
||||||
) -> QHash_i32_QByteArray;
|
) -> QHash_i32_QByteArray;
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
#[cxx_override]
|
#[cxx_override]
|
||||||
|
#[cxx_name = "rowCount"]
|
||||||
fn row_count(
|
fn row_count(
|
||||||
self: &PresentationModel,
|
self: &PresentationModel,
|
||||||
_parent: &QModelIndex,
|
_parent: &QModelIndex,
|
||||||
|
@ -184,7 +197,7 @@ use crate::presentation_model::presentation_model::QMap_QString_QVariant;
|
||||||
use crate::reveal_js;
|
use crate::reveal_js;
|
||||||
use cxx_qt::CxxQtType;
|
use cxx_qt::CxxQtType;
|
||||||
use cxx_qt_lib::{QModelIndex, QString, QUrl, QVariant};
|
use cxx_qt_lib::{QModelIndex, QString, QUrl, QVariant};
|
||||||
use sqlx::{query, query_as, Connection, SqliteConnection};
|
use sqlx::{Connection, SqliteConnection, query, query_as};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
mod service_item_model {
|
mod service_item_model {
|
||||||
unsafe extern "C++" {
|
unsafe extern "C++" {
|
||||||
include!(< QAbstractListModel >);
|
include!(< QAbstractListModel >);
|
||||||
|
type QAbstractListModel;
|
||||||
include!("cxx-qt-lib/qhash.h");
|
include!("cxx-qt-lib/qhash.h");
|
||||||
type QHash_i32_QByteArray =
|
type QHash_i32_QByteArray =
|
||||||
cxx_qt_lib::QHash<cxx_qt_lib::QHashPair_i32_QByteArray>;
|
cxx_qt_lib::QHash<cxx_qt_lib::QHashPair_i32_QByteArray>;
|
||||||
|
@ -45,7 +46,7 @@ mod service_item_model {
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[qobject]
|
#[qobject]
|
||||||
#[base = "QAbstractListModel"]
|
#[base = QAbstractListModel]
|
||||||
#[qml_element]
|
#[qml_element]
|
||||||
#[qproperty(i32, count)]
|
#[qproperty(i32, count)]
|
||||||
#[qproperty(f32, save_progress)]
|
#[qproperty(f32, save_progress)]
|
||||||
|
@ -54,6 +55,7 @@ mod service_item_model {
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
#[qsignal]
|
#[qsignal]
|
||||||
|
#[cxx_name = "dataChanged"]
|
||||||
fn data_changed(
|
fn data_changed(
|
||||||
self: Pin<&mut ServiceItemModel>,
|
self: Pin<&mut ServiceItemModel>,
|
||||||
top_left: &QModelIndex,
|
top_left: &QModelIndex,
|
||||||
|
@ -193,6 +195,7 @@ mod service_item_model {
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginInsertRows"]
|
||||||
unsafe fn begin_insert_rows(
|
unsafe fn begin_insert_rows(
|
||||||
self: Pin<&mut ServiceItemModel>,
|
self: Pin<&mut ServiceItemModel>,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -201,9 +204,11 @@ mod service_item_model {
|
||||||
);
|
);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endInsertRows"]
|
||||||
unsafe fn end_insert_rows(self: Pin<&mut ServiceItemModel>);
|
unsafe fn end_insert_rows(self: Pin<&mut ServiceItemModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginRemoveRows"]
|
||||||
unsafe fn begin_remove_rows(
|
unsafe fn begin_remove_rows(
|
||||||
self: Pin<&mut ServiceItemModel>,
|
self: Pin<&mut ServiceItemModel>,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -212,6 +217,7 @@ mod service_item_model {
|
||||||
);
|
);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginMoveRows"]
|
||||||
unsafe fn begin_move_rows(
|
unsafe fn begin_move_rows(
|
||||||
self: Pin<&mut ServiceItemModel>,
|
self: Pin<&mut ServiceItemModel>,
|
||||||
source_parent: &QModelIndex,
|
source_parent: &QModelIndex,
|
||||||
|
@ -222,18 +228,23 @@ mod service_item_model {
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endMoveRows"]
|
||||||
unsafe fn end_move_rows(self: Pin<&mut ServiceItemModel>);
|
unsafe fn end_move_rows(self: Pin<&mut ServiceItemModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endRemoveRows"]
|
||||||
unsafe fn end_remove_rows(self: Pin<&mut ServiceItemModel>);
|
unsafe fn end_remove_rows(self: Pin<&mut ServiceItemModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginResetModel"]
|
||||||
unsafe fn begin_reset_model(self: Pin<&mut ServiceItemModel>);
|
unsafe fn begin_reset_model(self: Pin<&mut ServiceItemModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endResetModel"]
|
||||||
unsafe fn end_reset_model(self: Pin<&mut ServiceItemModel>);
|
unsafe fn end_reset_model(self: Pin<&mut ServiceItemModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "canFetchMore"]
|
||||||
fn can_fetch_more(
|
fn can_fetch_more(
|
||||||
self: &ServiceItemModel,
|
self: &ServiceItemModel,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -257,12 +268,14 @@ mod service_item_model {
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
#[cxx_override]
|
#[cxx_override]
|
||||||
|
#[cxx_name = "roleNames"]
|
||||||
fn role_names(
|
fn role_names(
|
||||||
self: &ServiceItemModel,
|
self: &ServiceItemModel,
|
||||||
) -> QHash_i32_QByteArray;
|
) -> QHash_i32_QByteArray;
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
#[cxx_override]
|
#[cxx_override]
|
||||||
|
#[cxx_name = "rowCount"]
|
||||||
fn row_count(
|
fn row_count(
|
||||||
self: &ServiceItemModel,
|
self: &ServiceItemModel,
|
||||||
_parent: &QModelIndex,
|
_parent: &QModelIndex,
|
||||||
|
@ -277,7 +290,7 @@ use self::service_item_model::{
|
||||||
};
|
};
|
||||||
use crate::service_item_model::service_item_model::QList_QString;
|
use crate::service_item_model::service_item_model::QList_QString;
|
||||||
use crate::slide_types::SlideType;
|
use crate::slide_types::SlideType;
|
||||||
use crate::songs::song_model::{get_song, Song};
|
use crate::songs::song_model::{Song, get_song};
|
||||||
use crate::{image_model, presentation_model, video_model};
|
use crate::{image_model, presentation_model, video_model};
|
||||||
use cxx_qt::{CxxQtType, Threading};
|
use cxx_qt::{CxxQtType, Threading};
|
||||||
use cxx_qt_lib::{
|
use cxx_qt_lib::{
|
||||||
|
@ -285,7 +298,7 @@ use cxx_qt_lib::{
|
||||||
};
|
};
|
||||||
use dirs;
|
use dirs;
|
||||||
// use lumina_core::service_items::ServiceItem as SI;
|
// use lumina_core::service_items::ServiceItem as SI;
|
||||||
use serde_json::{json, Value};
|
use serde_json::{Value, json};
|
||||||
use std::iter;
|
use std::iter;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
@ -1295,7 +1308,9 @@ impl service_item_model::ServiceItemModel {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
self.as_mut().add_service_item(&service_item);
|
self.as_mut().add_service_item(&service_item);
|
||||||
error!("Loaded service item with generic type since it was an unknown type.");
|
error!(
|
||||||
|
"Loaded service item with generic type since it was an unknown type."
|
||||||
|
);
|
||||||
// // files implement the Read trait
|
// // files implement the Read trait
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
pub mod slide_model {
|
pub mod slide_model {
|
||||||
unsafe extern "C++" {
|
unsafe extern "C++" {
|
||||||
include!(< QAbstractListModel >);
|
include!(< QAbstractListModel >);
|
||||||
|
type QAbstractListModel;
|
||||||
include!("cxx-qt-lib/qhash.h");
|
include!("cxx-qt-lib/qhash.h");
|
||||||
type QHash_i32_QByteArray =
|
type QHash_i32_QByteArray =
|
||||||
cxx_qt_lib::QHash<cxx_qt_lib::QHashPair_i32_QByteArray>;
|
cxx_qt_lib::QHash<cxx_qt_lib::QHashPair_i32_QByteArray>;
|
||||||
|
@ -18,20 +19,23 @@ pub mod slide_model {
|
||||||
type QVector_i32 = cxx_qt_lib::QVector<i32>;
|
type QVector_i32 = cxx_qt_lib::QVector<i32>;
|
||||||
include!("cxx-qt-lib/qlist.h");
|
include!("cxx-qt-lib/qlist.h");
|
||||||
type QList_QString = cxx_qt_lib::QList<QString>;
|
type QList_QString = cxx_qt_lib::QList<QString>;
|
||||||
include!("cxx-qt-gen/slide_object.cxxqt.h");
|
include!("src/rust/slide_object.cxxqt.h");
|
||||||
type SlideObject =
|
type SlideObject = crate::slide_object::qobject::SlideObject;
|
||||||
crate::slide_object::slide_object::SlideObject;
|
include!("src/rust/songs/song_model.cxxqt.h");
|
||||||
include!("cxx-qt-gen/song_model.cxxqt.h");
|
|
||||||
type SongModel =
|
type SongModel =
|
||||||
crate::songs::song_model::song_model::SongModel;
|
crate::songs::song_model::song_model::SongModel;
|
||||||
include!("cxx-qt-gen/video_model.cxxqt.h");
|
include!("src/rust/video_model.cxxqt.h");
|
||||||
type VideoModel = crate::video_model::video_model::VideoModel;
|
type VideoModel = crate::video_model::video_model::VideoModel;
|
||||||
include!("cxx-qt-gen/image_model.cxxqt.h");
|
include!("src/rust/image_model.cxxqt.h");
|
||||||
type ImageModel = crate::image_model::image_model::ImageModel;
|
type ImageModel = crate::image_model::image_model::ImageModel;
|
||||||
include!("cxx-qt-gen/presentation_model.cxxqt.h");
|
include!("src/rust/presentation_model.cxxqt.h");
|
||||||
type PresentationModel = crate::presentation_model::presentation_model::PresentationModel;
|
type PresentationModel = crate::presentation_model::presentation_model::PresentationModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// extern "C++" {
|
||||||
|
// type SlideObject = crate::slide_object::qobject::SlideObject;
|
||||||
|
// }
|
||||||
|
|
||||||
#[qenum(SlideModel)]
|
#[qenum(SlideModel)]
|
||||||
enum SlideRoles {
|
enum SlideRoles {
|
||||||
Ty,
|
Ty,
|
||||||
|
@ -58,7 +62,7 @@ pub mod slide_model {
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[qobject]
|
#[qobject]
|
||||||
#[base = "QAbstractListModel"]
|
#[base = QAbstractListModel]
|
||||||
#[qml_element]
|
#[qml_element]
|
||||||
#[qproperty(i32, count)]
|
#[qproperty(i32, count)]
|
||||||
#[qproperty(*mut SlideObject, slide_object)]
|
#[qproperty(*mut SlideObject, slide_object)]
|
||||||
|
@ -70,6 +74,7 @@ pub mod slide_model {
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
#[qsignal]
|
#[qsignal]
|
||||||
|
#[cxx_name = "dataChanged"]
|
||||||
fn data_changed(
|
fn data_changed(
|
||||||
self: Pin<&mut SlideModel>,
|
self: Pin<&mut SlideModel>,
|
||||||
top_left: &QModelIndex,
|
top_left: &QModelIndex,
|
||||||
|
@ -155,6 +160,7 @@ pub mod slide_model {
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginInsertRows"]
|
||||||
unsafe fn begin_insert_rows(
|
unsafe fn begin_insert_rows(
|
||||||
self: Pin<&mut SlideModel>,
|
self: Pin<&mut SlideModel>,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -163,9 +169,11 @@ pub mod slide_model {
|
||||||
);
|
);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endInsertRows"]
|
||||||
unsafe fn end_insert_rows(self: Pin<&mut SlideModel>);
|
unsafe fn end_insert_rows(self: Pin<&mut SlideModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginRemoveRows"]
|
||||||
unsafe fn begin_remove_rows(
|
unsafe fn begin_remove_rows(
|
||||||
self: Pin<&mut SlideModel>,
|
self: Pin<&mut SlideModel>,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -174,15 +182,19 @@ pub mod slide_model {
|
||||||
);
|
);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endRemoveRows"]
|
||||||
unsafe fn end_remove_rows(self: Pin<&mut SlideModel>);
|
unsafe fn end_remove_rows(self: Pin<&mut SlideModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginResetModel"]
|
||||||
unsafe fn begin_reset_model(self: Pin<&mut SlideModel>);
|
unsafe fn begin_reset_model(self: Pin<&mut SlideModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endResetModel"]
|
||||||
unsafe fn end_reset_model(self: Pin<&mut SlideModel>);
|
unsafe fn end_reset_model(self: Pin<&mut SlideModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginMoveRows"]
|
||||||
unsafe fn begin_move_rows(
|
unsafe fn begin_move_rows(
|
||||||
self: Pin<&mut SlideModel>,
|
self: Pin<&mut SlideModel>,
|
||||||
source_parent: &QModelIndex,
|
source_parent: &QModelIndex,
|
||||||
|
@ -193,9 +205,11 @@ pub mod slide_model {
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endMoveRows"]
|
||||||
unsafe fn end_move_rows(self: Pin<&mut SlideModel>);
|
unsafe fn end_move_rows(self: Pin<&mut SlideModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "canFetchMore"]
|
||||||
fn can_fetch_more(
|
fn can_fetch_more(
|
||||||
self: &SlideModel,
|
self: &SlideModel,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -219,10 +233,12 @@ pub mod slide_model {
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
#[cxx_override]
|
#[cxx_override]
|
||||||
|
#[cxx_name = "roleNames"]
|
||||||
fn role_names(self: &SlideModel) -> QHash_i32_QByteArray;
|
fn role_names(self: &SlideModel) -> QHash_i32_QByteArray;
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
#[cxx_override]
|
#[cxx_override]
|
||||||
|
#[cxx_name = "rowCount"]
|
||||||
fn row_count(self: &SlideModel, _parent: &QModelIndex)
|
fn row_count(self: &SlideModel, _parent: &QModelIndex)
|
||||||
-> i32;
|
-> i32;
|
||||||
|
|
||||||
|
@ -238,12 +254,12 @@ use crate::presentation_model::{
|
||||||
};
|
};
|
||||||
use crate::slide_model::slide_model::QList_QString;
|
use crate::slide_model::slide_model::QList_QString;
|
||||||
use crate::songs::song_model::song_model::{self, SongModel};
|
use crate::songs::song_model::song_model::{self, SongModel};
|
||||||
use crate::songs::song_model::{get_song, Song, SongModelRust};
|
use crate::songs::song_model::{Song, SongModelRust, get_song};
|
||||||
use crate::video_model::video_model::VideoModel;
|
use crate::video_model::video_model::VideoModel;
|
||||||
use crate::video_model::{self, Video, VideoModelRust};
|
use crate::video_model::{self, Video, VideoModelRust};
|
||||||
use crate::{ffmpeg, slide_types::SlideType};
|
use crate::{ffmpeg, slide_types::SlideType};
|
||||||
use color_eyre::eyre::Result;
|
|
||||||
use color_eyre::Section;
|
use color_eyre::Section;
|
||||||
|
use color_eyre::eyre::Result;
|
||||||
use cxx_qt::{CxxQtType, Threading};
|
use cxx_qt::{CxxQtType, Threading};
|
||||||
use cxx_qt_lib::{
|
use cxx_qt_lib::{
|
||||||
CaseSensitivity, QByteArray, QList, QModelIndex, QString,
|
CaseSensitivity, QByteArray, QList, QModelIndex, QString,
|
||||||
|
@ -324,7 +340,9 @@ impl Display for ParseSlideError {
|
||||||
f: &mut std::fmt::Formatter<'_>,
|
f: &mut std::fmt::Formatter<'_>,
|
||||||
) -> std::fmt::Result {
|
) -> std::fmt::Result {
|
||||||
let message = match self {
|
let message = match self {
|
||||||
Self::UnknownType => "The type does not exist. It needs to be one of 'song', 'video', 'image', 'presentation', or 'content'",
|
Self::UnknownType => {
|
||||||
|
"The type does not exist. It needs to be one of 'song', 'video', 'image', 'presentation', or 'content'"
|
||||||
|
}
|
||||||
};
|
};
|
||||||
write!(f, "Error: {message}")
|
write!(f, "Error: {message}")
|
||||||
}
|
}
|
||||||
|
@ -798,7 +816,9 @@ impl slide_model::SlideModel {
|
||||||
// Change the service_item_id of the moved slide
|
// Change the service_item_id of the moved slide
|
||||||
if count > 1 {
|
if count > 1 {
|
||||||
if move_down {
|
if move_down {
|
||||||
debug!("While moving down, change service items id of moved slide");
|
debug!(
|
||||||
|
"While moving down, change service items id of moved slide"
|
||||||
|
);
|
||||||
for (i, _slide) in slides_iter
|
for (i, _slide) in slides_iter
|
||||||
.clone()
|
.clone()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
|
@ -816,13 +836,16 @@ impl slide_model::SlideModel {
|
||||||
debug!(
|
debug!(
|
||||||
?slide,
|
?slide,
|
||||||
"rust: these ones right here officer. from {:?} to {:?}",
|
"rust: these ones right here officer. from {:?} to {:?}",
|
||||||
slide.service_item_id, destination_index
|
slide.service_item_id,
|
||||||
|
destination_index
|
||||||
);
|
);
|
||||||
slide.service_item_id = destination_index;
|
slide.service_item_id = destination_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debug!("While moving up, change service items id of moved slide");
|
debug!(
|
||||||
|
"While moving up, change service items id of moved slide"
|
||||||
|
);
|
||||||
for (i, _slide) in slides_iter
|
for (i, _slide) in slides_iter
|
||||||
.clone()
|
.clone()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
|
@ -835,7 +858,8 @@ impl slide_model::SlideModel {
|
||||||
debug!(
|
debug!(
|
||||||
?slide,
|
?slide,
|
||||||
"rust: these ones right here officer. from {:?} to {:?}",
|
"rust: these ones right here officer. from {:?} to {:?}",
|
||||||
slide.service_item_id, destination_index
|
slide.service_item_id,
|
||||||
|
destination_index
|
||||||
);
|
);
|
||||||
slide.service_item_id = destination_index;
|
slide.service_item_id = destination_index;
|
||||||
}
|
}
|
||||||
|
@ -907,7 +931,9 @@ impl slide_model::SlideModel {
|
||||||
// self.as_mut().end_reset_model();
|
// self.as_mut().end_reset_model();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
debug!("rust-move: {first_slide} to {dest_slide} with {count} slides");
|
debug!(
|
||||||
|
"rust-move: {first_slide} to {dest_slide} with {count} slides"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn move_items(
|
fn move_items(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#[cxx_qt::bridge]
|
#[cxx_qt::bridge]
|
||||||
pub mod slide_object {
|
pub mod qobject {
|
||||||
unsafe extern "C++" {
|
unsafe extern "C++" {
|
||||||
include!("cxx-qt-lib/qstring.h");
|
include!("cxx-qt-lib/qstring.h");
|
||||||
type QString = cxx_qt_lib::QString;
|
type QString = cxx_qt_lib::QString;
|
||||||
|
@ -11,6 +11,28 @@ pub mod slide_object {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
|
#[qobject]
|
||||||
|
#[qml_element]
|
||||||
|
#[qproperty(i32, slide_index)]
|
||||||
|
#[qproperty(i32, slide_size)]
|
||||||
|
#[qproperty(i32, inner_slide_index)]
|
||||||
|
#[qproperty(bool, is_playing)]
|
||||||
|
#[qproperty(bool, looping)]
|
||||||
|
#[qproperty(QString, text)]
|
||||||
|
#[qproperty(QString, ty)]
|
||||||
|
#[qproperty(QString, audio)]
|
||||||
|
#[qproperty(QString, image_background)]
|
||||||
|
#[qproperty(QString, video_background)]
|
||||||
|
#[qproperty(bool, html)]
|
||||||
|
#[qproperty(QString, vtext_alignment)]
|
||||||
|
#[qproperty(QString, htext_alignment)]
|
||||||
|
#[qproperty(QString, font)]
|
||||||
|
#[qproperty(i32, font_size)]
|
||||||
|
#[qproperty(f32, video_start_time)]
|
||||||
|
#[qproperty(f32, video_end_time)]
|
||||||
|
// #[qproperty(*mut SlideModel, slide_model)]
|
||||||
|
type SlideObject = super::SlideObjectRust;
|
||||||
|
|
||||||
#[qsignal]
|
#[qsignal]
|
||||||
fn playing_changed(
|
fn playing_changed(
|
||||||
self: Pin<&mut SlideObject>,
|
self: Pin<&mut SlideObject>,
|
||||||
|
@ -35,28 +57,6 @@ pub mod slide_object {
|
||||||
#[qsignal]
|
#[qsignal]
|
||||||
fn reveal_prev(self: Pin<&mut SlideObject>);
|
fn reveal_prev(self: Pin<&mut SlideObject>);
|
||||||
|
|
||||||
#[qobject]
|
|
||||||
#[qml_element]
|
|
||||||
#[qproperty(i32, slide_index)]
|
|
||||||
#[qproperty(i32, slide_size)]
|
|
||||||
#[qproperty(i32, inner_slide_index)]
|
|
||||||
#[qproperty(bool, is_playing)]
|
|
||||||
#[qproperty(bool, looping)]
|
|
||||||
#[qproperty(QString, text)]
|
|
||||||
#[qproperty(QString, ty)]
|
|
||||||
#[qproperty(QString, audio)]
|
|
||||||
#[qproperty(QString, image_background)]
|
|
||||||
#[qproperty(QString, video_background)]
|
|
||||||
#[qproperty(bool, html)]
|
|
||||||
#[qproperty(QString, vtext_alignment)]
|
|
||||||
#[qproperty(QString, htext_alignment)]
|
|
||||||
#[qproperty(QString, font)]
|
|
||||||
#[qproperty(i32, font_size)]
|
|
||||||
#[qproperty(f32, video_start_time)]
|
|
||||||
#[qproperty(f32, video_end_time)]
|
|
||||||
// #[qproperty(*mut SlideModel, slide_model)]
|
|
||||||
type SlideObject = super::SlideObjectRust;
|
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
fn change_slide(
|
fn change_slide(
|
||||||
self: Pin<&mut SlideObject>,
|
self: Pin<&mut SlideObject>,
|
||||||
|
@ -89,11 +89,11 @@ use cxx_qt_lib::{CaseSensitivity, QString, QVariant};
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
slide_model::{slide_model, Slide},
|
slide_model::{Slide, slide_model},
|
||||||
slide_types::SlideType,
|
slide_types::SlideType,
|
||||||
};
|
};
|
||||||
|
|
||||||
use self::slide_object::QMap_QString_QVariant;
|
use self::qobject::QMap_QString_QVariant;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct SlideObjectRust {
|
pub struct SlideObjectRust {
|
||||||
|
@ -142,7 +142,7 @@ impl Default for SlideObjectRust {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl slide_object::SlideObject {
|
impl qobject::SlideObject {
|
||||||
pub fn change_slide(
|
pub fn change_slide(
|
||||||
mut self: Pin<&mut Self>,
|
mut self: Pin<&mut Self>,
|
||||||
item: QMap_QString_QVariant,
|
item: QMap_QString_QVariant,
|
||||||
|
|
|
@ -15,7 +15,7 @@ pub mod song_editor {
|
||||||
include!("cxx-qt-lib/qlist.h");
|
include!("cxx-qt-lib/qlist.h");
|
||||||
type QList_QString = cxx_qt_lib::QList<QString>;
|
type QList_QString = cxx_qt_lib::QList<QString>;
|
||||||
|
|
||||||
include!("cxx-qt-gen/song_model.cxxqt.h");
|
include!("src/rust/songs/song_model.cxxqt.h");
|
||||||
type SongModel =
|
type SongModel =
|
||||||
crate::songs::song_model::song_model::SongModel;
|
crate::songs::song_model::song_model::SongModel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
pub mod song_model {
|
pub mod song_model {
|
||||||
unsafe extern "C++" {
|
unsafe extern "C++" {
|
||||||
include!(< QAbstractListModel >);
|
include!(< QAbstractListModel >);
|
||||||
|
type QAbstractListModel;
|
||||||
include!("cxx-qt-lib/qhash.h");
|
include!("cxx-qt-lib/qhash.h");
|
||||||
type QHash_i32_QByteArray =
|
type QHash_i32_QByteArray =
|
||||||
cxx_qt_lib::QHash<cxx_qt_lib::QHashPair_i32_QByteArray>;
|
cxx_qt_lib::QHash<cxx_qt_lib::QHashPair_i32_QByteArray>;
|
||||||
|
@ -41,13 +42,14 @@ pub mod song_model {
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[qobject]
|
#[qobject]
|
||||||
#[base = "QAbstractListModel"]
|
#[base = QAbstractListModel]
|
||||||
#[qml_element]
|
#[qml_element]
|
||||||
#[qproperty(i32, count)]
|
#[qproperty(i32, count)]
|
||||||
type SongModel = super::SongModelRust;
|
type SongModel = super::SongModelRust;
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
#[qsignal]
|
#[qsignal]
|
||||||
|
#[cxx_name = "dataChanged"]
|
||||||
fn data_changed(
|
fn data_changed(
|
||||||
self: Pin<&mut SongModel>,
|
self: Pin<&mut SongModel>,
|
||||||
top_left: &QModelIndex,
|
top_left: &QModelIndex,
|
||||||
|
@ -168,6 +170,7 @@ pub mod song_model {
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginInsertRows"]
|
||||||
unsafe fn begin_insert_rows(
|
unsafe fn begin_insert_rows(
|
||||||
self: Pin<&mut SongModel>,
|
self: Pin<&mut SongModel>,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -176,9 +179,11 @@ pub mod song_model {
|
||||||
);
|
);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endInsertRows"]
|
||||||
unsafe fn end_insert_rows(self: Pin<&mut SongModel>);
|
unsafe fn end_insert_rows(self: Pin<&mut SongModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginRemoveRows"]
|
||||||
unsafe fn begin_remove_rows(
|
unsafe fn begin_remove_rows(
|
||||||
self: Pin<&mut SongModel>,
|
self: Pin<&mut SongModel>,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -187,6 +192,7 @@ pub mod song_model {
|
||||||
);
|
);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginMoveRows"]
|
||||||
unsafe fn begin_move_rows(
|
unsafe fn begin_move_rows(
|
||||||
self: Pin<&mut SongModel>,
|
self: Pin<&mut SongModel>,
|
||||||
source_parent: &QModelIndex,
|
source_parent: &QModelIndex,
|
||||||
|
@ -197,18 +203,23 @@ pub mod song_model {
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endMoveRows"]
|
||||||
unsafe fn end_move_rows(self: Pin<&mut SongModel>);
|
unsafe fn end_move_rows(self: Pin<&mut SongModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endRemoveRows"]
|
||||||
unsafe fn end_remove_rows(self: Pin<&mut SongModel>);
|
unsafe fn end_remove_rows(self: Pin<&mut SongModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginResetModel"]
|
||||||
unsafe fn begin_reset_model(self: Pin<&mut SongModel>);
|
unsafe fn begin_reset_model(self: Pin<&mut SongModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endResetModel"]
|
||||||
unsafe fn end_reset_model(self: Pin<&mut SongModel>);
|
unsafe fn end_reset_model(self: Pin<&mut SongModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "canFetchMore"]
|
||||||
fn can_fetch_more(
|
fn can_fetch_more(
|
||||||
self: &SongModel,
|
self: &SongModel,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -232,10 +243,12 @@ pub mod song_model {
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
#[cxx_override]
|
#[cxx_override]
|
||||||
|
#[cxx_name = "roleNames"]
|
||||||
fn role_names(self: &SongModel) -> QHash_i32_QByteArray;
|
fn role_names(self: &SongModel) -> QHash_i32_QByteArray;
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
#[cxx_override]
|
#[cxx_override]
|
||||||
|
#[cxx_name = "rowCount"]
|
||||||
fn row_count(self: &SongModel, _parent: &QModelIndex) -> i32;
|
fn row_count(self: &SongModel, _parent: &QModelIndex) -> i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,7 +259,7 @@ use cxx_qt::{CxxQtType, Threading};
|
||||||
use cxx_qt_lib::{
|
use cxx_qt_lib::{
|
||||||
QByteArray, QModelIndex, QString, QStringList, QVariant,
|
QByteArray, QModelIndex, QString, QStringList, QVariant,
|
||||||
};
|
};
|
||||||
use sqlx::{query, query_as, Connection, SqliteConnection};
|
use sqlx::{Connection, SqliteConnection, query, query_as};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
@ -592,7 +605,11 @@ impl song_model::SongModel {
|
||||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||||
let db_string = updated_title.clone().to_string();
|
let db_string = updated_title.clone().to_string();
|
||||||
rt.block_on(async {
|
rt.block_on(async {
|
||||||
let result = query!("UPDATE songs SET title = ? where id = ?", db_string, song_id)
|
let result = query!(
|
||||||
|
"UPDATE songs SET title = ? where id = ?",
|
||||||
|
db_string,
|
||||||
|
song_id
|
||||||
|
)
|
||||||
.execute(&mut self.as_mut().rust_mut().db)
|
.execute(&mut self.as_mut().rust_mut().db)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
@ -601,7 +618,10 @@ impl song_model::SongModel {
|
||||||
if let Some(song) =
|
if let Some(song) =
|
||||||
self.as_mut().rust_mut().songs.get_mut(index)
|
self.as_mut().rust_mut().songs.get_mut(index)
|
||||||
{
|
{
|
||||||
debug!(?song, title = updated_title.to_string());
|
debug!(
|
||||||
|
?song,
|
||||||
|
title = updated_title.to_string()
|
||||||
|
);
|
||||||
song.title = updated_title.to_string();
|
song.title = updated_title.to_string();
|
||||||
self.as_mut().data_changed(
|
self.as_mut().data_changed(
|
||||||
&model_index,
|
&model_index,
|
||||||
|
@ -614,9 +634,11 @@ impl song_model::SongModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("There was an error updating title in db: {e}");
|
error!(
|
||||||
|
"There was an error updating title in db: {e}"
|
||||||
|
);
|
||||||
false
|
false
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
true
|
true
|
||||||
|
@ -720,7 +742,11 @@ impl song_model::SongModel {
|
||||||
let db_string = updated_audio.clone().to_string();
|
let db_string = updated_audio.clone().to_string();
|
||||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||||
rt.block_on(async {
|
rt.block_on(async {
|
||||||
let result = query!("UPDATE songs SET audio = ? where id = ?", db_string, song_id)
|
let result = query!(
|
||||||
|
"UPDATE songs SET audio = ? where id = ?",
|
||||||
|
db_string,
|
||||||
|
song_id
|
||||||
|
)
|
||||||
.execute(&mut self.as_mut().rust_mut().db)
|
.execute(&mut self.as_mut().rust_mut().db)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
@ -745,9 +771,11 @@ impl song_model::SongModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("There was an error updating audio in db: {e}");
|
error!(
|
||||||
|
"There was an error updating audio in db: {e}"
|
||||||
|
);
|
||||||
false
|
false
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
true
|
true
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
pub mod video_model {
|
pub mod video_model {
|
||||||
unsafe extern "C++" {
|
unsafe extern "C++" {
|
||||||
include!(< QAbstractListModel >);
|
include!(< QAbstractListModel >);
|
||||||
|
type QAbstractListModel;
|
||||||
include!("cxx-qt-lib/qhash.h");
|
include!("cxx-qt-lib/qhash.h");
|
||||||
type QHash_i32_QByteArray =
|
type QHash_i32_QByteArray =
|
||||||
cxx_qt_lib::QHash<cxx_qt_lib::QHashPair_i32_QByteArray>;
|
cxx_qt_lib::QHash<cxx_qt_lib::QHashPair_i32_QByteArray>;
|
||||||
|
@ -36,13 +37,14 @@ pub mod video_model {
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[qobject]
|
#[qobject]
|
||||||
#[base = "QAbstractListModel"]
|
#[base = QAbstractListModel]
|
||||||
#[qml_element]
|
#[qml_element]
|
||||||
#[qproperty(i32, count)]
|
#[qproperty(i32, count)]
|
||||||
type VideoModel = super::VideoModelRust;
|
type VideoModel = super::VideoModelRust;
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
#[qsignal]
|
#[qsignal]
|
||||||
|
#[cxx_name = "dataChanged"]
|
||||||
fn data_changed(
|
fn data_changed(
|
||||||
self: Pin<&mut VideoModel>,
|
self: Pin<&mut VideoModel>,
|
||||||
top_left: &QModelIndex,
|
top_left: &QModelIndex,
|
||||||
|
@ -104,6 +106,7 @@ pub mod video_model {
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginInsertRows"]
|
||||||
unsafe fn begin_insert_rows(
|
unsafe fn begin_insert_rows(
|
||||||
self: Pin<&mut VideoModel>,
|
self: Pin<&mut VideoModel>,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -112,9 +115,11 @@ pub mod video_model {
|
||||||
);
|
);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endInsertRows"]
|
||||||
unsafe fn end_insert_rows(self: Pin<&mut VideoModel>);
|
unsafe fn end_insert_rows(self: Pin<&mut VideoModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginRemoveRows"]
|
||||||
unsafe fn begin_remove_rows(
|
unsafe fn begin_remove_rows(
|
||||||
self: Pin<&mut VideoModel>,
|
self: Pin<&mut VideoModel>,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -123,6 +128,7 @@ pub mod video_model {
|
||||||
);
|
);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginMoveRows"]
|
||||||
unsafe fn begin_move_rows(
|
unsafe fn begin_move_rows(
|
||||||
self: Pin<&mut VideoModel>,
|
self: Pin<&mut VideoModel>,
|
||||||
source_parent: &QModelIndex,
|
source_parent: &QModelIndex,
|
||||||
|
@ -133,18 +139,23 @@ pub mod video_model {
|
||||||
) -> bool;
|
) -> bool;
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endMoveRows"]
|
||||||
unsafe fn end_move_rows(self: Pin<&mut VideoModel>);
|
unsafe fn end_move_rows(self: Pin<&mut VideoModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endRemoveRows"]
|
||||||
unsafe fn end_remove_rows(self: Pin<&mut VideoModel>);
|
unsafe fn end_remove_rows(self: Pin<&mut VideoModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "beginResetModel"]
|
||||||
unsafe fn begin_reset_model(self: Pin<&mut VideoModel>);
|
unsafe fn begin_reset_model(self: Pin<&mut VideoModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "endResetModel"]
|
||||||
unsafe fn end_reset_model(self: Pin<&mut VideoModel>);
|
unsafe fn end_reset_model(self: Pin<&mut VideoModel>);
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
|
#[cxx_name = "canFetchMore"]
|
||||||
fn can_fetch_more(
|
fn can_fetch_more(
|
||||||
self: &VideoModel,
|
self: &VideoModel,
|
||||||
parent: &QModelIndex,
|
parent: &QModelIndex,
|
||||||
|
@ -168,10 +179,12 @@ pub mod video_model {
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
#[cxx_override]
|
#[cxx_override]
|
||||||
|
#[cxx_name = "roleNames"]
|
||||||
fn role_names(self: &VideoModel) -> QHash_i32_QByteArray;
|
fn role_names(self: &VideoModel) -> QHash_i32_QByteArray;
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
#[cxx_override]
|
#[cxx_override]
|
||||||
|
#[cxx_name = "rowCount"]
|
||||||
fn row_count(self: &VideoModel, _parent: &QModelIndex)
|
fn row_count(self: &VideoModel, _parent: &QModelIndex)
|
||||||
-> i32;
|
-> i32;
|
||||||
|
|
||||||
|
@ -181,7 +194,7 @@ pub mod video_model {
|
||||||
use color_eyre::eyre::Error;
|
use color_eyre::eyre::Error;
|
||||||
use cxx_qt::{CxxQtType, Threading};
|
use cxx_qt::{CxxQtType, Threading};
|
||||||
use cxx_qt_lib::{QByteArray, QModelIndex, QString, QUrl, QVariant};
|
use cxx_qt_lib::{QByteArray, QModelIndex, QString, QUrl, QVariant};
|
||||||
use sqlx::{query, query_as, Connection, SqliteConnection};
|
use sqlx::{Connection, SqliteConnection, query, query_as};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue