Add keyboard shortcuts to the project manager
- Ctrl + N: New Project
- Ctrl + I: Import Project
- Ctrl + S: Scan for Projects
- Ctrl + E: Edit Project
- Ctrl + R: Run Project
- F2: Rename Project
- Delete: Remove Project
- Already implemented previously, but moved to use `ED_SHORTCUT()`.
Note that depsite using `ED_SHORTCUT()`, these shortcuts won't appear
in the Editor Settings' Shortcuts dialog and won't be remappable since
the project manager code isn't run in the editor.
(cherry picked from commit 9bda49e030
)
This commit is contained in:
parent
bf22de76f7
commit
8beb57476f
1 changed files with 7 additions and 3 deletions
|
@ -1848,9 +1848,6 @@ void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) {
|
|||
case KEY_ENTER: {
|
||||
_open_selected_projects_ask();
|
||||
} break;
|
||||
case KEY_DELETE: {
|
||||
_erase_project();
|
||||
} break;
|
||||
case KEY_HOME: {
|
||||
if (_project_list->get_project_count() > 0) {
|
||||
_project_list->select_project(0);
|
||||
|
@ -2491,12 +2488,14 @@ ProjectManager::ProjectManager() {
|
|||
|
||||
Button *open = memnew(Button);
|
||||
open->set_text(TTR("Edit"));
|
||||
open->set_shortcut(ED_SHORTCUT("project_manager/edit_project", TTR("Edit Project"), KEY_MASK_CMD | KEY_E));
|
||||
tree_vb->add_child(open);
|
||||
open->connect("pressed", this, "_open_selected_projects_ask");
|
||||
open_btn = open;
|
||||
|
||||
Button *run = memnew(Button);
|
||||
run->set_text(TTR("Run"));
|
||||
run->set_shortcut(ED_SHORTCUT("project_manager/run_project", TTR("Run Project"), KEY_MASK_CMD | KEY_R));
|
||||
tree_vb->add_child(run);
|
||||
run->connect("pressed", this, "_run_project");
|
||||
run_btn = run;
|
||||
|
@ -2505,6 +2504,7 @@ ProjectManager::ProjectManager() {
|
|||
|
||||
Button *scan = memnew(Button);
|
||||
scan->set_text(TTR("Scan"));
|
||||
scan->set_shortcut(ED_SHORTCUT("project_manager/scan_projects", TTR("Scan Projects"), KEY_MASK_CMD | KEY_S));
|
||||
tree_vb->add_child(scan);
|
||||
scan->connect("pressed", this, "_scan_projects");
|
||||
|
||||
|
@ -2520,22 +2520,26 @@ ProjectManager::ProjectManager() {
|
|||
|
||||
Button *create = memnew(Button);
|
||||
create->set_text(TTR("New Project"));
|
||||
create->set_shortcut(ED_SHORTCUT("project_manager/new_project", TTR("New Project"), KEY_MASK_CMD | KEY_N));
|
||||
tree_vb->add_child(create);
|
||||
create->connect("pressed", this, "_new_project");
|
||||
|
||||
Button *import = memnew(Button);
|
||||
import->set_text(TTR("Import"));
|
||||
import->set_shortcut(ED_SHORTCUT("project_manager/import_project", TTR("Import Project"), KEY_MASK_CMD | KEY_I));
|
||||
tree_vb->add_child(import);
|
||||
import->connect("pressed", this, "_import_project");
|
||||
|
||||
Button *rename = memnew(Button);
|
||||
rename->set_text(TTR("Rename"));
|
||||
rename->set_shortcut(ED_SHORTCUT("project_manager/rename_project", TTR("Rename Project"), KEY_F2));
|
||||
tree_vb->add_child(rename);
|
||||
rename->connect("pressed", this, "_rename_project");
|
||||
rename_btn = rename;
|
||||
|
||||
Button *erase = memnew(Button);
|
||||
erase->set_text(TTR("Remove"));
|
||||
erase->set_shortcut(ED_SHORTCUT("project_manager/remove_project", TTR("Remove Project"), KEY_DELETE));
|
||||
tree_vb->add_child(erase);
|
||||
erase->connect("pressed", this, "_erase_project");
|
||||
erase_btn = erase;
|
||||
|
|
Loading…
Reference in a new issue