mirror of
https://github.com/godotengine/godot
synced 2024-11-02 09:38:07 +00:00
Merge pull request #11882 from Noshyaar/pr-filedialog
FileDialog: enlarge the file list a bit
This commit is contained in:
commit
6dd25b5a5b
2 changed files with 37 additions and 27 deletions
|
@ -1368,35 +1368,41 @@ EditorFileDialog::EditorFileDialog() {
|
|||
|
||||
VBoxContainer *item_vb = memnew(VBoxContainer);
|
||||
list_hb->add_child(item_vb);
|
||||
item_vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
|
||||
HBoxContainer *preview_hb = memnew(HBoxContainer);
|
||||
preview_hb->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
item_vb->add_child(preview_hb);
|
||||
|
||||
VBoxContainer *list_vb = memnew(VBoxContainer);
|
||||
list_vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
list_vb->add_child(memnew(Label(TTR("Directories & Files:"))));
|
||||
preview_hb->add_child(list_vb);
|
||||
|
||||
item_list = memnew(ItemList);
|
||||
item_list->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
item_vb->add_margin_child(TTR("Directories & Files:"), item_list, true);
|
||||
|
||||
HBoxContainer *filter_hb = memnew(HBoxContainer);
|
||||
item_vb->add_child(filter_hb);
|
||||
|
||||
VBoxContainer *filter_vb = memnew(VBoxContainer);
|
||||
filter_hb->add_child(filter_vb);
|
||||
filter_vb->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
list_vb->add_child(item_list);
|
||||
|
||||
preview_vb = memnew(VBoxContainer);
|
||||
filter_hb->add_child(preview_vb);
|
||||
preview_hb->add_child(preview_vb);
|
||||
CenterContainer *prev_cc = memnew(CenterContainer);
|
||||
preview_vb->add_margin_child(TTR("Preview:"), prev_cc);
|
||||
preview = memnew(TextureRect);
|
||||
prev_cc->add_child(preview);
|
||||
preview_vb->hide();
|
||||
|
||||
HBoxContainer *filename_hbc = memnew(HBoxContainer);
|
||||
filename_hbc->add_child(memnew(Label(TTR("File:"))));
|
||||
file = memnew(LineEdit);
|
||||
//add_child(file);
|
||||
filter_vb->add_margin_child(TTR("File:"), file);
|
||||
|
||||
file->set_stretch_ratio(4);
|
||||
file->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
filename_hbc->add_child(file);
|
||||
filter = memnew(OptionButton);
|
||||
//add_child(filter);
|
||||
filter_vb->add_margin_child(TTR("Filter:"), filter);
|
||||
filter->set_stretch_ratio(3);
|
||||
filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
filter->set_clip_text(true); //too many extensions overflow it
|
||||
filename_hbc->add_child(filter);
|
||||
filename_hbc->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
item_vb->add_child(filename_hbc);
|
||||
|
||||
dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||
access = ACCESS_RESOURCES;
|
||||
|
|
|
@ -759,38 +759,42 @@ FileDialog::FileDialog() {
|
|||
mode = MODE_SAVE_FILE;
|
||||
set_title(RTR("Save a File"));
|
||||
|
||||
HBoxContainer *hbc = memnew(HBoxContainer);
|
||||
hbc->add_child(memnew(Label(RTR("Path:"))));
|
||||
dir = memnew(LineEdit);
|
||||
HBoxContainer *pathhb = memnew(HBoxContainer);
|
||||
pathhb->add_child(dir);
|
||||
hbc->add_child(dir);
|
||||
dir->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
|
||||
refresh = memnew(ToolButton);
|
||||
refresh->connect("pressed", this, "_update_file_list");
|
||||
pathhb->add_child(refresh);
|
||||
hbc->add_child(refresh);
|
||||
|
||||
drives = memnew(OptionButton);
|
||||
pathhb->add_child(drives);
|
||||
hbc->add_child(drives);
|
||||
drives->connect("item_selected", this, "_select_drive");
|
||||
|
||||
makedir = memnew(Button);
|
||||
makedir->set_text(RTR("Create Folder"));
|
||||
makedir->connect("pressed", this, "_make_dir");
|
||||
pathhb->add_child(makedir);
|
||||
|
||||
vbc->add_margin_child(RTR("Path:"), pathhb);
|
||||
hbc->add_child(makedir);
|
||||
vbc->add_child(hbc);
|
||||
|
||||
tree = memnew(Tree);
|
||||
tree->set_hide_root(true);
|
||||
vbc->add_margin_child(RTR("Directories & Files:"), tree, true);
|
||||
|
||||
hbc = memnew(HBoxContainer);
|
||||
hbc->add_child(memnew(Label(RTR("File:"))));
|
||||
file = memnew(LineEdit);
|
||||
//add_child(file);
|
||||
vbc->add_margin_child(RTR("File:"), file);
|
||||
|
||||
file->set_stretch_ratio(4);
|
||||
file->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
hbc->add_child(file);
|
||||
filter = memnew(OptionButton);
|
||||
//add_child(filter);
|
||||
vbc->add_margin_child(RTR("Filter:"), filter);
|
||||
filter->set_stretch_ratio(3);
|
||||
filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
filter->set_clip_text(true); //too many extensions overflow it
|
||||
hbc->add_child(filter);
|
||||
vbc->add_child(hbc);
|
||||
|
||||
dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||
access = ACCESS_RESOURCES;
|
||||
|
|
Loading…
Reference in a new issue