mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 22:31:14 +00:00
42 lines
1.2 KiB
Rust
42 lines
1.2 KiB
Rust
use structopt::StructOpt;
|
|
|
|
#[derive(StructOpt)]
|
|
struct Cli {
|
|
#[structopt(short = "I", name = "include path for other .60 files", number_of_values = 1)]
|
|
include_paths: Vec<std::path::PathBuf>,
|
|
|
|
#[structopt(name = "path to .60 file", parse(from_os_str))]
|
|
path: std::path::PathBuf,
|
|
|
|
/// The style name (empty, or 'qt')
|
|
#[structopt(long, name = "style name", default_value)]
|
|
style: String,
|
|
}
|
|
|
|
fn main() -> std::io::Result<()> {
|
|
let args = Cli::from_args();
|
|
let source = std::fs::read_to_string(&args.path)?;
|
|
|
|
let mut include_paths = args.include_paths;
|
|
if args.style == "qt" {
|
|
// FIXME: that's not how it should work
|
|
include_paths.push(
|
|
[env!("CARGO_MANIFEST_DIR"), "..", "..", "sixtyfps_runtime", "qt_style"]
|
|
.iter()
|
|
.collect(),
|
|
);
|
|
}
|
|
|
|
let c = match sixtyfps_interpreter::load(source, &args.path, &include_paths) {
|
|
Ok(c) => c,
|
|
Err(diag) => {
|
|
diag.print();
|
|
std::process::exit(-1);
|
|
}
|
|
};
|
|
|
|
let window = sixtyfps_rendering_backend_gl::create_gl_window();
|
|
let component = c.create();
|
|
window.run(component.borrow(), &component.window_properties());
|
|
Ok(())
|
|
}
|