Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.3.0 #41

Merged
merged 32 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ab25263
Fix typos
fluxxcode Feb 11, 2024
2f6202a
Update CHANGELOG.md
fluxxcode Feb 11, 2024
06a4e7a
Merge pull request #29 from fluxxcode/doc/fix_typos
fluxxcode Feb 11, 2024
ef485e6
Fix eframe version in README.md
fluxxcode Feb 11, 2024
459c173
Update CHANGELOG.md
fluxxcode Feb 11, 2024
ed69bba
Merge pull request #30 from fluxxcode/doc/fix_eframe_version
fluxxcode Feb 11, 2024
35f07b0
Update README.md
fluxxcode Feb 11, 2024
4df0fe0
Update CHANGELOG.md
fluxxcode Feb 11, 2024
ee67800
Merge pull request #31 from fluxxcode/doc/update_readme
fluxxcode Feb 11, 2024
12b78f9
Add scroll area around selected item
fluxxcode Feb 15, 2024
1099a7b
Improve file name error messages (WIP)
fluxxcode Feb 16, 2024
aaf51f7
Update error tooltip (WIP)
fluxxcode Feb 17, 2024
287467e
Add error tooltip to save button
fluxxcode Feb 18, 2024
1425681
Add error icon to create directory error
fluxxcode Feb 18, 2024
292be9b
Fix rustfmt errors
fluxxcode Feb 18, 2024
1279d16
Reduce default min window size
fluxxcode Feb 18, 2024
e9fe02c
Update CHANGELOG.md
fluxxcode Feb 18, 2024
6327b5d
Merge pull request #32 from fluxxcode/feat/improve_bottom_panel
fluxxcode Feb 18, 2024
77da70b
Update CHANGELOG.md
fluxxcode Feb 18, 2024
a319b3a
Update CHANGELOG.md
fluxxcode Feb 18, 2024
34db009
Merge pull request #33 from fluxxcode/doc/update_changelog
fluxxcode Feb 18, 2024
bf314eb
Separate removable devices
fluxxcode Feb 18, 2024
fb84d49
Update CHANGELOG.md and demo image
fluxxcode Feb 18, 2024
6a3ca30
Fix typos
fluxxcode Feb 18, 2024
a6aa375
Merge pull request #34 from fluxxcode/feat/removable_devices
fluxxcode Feb 18, 2024
822d4e6
Rename "Currently missing features"
fluxxcode Feb 18, 2024
99be21a
Merge pull request #35 from fluxxcode/doc/update_readme
fluxxcode Feb 18, 2024
e66148a
Restructure file_dialog.rs (#36)
fluxxcode Feb 18, 2024
1a5d60d
Update changelog and restructure media files (#37)
fluxxcode Feb 18, 2024
d8acd52
Update disk names on Windows (#38)
fluxxcode Feb 18, 2024
1baffab
Increase version (#39)
fluxxcode Feb 18, 2024
57ba7cf
Update CHANGELOG.md for v0.3.0 (#40)
fluxxcode Feb 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# egui-file-dialog changelog

## 2024-02-18 - v0.3.0 - UI improvements
### 🖥 UI
- Updated bottom panel so that the dialog can also be resized in `DialogMode::SaveFile` or when selecting a file or directory with a long name [#32](https://github.com/fluxxcode/egui-file-dialog/pull/32)
- The error when saving a file is now displayed as a tooltip when hovering over the grayed out save button \
![preview](media/changelog/v0.3.0/error_tooltip.png)
- Updated file name input to use all available space
- Added scroll area around the selected item, so that long file names can be displayed without making the dialog larger
- The default minimum window size has been further reduced to `(340.0, 170.0)` [#32](https://github.com/fluxxcode/egui-file-dialog/pull/32)
- Added an error icon to the error message when creating a new folder [#32](https://github.com/fluxxcode/egui-file-dialog/pull/32) \
![preview](media/changelog/v0.3.0/error_icon.png)
- Removable devices are now listed in a separate devices section [#34](https://github.com/fluxxcode/egui-file-dialog/pull/34)
- Added mount point to the disk names on Windows [#38](https://github.com/fluxxcode/egui-file-dialog/pull/38)

### 🔧 Changes
- Restructure `file_dialog.rs` [#36](https://github.com/fluxxcode/egui-file-dialog/pull/36)

### 📚 Documentation
- Fix typos in the documentation [#29](https://github.com/fluxxcode/egui-file-dialog/pull/29)
- Fix eframe version in the example in `README.md` [#30](https://github.com/fluxxcode/egui-file-dialog/pull/30)
- Added "Planned features” section to `README.md` and minor improvements [#31](https://github.com/fluxxcode/egui-file-dialog/pull/31) (Renamed with [#35](https://github.com/fluxxcode/egui-file-dialog/pull/35))
- Updated example screenshot in `README.md` to include new "Removable Devices" section [#34](https://github.com/fluxxcode/egui-file-dialog/pull/34)
- Moved media files from `doc/img/` to `media/` [#37](https://github.com/fluxxcode/egui-file-dialog/pull/37)

## 2024-02-07 - v0.2.0 - API improvements
### 🚨 Breaking Changes
- Rename `FileDialog::default_window_size` to `FileDialog::default_size` [#14](https://github.com/fluxxcode/egui-file-dialog/pull/14)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ members = [
[package]
name = "egui-file-dialog"
description = "An easy-to-use file dialog for egui"
version = "0.2.0"
version = "0.3.0"
edition = "2021"
authors = ["fluxxcode"]
repository = "https://github.com/fluxxcode/egui-file-dialog"
Expand Down
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

This repository provides an easy-to-use file dialog (a.k.a. file explorer, file picker) for [egui](https://github.com/emilk/egui). This makes it possible to use a file dialog directly in the egui application without having to rely on the file explorer of the operating system.

<img src="doc/img/demo.png">
<img src="media/demo.png">

The goal for the future is that parts of the dialog can be dynamically adapted so that it can be used in different situations. One goal, for example, is that the labels can be dynamically adjusted to support different languages.

The project is currently in a very early version. Some planned features are still missing and some improvements still need to be made.

**NOTE**: As long as version 1.0.0 has not yet been reached, even minor version increases may contain breaking changes.
Check out [CHANGELOG.md](https://github.com/fluxxcode/egui-file-dialog/blob/develop/CHANGELOG.md) in the develop branch to find the latest features included in the next release.

**Currently only tested on Linux and Windows!**

Expand All @@ -25,14 +25,26 @@ The project is currently in a very early version. Some planned features are stil
- Shortcut for user directories (Home, Documents, ...) and system disks
- Resizable window

## Planned features
The following lists some of the features that are currently missing but are planned for the future!
- Customize labels and enabled features
- Selection of multiple directory items at once
- Customizable file icons
- Only show files with a specific file extension (The user can already filter files by file extension using the search, but there is currently no backend method for this or a dropdown to be able to select from predefined file extensions.)
- Keyboard input
- Context menus, for example for renaming, deleting or copying files or directories.
- Option to show or hide hidden files and folders

## Example
Detailed examples that can be run can be found in the [examples](https://github.com/fluxxcode/egui-file-dialog/tree/master/examples) folder.

The following example shows the basic use of the file dialog with [eframe](https://github.com/emilk/egui/tree/master/crates/eframe) to select a file.

Cargo.toml:
```toml
[dependencies]
eframe = "0.25.0"
egui-file-dialog = "0.2.0"
eframe = "0.26.0"
egui-file-dialog = "0.3.0"
```

main.rs:
Expand Down
Binary file removed doc/img/demo.png
Binary file not shown.
Binary file added media/changelog/v0.3.0/error_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/changelog/v0.3.0/error_tooltip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion src/create_directory_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,15 @@ impl CreateDirectoryDialog {

if let Some(err) = &self.error {
ui.add_space(5.0);
let response = ui.label(err);

let response = ui
.horizontal_wrapped(|ui| {
ui.spacing_mut().item_spacing.x = 0.0;

ui.colored_label(ui.style().visuals.error_fg_color, "⚠ ");
ui.label(err);
})
.response;

if self.scroll_to_error {
response.scroll_to_me(Some(egui::Align::Center));
Expand Down
56 changes: 42 additions & 14 deletions src/data/disks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ use std::path::{Path, PathBuf};
pub struct Disk {
mount_point: PathBuf,
display_name: String,
is_removable: bool,
}

impl Disk {
/// Create a new Disk object based on the data of a sysinfo::Disk.
pub fn from_sysinfo_disk(disk: &sysinfo::Disk) -> Self {
Self {
mount_point: disk.mount_point().to_path_buf(),
display_name: Self::gen_display_name(disk),
display_name: gen_display_name(disk),
is_removable: disk.is_removable(),
}
}

Expand All @@ -28,19 +30,8 @@ impl Disk {
&self.display_name
}

fn gen_display_name(disk: &sysinfo::Disk) -> String {
// TODO: Get display name of the devices.
// Currently on Linux it returns "/dev/sda1" and on Windows it returns an
// empty string for the C:\\ drive.
let name = disk.name().to_str().unwrap_or_default().to_string();

// Try using the mount point as the display name if the specified name
// from sysinfo::Disk is empty or contains invalid characters
if name.is_empty() {
return disk.mount_point().to_str().unwrap_or_default().to_string();
}

name
pub fn is_removable(&self) -> bool {
self.is_removable
}
}

Expand Down Expand Up @@ -69,3 +60,40 @@ impl Disks {
self.disks.iter()
}
}

#[cfg(windows)]
fn gen_display_name(disk: &sysinfo::Disk) -> String {
// TODO: Get display name of the devices.
// Currently on Windows it returns an empty string for the C:\\ drive.

let mut name = disk.name().to_str().unwrap_or_default().to_string();
let mount_point = disk
.mount_point()
.to_str()
.unwrap_or_default()
.to_string()
.replace("\\", "");

// Try using the mount point as the display name if the specified name
// from sysinfo::Disk is empty or contains invalid characters
if name.is_empty() {
return mount_point;
}

name.push_str(format!(" ({})", mount_point).as_str());

name
}

#[cfg(not(windows))]
fn gen_display_name(disk: &sysinfo::Disk) -> String {
let name = disk.name().to_str().unwrap_or_default().to_string();

// Try using the mount point as the display name if the specified name
// from sysinfo::Disk is empty or contains invalid characters
if name.is_empty() {
return disk.mount_point().to_str().unwrap_or_default().to_string();
}

name
}
2 changes: 1 addition & 1 deletion src/data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod directory_content;
pub use directory_content::{DirectoryContent, DirectoryEntry};

mod disks;
pub use disks::Disks;
pub use disks::{Disk, Disks};

mod user_directories;
pub use user_directories::UserDirectories;
Loading
Loading