Fix UI inconsistencies in EditorFileDialog's toolbar
- Sort button has different stylebox compared to others - The top toolbar has a separator on the right side when in open mode - Update fav up/down buttons when fav list changes
This commit is contained in:
parent
1f47e4c4e3
commit
1ef3bd5768
@ -44,7 +44,6 @@
|
|||||||
#include "scene/gui/check_box.h"
|
#include "scene/gui/check_box.h"
|
||||||
#include "scene/gui/grid_container.h"
|
#include "scene/gui/grid_container.h"
|
||||||
#include "scene/gui/label.h"
|
#include "scene/gui/label.h"
|
||||||
#include "scene/gui/margin_container.h"
|
|
||||||
#include "scene/gui/option_button.h"
|
#include "scene/gui/option_button.h"
|
||||||
#include "scene/gui/separator.h"
|
#include "scene/gui/separator.h"
|
||||||
#include "scene/gui/split_container.h"
|
#include "scene/gui/split_container.h"
|
||||||
@ -1400,11 +1399,8 @@ void EditorFileDialog::set_file_mode(FileMode p_mode) {
|
|||||||
item_list->set_select_mode(ItemList::SELECT_SINGLE);
|
item_list->set_select_mode(ItemList::SELECT_SINGLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (can_create_dir) {
|
makedir_sep->set_visible(can_create_dir);
|
||||||
makedir->show();
|
makedir->set_visible(can_create_dir);
|
||||||
} else {
|
|
||||||
makedir->hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorFileDialog::FileMode EditorFileDialog::get_file_mode() const {
|
EditorFileDialog::FileMode EditorFileDialog::get_file_mode() const {
|
||||||
@ -1571,6 +1567,8 @@ void EditorFileDialog::_select_drive(int p_idx) {
|
|||||||
void EditorFileDialog::_update_drives(bool p_select) {
|
void EditorFileDialog::_update_drives(bool p_select) {
|
||||||
int dc = dir_access->get_drive_count();
|
int dc = dir_access->get_drive_count();
|
||||||
if (dc == 0 || access != ACCESS_FILESYSTEM) {
|
if (dc == 0 || access != ACCESS_FILESYSTEM) {
|
||||||
|
shortcuts_container->hide();
|
||||||
|
drives_container->hide();
|
||||||
drives->hide();
|
drives->hide();
|
||||||
} else {
|
} else {
|
||||||
drives->clear();
|
drives->clear();
|
||||||
@ -1579,6 +1577,8 @@ void EditorFileDialog::_update_drives(bool p_select) {
|
|||||||
dp->remove_child(drives);
|
dp->remove_child(drives);
|
||||||
}
|
}
|
||||||
dp = dir_access->drives_are_shortcuts() ? shortcuts_container : drives_container;
|
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);
|
dp->add_child(drives);
|
||||||
drives->show();
|
drives->show();
|
||||||
|
|
||||||
@ -1768,6 +1768,9 @@ void EditorFileDialog::_update_favorites() {
|
|||||||
recent->deselect_all();
|
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() {
|
void EditorFileDialog::_favorite_pressed() {
|
||||||
@ -2354,7 +2357,8 @@ EditorFileDialog::EditorFileDialog() {
|
|||||||
drives->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_select_drive));
|
drives->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_select_drive));
|
||||||
pathhb->add_child(drives);
|
pathhb->add_child(drives);
|
||||||
|
|
||||||
pathhb->add_child(memnew(VSeparator));
|
makedir_sep = memnew(VSeparator);
|
||||||
|
pathhb->add_child(makedir_sep);
|
||||||
|
|
||||||
makedir = memnew(Button);
|
makedir = memnew(Button);
|
||||||
makedir->set_theme_type_variation("FlatButton");
|
makedir->set_theme_type_variation("FlatButton");
|
||||||
@ -2473,7 +2477,8 @@ EditorFileDialog::EditorFileDialog() {
|
|||||||
lower_hb->add_child(memnew(VSeparator));
|
lower_hb->add_child(memnew(VSeparator));
|
||||||
|
|
||||||
file_sort_button = memnew(MenuButton);
|
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"));
|
file_sort_button->set_tooltip_text(TTR("Sort files"));
|
||||||
|
|
||||||
show_search_filter_button = memnew(Button);
|
show_search_filter_button = memnew(Button);
|
||||||
|
@ -44,6 +44,7 @@ class MenuButton;
|
|||||||
class OptionButton;
|
class OptionButton;
|
||||||
class PopupMenu;
|
class PopupMenu;
|
||||||
class TextureRect;
|
class TextureRect;
|
||||||
|
class VSeparator;
|
||||||
|
|
||||||
class EditorFileDialog : public ConfirmationDialog {
|
class EditorFileDialog : public ConfirmationDialog {
|
||||||
GDCLASS(EditorFileDialog, ConfirmationDialog);
|
GDCLASS(EditorFileDialog, ConfirmationDialog);
|
||||||
@ -89,6 +90,7 @@ private:
|
|||||||
ConfirmationDialog *makedialog = nullptr;
|
ConfirmationDialog *makedialog = nullptr;
|
||||||
LineEdit *makedirname = nullptr;
|
LineEdit *makedirname = nullptr;
|
||||||
|
|
||||||
|
VSeparator *makedir_sep = nullptr;
|
||||||
Button *makedir = nullptr;
|
Button *makedir = nullptr;
|
||||||
Access access = ACCESS_RESOURCES;
|
Access access = ACCESS_RESOURCES;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user