You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Improve UX of drive letters
Namely, move the drive dropdown to just the left of the path text box and don't include the former in the latter. This improves the UX on Windows. In the UNIX case, since its concept of drives is (ab)used to provide shortcuts to useful paths, its dropdown is kept at the original location.
This commit is contained in:
committed by
Pedro J. Estébanez
parent
f4e3701893
commit
6105dfdac9
@@ -199,7 +199,10 @@ Vector<String> EditorFileDialog::get_selected_files() const {
|
||||
|
||||
void EditorFileDialog::update_dir() {
|
||||
|
||||
dir->set_text(dir_access->get_current_dir());
|
||||
if (drives->is_visible()) {
|
||||
drives->select(dir_access->get_current_drive());
|
||||
}
|
||||
dir->set_text(dir_access->get_current_dir_without_drive());
|
||||
|
||||
// Disable "Open" button only when selecting file(s) mode.
|
||||
get_ok()->set_disabled(_is_open_should_be_disabled());
|
||||
@@ -946,7 +949,7 @@ void EditorFileDialog::add_filter(const String &p_filter) {
|
||||
|
||||
String EditorFileDialog::get_current_dir() const {
|
||||
|
||||
return dir->get_text();
|
||||
return dir_access->get_current_dir();
|
||||
}
|
||||
String EditorFileDialog::get_current_file() const {
|
||||
|
||||
@@ -954,7 +957,7 @@ String EditorFileDialog::get_current_file() const {
|
||||
}
|
||||
String EditorFileDialog::get_current_path() const {
|
||||
|
||||
return dir->get_text().plus_file(file->get_text());
|
||||
return dir_access->get_current_dir().plus_file(file->get_text());
|
||||
}
|
||||
void EditorFileDialog::set_current_dir(const String &p_dir) {
|
||||
|
||||
@@ -1149,6 +1152,12 @@ void EditorFileDialog::_update_drives() {
|
||||
drives->hide();
|
||||
} else {
|
||||
drives->clear();
|
||||
Node *dp = drives->get_parent();
|
||||
if (dp) {
|
||||
dp->remove_child(drives);
|
||||
}
|
||||
dp = dir_access->drives_are_shortcuts() ? shortcuts_container : drives_container;
|
||||
dp->add_child(drives);
|
||||
drives->show();
|
||||
|
||||
for (int i = 0; i < dir_access->get_drive_count(); i++) {
|
||||
@@ -1543,6 +1552,12 @@ EditorFileDialog::EditorFileDialog() {
|
||||
|
||||
pathhb->add_child(memnew(Label(TTR("Path:"))));
|
||||
|
||||
drives_container = memnew(HBoxContainer);
|
||||
pathhb->add_child(drives_container);
|
||||
|
||||
drives = memnew(OptionButton);
|
||||
drives->connect("item_selected", this, "_select_drive");
|
||||
|
||||
dir = memnew(LineEdit);
|
||||
pathhb->add_child(dir);
|
||||
dir->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
@@ -1586,9 +1601,8 @@ EditorFileDialog::EditorFileDialog() {
|
||||
mode_list->set_tooltip(TTR("View items as a list."));
|
||||
pathhb->add_child(mode_list);
|
||||
|
||||
drives = memnew(OptionButton);
|
||||
pathhb->add_child(drives);
|
||||
drives->connect("item_selected", this, "_select_drive");
|
||||
shortcuts_container = memnew(HBoxContainer);
|
||||
pathhb->add_child(shortcuts_container);
|
||||
|
||||
makedir = memnew(Button);
|
||||
makedir->set_text(TTR("Create Folder"));
|
||||
|
||||
Reference in New Issue
Block a user