Add Show In File Manager to project manager
This commit is contained in:
parent
d91464f217
commit
e9255375f3
2 changed files with 26 additions and 2 deletions
|
@ -504,7 +504,7 @@ void ProjectManager::_update_project_buttons() {
|
|||
has_runnable_scene = true;
|
||||
break;
|
||||
}
|
||||
|
||||
show_btn->set_disabled(selected_list.size() < 1);
|
||||
erase_btn->set_disabled(selected_list.size() < 1);
|
||||
open_btn->set_disabled(selected_list.size() < 1);
|
||||
run_btn->set_disabled(!has_runnable_scene);
|
||||
|
@ -1105,6 +1105,22 @@ void ProjectManager::_erase_project() {
|
|||
erase_ask->popup_centered_minsize();
|
||||
}
|
||||
|
||||
void ProjectManager::_show_project() {
|
||||
if (selected_list.size() == 0)
|
||||
return;
|
||||
for (Map<String, String>::Element *E = selected_list.front(); E; E = E->next()) {
|
||||
const String &selected = E->key();
|
||||
String path = EditorSettings::get_singleton()->get("projects/" + selected);
|
||||
String conf = path + "/engine.cfg";
|
||||
if (!FileAccess::exists(conf)) {
|
||||
multi_open_ask->set_text(TTR("Can't show project"));
|
||||
multi_open_ask->popup_centered_minsize();
|
||||
return;
|
||||
}
|
||||
OS::get_singleton()->shell_open(String("file://") + path);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectManager::_exit_dialog() {
|
||||
|
||||
get_tree()->quit();
|
||||
|
@ -1177,6 +1193,7 @@ void ProjectManager::_bind_methods() {
|
|||
ObjectTypeDB::bind_method("_new_project", &ProjectManager::_new_project);
|
||||
ObjectTypeDB::bind_method("_erase_project", &ProjectManager::_erase_project);
|
||||
ObjectTypeDB::bind_method("_erase_project_confirm", &ProjectManager::_erase_project_confirm);
|
||||
ObjectTypeDB::bind_method("_show_project", &ProjectManager::_show_project);
|
||||
ObjectTypeDB::bind_method("_exit_dialog", &ProjectManager::_exit_dialog);
|
||||
ObjectTypeDB::bind_method("_load_recent_projects", &ProjectManager::_load_recent_projects);
|
||||
ObjectTypeDB::bind_method("_on_project_created", &ProjectManager::_on_project_created);
|
||||
|
@ -1337,6 +1354,12 @@ ProjectManager::ProjectManager() {
|
|||
erase->connect("pressed", this, "_erase_project");
|
||||
erase_btn = erase;
|
||||
|
||||
Button *showinfilemanager = memnew(Button);
|
||||
showinfilemanager->set_text(TTR("Show In File Manager"));
|
||||
tree_vb->add_child(showinfilemanager);
|
||||
showinfilemanager->connect("pressed", this, "_show_project");
|
||||
show_btn = showinfilemanager;
|
||||
|
||||
tree_vb->add_spacer();
|
||||
|
||||
if (StreamPeerSSL::is_available()) {
|
||||
|
|
|
@ -42,7 +42,7 @@ class ProjectListFilter;
|
|||
|
||||
class ProjectManager : public Control {
|
||||
OBJ_TYPE(ProjectManager, Control);
|
||||
|
||||
Button *show_btn;
|
||||
Button *erase_btn;
|
||||
Button *open_btn;
|
||||
Button *run_btn;
|
||||
|
@ -78,6 +78,7 @@ class ProjectManager : public Control {
|
|||
void _import_project();
|
||||
void _new_project();
|
||||
void _erase_project();
|
||||
void _show_project();
|
||||
void _erase_project_confirm();
|
||||
void _update_project_buttons();
|
||||
void _exit_dialog();
|
||||
|
|
Loading…
Reference in a new issue