2023-10-21 19:36:56 +13:00
|
|
|
mod connect_delete;
|
|
|
|
mod connect_scan;
|
|
|
|
|
|
|
|
use std::path::Path;
|
2023-10-19 20:32:37 +13:00
|
|
|
use std::rc::Rc;
|
2023-10-21 19:36:56 +13:00
|
|
|
|
|
|
|
use crate::connect_delete::connect_delete_button;
|
|
|
|
use crate::connect_scan::connect_scan_button;
|
|
|
|
|
2023-10-22 10:33:29 +13:00
|
|
|
use slint::{ModelRc, SharedString, VecModel};
|
2023-10-05 19:06:47 +13:00
|
|
|
|
2023-10-21 19:36:56 +13:00
|
|
|
slint::include_modules!();
|
2023-10-18 08:31:08 +13:00
|
|
|
fn main() {
|
2023-10-21 19:36:56 +13:00
|
|
|
let app = MainWindow::new().unwrap(); //.run().unwrap();
|
2023-10-22 10:33:29 +13:00
|
|
|
|
|
|
|
to_remove_debug(&app);
|
|
|
|
|
|
|
|
connect_delete_button(&app);
|
|
|
|
connect_scan_button(&app);
|
|
|
|
|
|
|
|
app.run().unwrap();
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO remove this after trying
|
|
|
|
pub fn to_remove_debug(app: &MainWindow) {
|
2023-10-21 19:36:56 +13:00
|
|
|
let row_data: Rc<VecModel<(bool, bool, bool, ModelRc<SharedString>)>> = Rc::new(VecModel::default());
|
2023-10-18 04:40:05 +13:00
|
|
|
|
2023-10-22 10:33:29 +13:00
|
|
|
for r in 0..100000 {
|
2023-10-19 20:32:37 +13:00
|
|
|
let items = VecModel::default();
|
|
|
|
|
|
|
|
for c in 0..3 {
|
|
|
|
items.push(slint::format!("Item {r}.{c}").into());
|
|
|
|
}
|
|
|
|
|
2023-10-22 10:33:29 +13:00
|
|
|
row_data.push((r % 2 == 0, r % 3 == 0, false, ModelRc::new(items)));
|
2023-10-19 20:32:37 +13:00
|
|
|
}
|
2023-10-22 02:13:27 +13:00
|
|
|
app.set_empty_folder_model(row_data.into());
|
2023-10-21 19:36:56 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn split_path(path: &Path) -> (String, String) {
|
|
|
|
match (path.parent(), path.file_name()) {
|
|
|
|
(Some(dir), Some(file)) => (dir.display().to_string(), file.to_string_lossy().into_owned()),
|
|
|
|
(Some(dir), None) => (dir.display().to_string(), String::new()),
|
|
|
|
(None, _) => (String::new(), String::new()),
|
|
|
|
}
|
|
|
|
}
|