some initial setup to get the service_item_model.rs working
This commit is contained in:
parent
2df4c646a7
commit
d61da6f09f
3 changed files with 35 additions and 13 deletions
|
@ -95,9 +95,21 @@ mod service_item_model {
|
|||
SelectedChanged,
|
||||
ItemInserted {
|
||||
index: &'a i32,
|
||||
item: &'a QMap_QString_QVariant,
|
||||
},
|
||||
ItemAdded {
|
||||
index: &'a i32,
|
||||
item: &'a QMap_QString_QVariant,
|
||||
},
|
||||
ItemRemoved {
|
||||
index: &'a i32,
|
||||
item: &'a QMap_QString_QVariant,
|
||||
},
|
||||
ItemMoved {
|
||||
source_index: &'a i32,
|
||||
dest_index: &'a i32,
|
||||
// index: &'a i32,
|
||||
item: &'a QMap_QString_QVariant,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -120,7 +132,11 @@ mod service_item_model {
|
|||
|
||||
// use crate::video_thumbnail;
|
||||
// use image::{ImageBuffer, Rgba};
|
||||
use std::path::PathBuf;
|
||||
use dirs;
|
||||
use std::fs;
|
||||
use std::io::{self, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str;
|
||||
impl qobject::ServiceItemMod {
|
||||
#[qinvokable]
|
||||
pub fn clear(mut self: Pin<&mut Self>) {
|
||||
|
@ -150,9 +166,9 @@ mod service_item_model {
|
|||
mut self: Pin<&mut Self>,
|
||||
name: QString,
|
||||
ty: QString,
|
||||
text: QStringList,
|
||||
background: QString,
|
||||
background_type: QString,
|
||||
text: QStringList,
|
||||
audio: QString,
|
||||
font: QString,
|
||||
font_size: i32,
|
||||
|
@ -333,7 +349,11 @@ mod service_item_model {
|
|||
|
||||
#[qinvokable]
|
||||
pub fn load(mut self: Pin<&mut Self>, file: QUrl) -> bool {
|
||||
todo!();
|
||||
// todo!();
|
||||
println!("THE LAST SAVE FILE ISSSSS: {file}");
|
||||
let lf = PathBuf::from(file.to_local_file().unwrap_or_default().to_string());
|
||||
println!("{:?}", lf);
|
||||
false
|
||||
}
|
||||
|
||||
#[qinvokable]
|
||||
|
|
|
@ -7,6 +7,8 @@ mod settings {
|
|||
unsafe extern "C++" {
|
||||
include!("cxx-qt-lib/qstring.h");
|
||||
type QString = cxx_qt_lib::QString;
|
||||
include!("cxx-qt-lib/qurl.h");
|
||||
type QUrl = cxx_qt_lib::QUrl;
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -17,7 +19,7 @@ mod settings {
|
|||
#[qproperty]
|
||||
sound_effect: QString,
|
||||
#[qproperty]
|
||||
last_save_file: QString,
|
||||
last_save_file: QUrl,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
|
@ -25,7 +27,7 @@ mod settings {
|
|||
Self {
|
||||
screen: QString::from(""),
|
||||
sound_effect: QString::from(""),
|
||||
last_save_file: QString::from(""),
|
||||
last_save_file: QUrl::from(""),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +56,7 @@ mod settings {
|
|||
let sf = config.get("General", "lastSaveFile");
|
||||
println!("{:?}", sf);
|
||||
if let Some(s) = sf {
|
||||
self.set_last_save_file(QString::from(&s));
|
||||
self.set_last_save_file(QUrl::from(&s));
|
||||
println!("{s}");
|
||||
} else {
|
||||
println!("error loading last save file");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue