adding settings.rs
This commit is contained in:
parent
f1def0bce9
commit
58fb8625f4
4 changed files with 19 additions and 340 deletions
|
@ -1,34 +1,39 @@
|
|||
#[cxx_qt::bridge]
|
||||
mod settings {
|
||||
|
||||
use configparser::ini::Ini;
|
||||
use std::error::Error;
|
||||
|
||||
unsafe extern "C++" {
|
||||
include!("qsettingscxx.h");
|
||||
include!("cxx-qt-lib/qstring.h");
|
||||
type QString = cxx_qt_lib::QString;
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[cxx_qt::qobject(base = "QSettingsCXX")]
|
||||
#[cxx_qt::qobject]
|
||||
pub struct Settings {
|
||||
#[qproperty]
|
||||
name: QString,
|
||||
screen: QString,
|
||||
#[qproperty]
|
||||
kind: QString,
|
||||
sound_effect: QString,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
name: QString::from(""),
|
||||
kind: QString::from(""),
|
||||
screen: QString::from(""),
|
||||
sound_effect: QString::from(""),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl qobject::Settings {
|
||||
#[qinvokable]
|
||||
pub fn activate(self: Pin<&mut Self>) {
|
||||
println!("{}", self.name());
|
||||
pub fn print_sound(self: Pin<&mut Self>) {
|
||||
let mut config = Ini::new();
|
||||
let map = config.load("~/.config/librepresenter/Libre Presenter.conf");
|
||||
|
||||
println!("{}", self.sound_effect());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue