Skip to content

Commit

Permalink
Implement debug for FileDialog (#152)
Browse files Browse the repository at this point in the history
* Implement debug for FileDialog

* Update changelog

* Fix rustfmt errors
  • Loading branch information
fluxxcode authored Sep 23, 2024
1 parent 3f664af commit 698e35b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Unreleased
### 🔧 Changes
- Path edit is now selected as the desired file if the path entered is an existing file and the dialog is in `DialogueMode::SelectFile` mode. [#151](https://github.com/fluxxcode/egui-file-dialog/pull/151)
- Path edit is now selected as the desired file if the path entered is an existing file and the dialog is in `DialogueMode::SelectFile` mode [#151](https://github.com/fluxxcode/egui-file-dialog/pull/151)
- Implemented `Debug` trait for `FileDialog` [#152](https://github.com/fluxxcode/egui-file-dialog/pull/152)

## 2024-09-10 - v0.6.1 - Bug Fixes
### 🐛 Bug Fixes
Expand Down
1 change: 1 addition & 0 deletions src/create_directory_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ impl CreateDirectoryResponse {
}

/// A dialog to create new folder.
#[derive(Debug)]
pub struct CreateDirectoryDialog {
/// If the dialog is currently open
open: bool,
Expand Down
2 changes: 1 addition & 1 deletion src/data/directory_content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl DirectoryEntry {
}

/// Contains the content of a directory.
#[derive(Default)]
#[derive(Default, Debug)]
pub struct DirectoryContent {
content: Vec<DirectoryEntry>,
}
Expand Down
4 changes: 2 additions & 2 deletions src/data/disks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
/// Wrapper above the sysinfo::Disk struct.
/// Used for helper functions and so that more flexibility is guaranteed in the future if
/// the names of the disks are generated dynamically.
#[derive(Default, Clone, PartialEq, Eq)]
#[derive(Default, Debug, Clone, PartialEq, Eq)]
pub struct Disk {
mount_point: PathBuf,
display_name: String,
Expand Down Expand Up @@ -46,7 +46,7 @@ impl Disk {
}

/// Wrapper above the sysinfo::Disks struct
#[derive(Default)]
#[derive(Default, Debug)]
pub struct Disks {
disks: Vec<Disk>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/data/user_directories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};

/// Wrapper above directories::UserDirs.
/// Currently only used to canonicalize the paths.
#[derive(Default, Clone)]
#[derive(Default, Clone, Debug)]
pub struct UserDirectories {
home_dir: Option<PathBuf>,

Expand Down
8 changes: 8 additions & 0 deletions src/file_dialog.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::fmt::Debug;
use std::path::{Path, PathBuf};
use std::{fs, io};

Expand Down Expand Up @@ -71,6 +72,7 @@ pub enum DialogState {
/// }
/// }
/// ```
#[derive(Debug)]
pub struct FileDialog {
/// The configuration of the file dialog
config: FileDialogConfig,
Expand Down Expand Up @@ -172,6 +174,12 @@ impl Default for FileDialog {
}
}

impl Debug for dyn FileDialogModal + Send + Sync {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "<FileDialogModal>")
}
}

impl FileDialog {
// ------------------------------------------------------------------------
// Creation:
Expand Down

0 comments on commit 698e35b

Please sign in to comment.