-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initializes file picker for Linux (#1139)
- Loading branch information
1 parent
87f11ff
commit 3c916a6
Showing
23 changed files
with
643 additions
and
653 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ members = [ | |
"src/fs", | ||
"src/llt", | ||
"src/obconf", | ||
"src/param", | ||
"src/pfs", | ||
"src/tls", | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use super::FileType; | ||
use ashpd::desktop::file_chooser::{FileFilter, SelectedFiles}; | ||
use ashpd::WindowIdentifier; | ||
use raw_window_handle::{HasDisplayHandle, HasWindowHandle}; | ||
use slint::ComponentHandle; | ||
|
||
pub async fn open_file<T: ComponentHandle>(parent: &T, title: impl AsRef<str>, ty: FileType) { | ||
// Get display handle. All local variable here must not get dropped until the operation is | ||
// complete. | ||
let parent = parent.window().window_handle(); | ||
let display = parent.display_handle(); | ||
let display = display.as_ref().map(|v| v.as_ref()).ok(); | ||
|
||
// Get parent handle. | ||
let parent = parent.window_handle(); | ||
let parent = parent.as_ref().map(|v| v.as_ref()).unwrap(); | ||
let parent = WindowIdentifier::from_raw_handle(parent, display).await; | ||
|
||
// Build filter. | ||
let filter = match ty { | ||
FileType::Firmware => FileFilter::new("Firmware Dump").glob("*.obf"), | ||
}; | ||
|
||
// Send the request | ||
SelectedFiles::open_file() | ||
.identifier(parent) | ||
.title(title.as_ref()) | ||
.modal(true) | ||
.filter(filter) | ||
.send() | ||
.await | ||
.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use super::FileType; | ||
use slint::ComponentHandle; | ||
|
||
pub async fn open_file<T: ComponentHandle>(parent: &T, title: impl AsRef<str>, ty: FileType) { | ||
todo!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
pub use self::os::*; | ||
|
||
#[cfg_attr(target_os = "linux", path = "linux/mod.rs")] | ||
#[cfg_attr(target_os = "macos", path = "macos/mod.rs")] | ||
#[cfg_attr(target_os = "windows", path = "windows/mod.rs")] | ||
mod os; | ||
|
||
/// File type to use open from [`open_file()`]. | ||
pub enum FileType { | ||
Firmware, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use super::FileType; | ||
use slint::ComponentHandle; | ||
|
||
pub async fn open_file<T: ComponentHandle>(parent: &T, title: impl AsRef<str>, ty: FileType) { | ||
todo!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ mod debug; | |
mod error; | ||
mod graphics; | ||
mod hv; | ||
mod param; | ||
mod profile; | ||
mod string; | ||
mod system; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.