diff options
-rw-r--r-- | editor/editor_file_dialog.cpp | 36 | ||||
-rw-r--r-- | scene/gui/file_dialog.cpp | 28 |
2 files changed, 37 insertions, 27 deletions
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index b980c4f0ec..a0ca9b88e0 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -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); - 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 *preview_hb = memnew(HBoxContainer); + preview_hb->set_v_size_flags(SIZE_EXPAND_FILL); + item_vb->add_child(preview_hb); - HBoxContainer *filter_hb = memnew(HBoxContainer); - item_vb->add_child(filter_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); - VBoxContainer *filter_vb = memnew(VBoxContainer); - filter_hb->add_child(filter_vb); - filter_vb->set_h_size_flags(SIZE_EXPAND_FILL); + item_list = memnew(ItemList); + item_list->set_v_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; diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index d8ff048dfb..6ade4fcc38 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -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; |