Added filter and removed appending .png to file location string
This commit is contained in:
+1
-1
@@ -18,13 +18,13 @@ 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 mut 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.save(savelocation);
|
image.save(savelocation);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user