You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +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
3c7d92c590
commit
aee586553a
@@ -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(false));
|
||||
|
||||
// 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++) {
|
||||
@@ -1517,6 +1526,9 @@ EditorFileDialog::EditorFileDialog() {
|
||||
|
||||
pathhb->add_child(memnew(Label(TTR("Path:"))));
|
||||
|
||||
drives_container = memnew(HBoxContainer);
|
||||
pathhb->add_child(drives_container);
|
||||
|
||||
dir = memnew(LineEdit);
|
||||
pathhb->add_child(dir);
|
||||
dir->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
@@ -1560,8 +1572,10 @@ EditorFileDialog::EditorFileDialog() {
|
||||
mode_list->set_tooltip(TTR("View items as a list."));
|
||||
pathhb->add_child(mode_list);
|
||||
|
||||
shortcuts_container = memnew(HBoxContainer);
|
||||
pathhb->add_child(shortcuts_container);
|
||||
|
||||
drives = memnew(OptionButton);
|
||||
pathhb->add_child(drives);
|
||||
drives->connect("item_selected", callable_mp(this, &EditorFileDialog::_select_drive));
|
||||
|
||||
makedir = memnew(Button);
|
||||
|
||||
Reference in New Issue
Block a user