3 Commits

Author SHA1 Message Date
brotoskyj dc5bb1470e Update LICENSE.md 2025-01-28 15:23:46 -05:00
brotoskyj 069356a8f8 Refactored code, no need for recompile 2025-01-20 17:56:02 -05:00
brotoskyj 6a30f76c17 Added filter and removed appending .png to file location string 2025-01-17 17:10:27 -05:00
2 changed files with 8 additions and 8 deletions
+6 -6
View File
@@ -1,8 +1,6 @@
#![windows_subsystem = "windows"] #![windows_subsystem = "windows"]
use std::fs::File;
use image::Luma; use image::Luma;
use native_dialog::{FileDialog, MessageDialog, MessageType}; use native_dialog::FileDialog;
use qrcode::QrCode; use qrcode::QrCode;
slint::slint!(); slint::slint!();
slint::include_modules!(); slint::include_modules!();
@@ -18,14 +16,16 @@ fn main() {
let websitetext = binding.as_str(); let websitetext = binding.as_str();
let result = FileDialog::new() let result = FileDialog::new()
.set_location("~/Downloads") .set_location("~/Downloads")
.add_filter("Image", &["png", "jpg", "gif"])
.show_save_single_file() .show_save_single_file()
.expect("Unknown File Path") .expect("Unknown File Path")
.unwrap(); .unwrap();
let mut savelocation = result.into_os_string().into_string().unwrap(); let savelocation = result.into_os_string().into_string().unwrap();
let qrcode = QrCode::new(websitetext.as_bytes()).unwrap(); let qrcode = QrCode::new(websitetext.as_bytes()).unwrap();
let image = qrcode.render::<Luma<u8>>().build(); let image = qrcode.render::<Luma<u8>>().build();
savelocation.push_str(".png"); image
image.save(savelocation); .save(savelocation)
.expect("Couldn't save file");
} }
}); });
app.run().unwrap(); app.run().unwrap();