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
+2 -2
View File
@@ -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/>
@@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>. <https://www.gnu.org/licenses/why-not-lgpl.html>.
+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();