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

Fix UI inconsistencies in EditorFileDialog's toolbar #100027

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 13 additions & 8 deletions editor/gui/editor_file_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "scene/gui/check_box.h"
#include "scene/gui/grid_container.h"
#include "scene/gui/label.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/option_button.h"
#include "scene/gui/separator.h"
#include "scene/gui/split_container.h"
Expand Down Expand Up @@ -1400,11 +1399,8 @@ void EditorFileDialog::set_file_mode(FileMode p_mode) {
item_list->set_select_mode(ItemList::SELECT_SINGLE);
}

if (can_create_dir) {
makedir->show();
} else {
makedir->hide();
}
makedir_sep->set_visible(can_create_dir);
makedir->set_visible(can_create_dir);
}

EditorFileDialog::FileMode EditorFileDialog::get_file_mode() const {
Expand Down Expand Up @@ -1571,6 +1567,8 @@ void EditorFileDialog::_select_drive(int p_idx) {
void EditorFileDialog::_update_drives(bool p_select) {
int dc = dir_access->get_drive_count();
if (dc == 0 || access != ACCESS_FILESYSTEM) {
shortcuts_container->hide();
drives_container->hide();
drives->hide();
} else {
drives->clear();
Expand All @@ -1579,6 +1577,8 @@ void EditorFileDialog::_update_drives(bool p_select) {
dp->remove_child(drives);
}
dp = dir_access->drives_are_shortcuts() ? shortcuts_container : drives_container;
shortcuts_container->set_visible(dir_access->drives_are_shortcuts());
drives_container->set_visible(!dir_access->drives_are_shortcuts());
dp->add_child(drives);
drives->show();

Expand Down Expand Up @@ -1768,6 +1768,9 @@ void EditorFileDialog::_update_favorites() {
recent->deselect_all();
}
}

fav_up->set_disabled(current_favorite < 1);
fav_down->set_disabled(current_favorite == -1 || favorited_paths.size() - 1 <= current_favorite);
}

void EditorFileDialog::_favorite_pressed() {
Expand Down Expand Up @@ -2354,7 +2357,8 @@ EditorFileDialog::EditorFileDialog() {
drives->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_select_drive));
pathhb->add_child(drives);

pathhb->add_child(memnew(VSeparator));
makedir_sep = memnew(VSeparator);
pathhb->add_child(makedir_sep);

makedir = memnew(Button);
makedir->set_theme_type_variation("FlatButton");
Expand Down Expand Up @@ -2473,7 +2477,8 @@ EditorFileDialog::EditorFileDialog() {
lower_hb->add_child(memnew(VSeparator));

file_sort_button = memnew(MenuButton);
file_sort_button->set_flat(true);
file_sort_button->set_flat(false);
file_sort_button->set_theme_type_variation("FlatMenuButton");
file_sort_button->set_tooltip_text(TTR("Sort files"));

show_search_filter_button = memnew(Button);
Expand Down
2 changes: 2 additions & 0 deletions editor/gui/editor_file_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class MenuButton;
class OptionButton;
class PopupMenu;
class TextureRect;
class VSeparator;

class EditorFileDialog : public ConfirmationDialog {
GDCLASS(EditorFileDialog, ConfirmationDialog);
Expand Down Expand Up @@ -89,6 +90,7 @@ class EditorFileDialog : public ConfirmationDialog {
ConfirmationDialog *makedialog = nullptr;
LineEdit *makedirname = nullptr;

VSeparator *makedir_sep = nullptr;
Button *makedir = nullptr;
Access access = ACCESS_RESOURCES;

Expand Down
Loading