Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dc5bb1470e | |||
| 069356a8f8 | |||
| 6a30f76c17 |
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
|||||||
+6
-6
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user