Merge 885a3dd149
into b46a42b689
This commit is contained in:
commit
240a87d855
|
@ -242,7 +242,7 @@ private:
|
|||
}
|
||||
|
||||
} else {
|
||||
set_message(TTR("Please choose a \"project.godot\" or \".zip\" file."), MESSAGE_ERROR);
|
||||
set_message(TTR("Please choose a \"project.godot\", a directory with it, or a \".zip\" file."), MESSAGE_ERROR);
|
||||
memdelete(d);
|
||||
install_path_container->hide();
|
||||
get_ok_button()->set_disabled(true);
|
||||
|
@ -315,6 +315,9 @@ private:
|
|||
}
|
||||
|
||||
void _file_selected(const String &p_path) {
|
||||
// if not already shown
|
||||
show_dialog();
|
||||
|
||||
String p = p_path;
|
||||
if (mode == MODE_IMPORT) {
|
||||
if (p.ends_with("project.godot")) {
|
||||
|
@ -343,6 +346,9 @@ private:
|
|||
}
|
||||
|
||||
void _path_selected(const String &p_path) {
|
||||
// if not already shown
|
||||
show_dialog();
|
||||
|
||||
String sp = p_path.simplify_path();
|
||||
project_path->set_text(sp);
|
||||
_path_text_changed(sp);
|
||||
|
@ -360,7 +366,7 @@ private:
|
|||
fdialog->set_current_dir(project_path->get_text());
|
||||
|
||||
if (mode == MODE_IMPORT) {
|
||||
fdialog->set_file_mode(FileDialog::FILE_MODE_OPEN_FILE);
|
||||
fdialog->set_file_mode(FileDialog::FILE_MODE_OPEN_ANY);
|
||||
fdialog->clear_filters();
|
||||
fdialog->add_filter(vformat("project.godot ; %s %s", VERSION_NAME, TTR("Project")));
|
||||
fdialog->add_filter("*.zip ; " + TTR("ZIP File"));
|
||||
|
@ -679,6 +685,10 @@ public:
|
|||
project_path->set_text(p_path);
|
||||
}
|
||||
|
||||
void ask_for_path_and_show() {
|
||||
_browse_path();
|
||||
}
|
||||
|
||||
void show_dialog() {
|
||||
if (mode == MODE_RENAME) {
|
||||
project_path->set_editable(false);
|
||||
|
@ -2200,7 +2210,8 @@ void ProjectManager::_new_project() {
|
|||
|
||||
void ProjectManager::_import_project() {
|
||||
npdialog->set_mode(ProjectDialog::MODE_IMPORT);
|
||||
npdialog->show_dialog();
|
||||
|
||||
npdialog->ask_for_path_and_show();
|
||||
}
|
||||
|
||||
void ProjectManager::_rename_project() {
|
||||
|
|
|
@ -195,9 +195,10 @@ void FileDialog::_post_popup() {
|
|||
set_process_unhandled_input(true);
|
||||
|
||||
// For open dir mode, deselect all items on file dialog open.
|
||||
if (mode == FILE_MODE_OPEN_DIR) {
|
||||
if (mode == FILE_MODE_OPEN_DIR || mode == FILE_MODE_OPEN_ANY) {
|
||||
deselect_all();
|
||||
file_box->set_visible(false);
|
||||
if (mode == FILE_MODE_OPEN_DIR)
|
||||
file_box->set_visible(false);
|
||||
} else {
|
||||
file_box->set_visible(true);
|
||||
}
|
||||
|
@ -389,6 +390,7 @@ void FileDialog::_go_forward() {
|
|||
void FileDialog::deselect_all() {
|
||||
// Clear currently selected items in file manager.
|
||||
tree->deselect_all();
|
||||
file->set_text("");
|
||||
|
||||
// And change get_ok title.
|
||||
if (!tree->is_anything_selected()) {
|
||||
|
@ -399,10 +401,11 @@ void FileDialog::deselect_all() {
|
|||
case FILE_MODE_OPEN_FILES:
|
||||
get_ok_button()->set_text(TTRC("Open"));
|
||||
break;
|
||||
case FILE_MODE_OPEN_ANY:
|
||||
case FILE_MODE_OPEN_DIR:
|
||||
get_ok_button()->set_text(TTRC("Select Current Folder"));
|
||||
break;
|
||||
case FILE_MODE_OPEN_ANY:
|
||||
|
||||
case FILE_MODE_SAVE_FILE:
|
||||
// FIXME: Implement, or refactor to avoid duplication with set_mode
|
||||
break;
|
||||
|
@ -423,8 +426,14 @@ void FileDialog::_tree_selected() {
|
|||
|
||||
if (!d["dir"]) {
|
||||
file->set_text(d["name"]);
|
||||
} else if (mode == FILE_MODE_OPEN_DIR) {
|
||||
|
||||
if (mode == FILE_MODE_OPEN_ANY)
|
||||
get_ok_button()->set_text(TTRC("Open"));
|
||||
} else if (mode == FILE_MODE_OPEN_DIR || mode == FILE_MODE_OPEN_ANY) {
|
||||
get_ok_button()->set_text(TTRC("Select This Folder"));
|
||||
|
||||
if (mode == FILE_MODE_OPEN_ANY)
|
||||
file->set_text(d["name"]);
|
||||
}
|
||||
|
||||
get_ok_button()->set_disabled(_is_open_should_be_disabled());
|
||||
|
|
Loading…
Reference in a new issue