a complete removal of diesel
This commit is contained in:
parent
ee03777c10
commit
444df4eacc
9 changed files with 40 additions and 545 deletions
|
@ -1,11 +1,9 @@
|
|||
pub mod ffmpeg;
|
||||
pub mod file_helper;
|
||||
pub mod image_model;
|
||||
pub mod models;
|
||||
pub mod obs;
|
||||
pub mod presentation_model;
|
||||
pub mod reveal_js;
|
||||
pub mod schema;
|
||||
pub mod service_item_model;
|
||||
pub mod settings;
|
||||
pub mod slide_model;
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
use diesel::prelude::*;
|
||||
use diesel::sqlite::SqliteConnection;
|
||||
use diesel_migrations::{
|
||||
embed_migrations, EmbeddedMigrations, MigrationHarness,
|
||||
};
|
||||
|
||||
pub const MIGRATIONS: EmbeddedMigrations =
|
||||
embed_migrations!("src/rust/migrations");
|
||||
|
||||
pub fn run_migrations(conn: &mut SqliteConnection) -> bool {
|
||||
conn.run_pending_migrations(MIGRATIONS).unwrap();
|
||||
true
|
||||
}
|
||||
|
||||
#[derive(Queryable)]
|
||||
pub struct Image {
|
||||
pub id: i32,
|
||||
pub title: String,
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
#[derive(Queryable)]
|
||||
pub struct Video {
|
||||
pub id: i32,
|
||||
pub title: String,
|
||||
pub path: String,
|
||||
pub start_time: Option<f32>,
|
||||
pub end_time: Option<f32>,
|
||||
pub looping: bool,
|
||||
}
|
||||
|
||||
#[derive(Queryable)]
|
||||
pub struct Presentation {
|
||||
pub id: i32,
|
||||
pub title: String,
|
||||
pub path: String,
|
||||
pub page_count: Option<i32>,
|
||||
pub html: bool,
|
||||
}
|
||||
|
||||
#[derive(Queryable)]
|
||||
pub struct Song {
|
||||
pub id: i32,
|
||||
pub title: String,
|
||||
pub lyrics: Option<String>,
|
||||
pub author: Option<String>,
|
||||
pub ccli: Option<String>,
|
||||
pub audio: Option<String>,
|
||||
pub verse_order: Option<String>,
|
||||
pub background: Option<String>,
|
||||
pub background_type: Option<String>,
|
||||
pub horizontal_text_alignment: Option<String>,
|
||||
pub vertical_text_alignment: Option<String>,
|
||||
pub font: Option<String>,
|
||||
pub font_size: Option<i32>,
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
// @generated automatically by Diesel CLI.
|
||||
|
||||
diesel::table! {
|
||||
images (id) {
|
||||
id -> Integer,
|
||||
title -> Text,
|
||||
#[sql_name = "filePath"]
|
||||
path -> Text,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
presentations (id) {
|
||||
id -> Integer,
|
||||
title -> Text,
|
||||
#[sql_name = "filePath"]
|
||||
path -> Text,
|
||||
#[sql_name = "pageCount"]
|
||||
page_count -> Nullable<Integer>,
|
||||
html -> Bool,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
songs (id) {
|
||||
id -> Integer,
|
||||
title -> Text,
|
||||
lyrics -> Nullable<Text>,
|
||||
author -> Nullable<Text>,
|
||||
ccli -> Nullable<Text>,
|
||||
audio -> Nullable<Text>,
|
||||
#[sql_name = "vorder"]
|
||||
verse_order -> Nullable<Text>,
|
||||
background -> Nullable<Text>,
|
||||
#[sql_name = "backgroundType"]
|
||||
background_type -> Nullable<Text>,
|
||||
#[sql_name = "horizontalTextAlignment"]
|
||||
horizontal_text_alignment -> Nullable<Text>,
|
||||
#[sql_name = "verticalTextAlignment"]
|
||||
vertical_text_alignment -> Nullable<Text>,
|
||||
font -> Nullable<Text>,
|
||||
#[sql_name = "fontSize"]
|
||||
font_size -> Nullable<Integer>,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
videos (id) {
|
||||
id -> Integer,
|
||||
title -> Text,
|
||||
#[sql_name = "filePath"]
|
||||
path -> Text,
|
||||
#[sql_name = "startTime"]
|
||||
start_time -> Nullable<Float>,
|
||||
#[sql_name = "endTime"]
|
||||
end_time -> Nullable<Float>,
|
||||
#[sql_name = "loop"]
|
||||
looping -> Bool,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::allow_tables_to_appear_in_same_query!(
|
||||
images,
|
||||
presentations,
|
||||
songs,
|
||||
videos,
|
||||
);
|
|
@ -290,7 +290,6 @@ mod service_item_model {
|
|||
}
|
||||
}
|
||||
|
||||
use crate::obs::Obs;
|
||||
use crate::service_item_model::service_item_model::QList_QString;
|
||||
use cxx_qt::{CxxQtType, Threading};
|
||||
use cxx_qt_lib::{
|
||||
|
@ -359,7 +358,6 @@ impl Default for ServiceItem {
|
|||
pub struct ServiceItemModelRust {
|
||||
id: i32,
|
||||
service_items: Vec<ServiceItem>,
|
||||
obs: Option<Obs>,
|
||||
count: i32,
|
||||
save_progress: f32,
|
||||
saved: bool,
|
||||
|
@ -367,20 +365,9 @@ pub struct ServiceItemModelRust {
|
|||
|
||||
impl Default for ServiceItemModelRust {
|
||||
fn default() -> Self {
|
||||
let obs =
|
||||
tokio::runtime::Runtime::new().unwrap().block_on(async {
|
||||
match Obs::new().await {
|
||||
Ok(o) => Some(o),
|
||||
Err(e) => {
|
||||
error!(e);
|
||||
None
|
||||
}
|
||||
}
|
||||
});
|
||||
Self {
|
||||
id: 0,
|
||||
service_items: Vec::new(),
|
||||
obs,
|
||||
count: 0,
|
||||
save_progress: 0.0,
|
||||
saved: false,
|
||||
|
@ -823,7 +810,6 @@ impl service_item_model::ServiceItemModel {
|
|||
// println!("service_item is deactivating {:?}", i);
|
||||
service_item.active = false;
|
||||
}
|
||||
let _obs = self.as_mut().obs.clone();
|
||||
|
||||
if let Some(service_item) = self
|
||||
.as_mut()
|
||||
|
@ -837,14 +823,6 @@ impl service_item_model::ServiceItemModel {
|
|||
background_type = ?service_item.background_type,
|
||||
kind = ?service_item.ty);
|
||||
service_item.active = true;
|
||||
// if let Some(obs) = obs {
|
||||
// match obs
|
||||
// .set_scene(service_item.obs_scene.to_string())
|
||||
// {
|
||||
// Ok(()) => debug!("Successfully set scene"),
|
||||
// Err(e) => error!(e),
|
||||
// }
|
||||
// }
|
||||
self.as_mut().data_changed(tl, br, &vector_roles);
|
||||
// We use this signal generated by our signals enum to tell QML that
|
||||
// the active service_item has changed which is used to reposition views.
|
||||
|
|
|
@ -7,9 +7,6 @@ use tracing_subscriber::EnvFilter;
|
|||
use self::utils::{QString, QUrl};
|
||||
|
||||
mod db {
|
||||
use diesel::{Connection, SqliteConnection};
|
||||
use dirs::data_local_dir;
|
||||
|
||||
// pub enum Model {
|
||||
// Songs,
|
||||
// Presentations,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue