summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-05-27 11:25:09 +0200
committerGitHub <noreply@github.com>2017-05-27 11:25:09 +0200
commit2b25147450f5ae14a5b08fa7e70c8b7aa8f63742 (patch)
tree2c653e1b1e473257b25817e3d36f59fc8f072d5c /editor
parentf89641907f8b45941f5e67891936ee8050a3ef92 (diff)
parent7661cb5a624a93d45f9986e4677cac7d29057917 (diff)
Merge pull request #8928 from nunodonato/helpmenu
Added an help menu
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_help.cpp2
-rw-r--r--editor/editor_node.cpp42
-rw-r--r--editor/editor_node.h9
-rw-r--r--editor/plugins/script_editor_plugin.cpp14
-rw-r--r--editor/plugins/script_editor_plugin.h1
5 files changed, 57 insertions, 11 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 5c5fc7c3d4..8fb307a77d 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -371,10 +371,12 @@ void EditorHelpIndex::_tree_item_selected() {
void EditorHelpIndex::select_class(const String &p_class) {
+ EditorNode *editor = EditorNode::get_singleton();
if (!tree_item_map.has(p_class))
return;
tree_item_map[p_class]->select(0);
class_list->ensure_cursor_is_visible();
+ editor->call("_editor_select", EditorNode::EDITOR_SCRIPT); // in case EditorHelpIndex beeen invoked on top of other editor window
}
void EditorHelpIndex::popup() {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index fd1ecc78b9..f00ad97ee8 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -2561,8 +2561,25 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file->popup_centered_ratio();
} break;
- case SETTINGS_ABOUT: {
-
+ case HELP_CLASSES: {
+ emit_signal("request_help_index", "");
+ } break;
+ case HELP_SEARCH: {
+ emit_signal("request_help_search", "");
+ } break;
+ case HELP_DOCS: {
+ OS::get_singleton()->shell_open("http://docs.godotengine.org/");
+ } break;
+ case HELP_QA: {
+ OS::get_singleton()->shell_open("https://godotengine.org/qa/");
+ } break;
+ case HELP_ISSUES: {
+ OS::get_singleton()->shell_open("https://github.com/godotengine/godot/issues");
+ } break;
+ case HELP_COMMUNITY: {
+ OS::get_singleton()->shell_open("https://godotengine.org/community");
+ } break;
+ case HELP_ABOUT: {
about->popup_centered_minsize(Size2(500, 130) * EDSCALE);
} break;
case SOURCES_REIMPORT: {
@@ -4823,6 +4840,7 @@ void EditorNode::_bind_methods() {
ADD_SIGNAL(MethodInfo("stop_pressed"));
ADD_SIGNAL(MethodInfo("request_help"));
ADD_SIGNAL(MethodInfo("request_help_search"));
+ ADD_SIGNAL(MethodInfo("request_help_index"));
ADD_SIGNAL(MethodInfo("script_add_function_request", PropertyInfo(Variant::OBJECT, "obj"), PropertyInfo(Variant::STRING, "function"), PropertyInfo(Variant::POOL_STRING_ARRAY, "args")));
ADD_SIGNAL(MethodInfo("resource_saved", PropertyInfo(Variant::OBJECT, "obj")));
}
@@ -5355,7 +5373,6 @@ EditorNode::EditorNode() {
left_menu_hb->add_child(settings_menu);
settings_menu->set_text(TTR("Editor"));
settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
- settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
//settings_menu->set_anchor(MARGIN_RIGHT,ANCHOR_END);
p = settings_menu->get_popup();
@@ -5368,13 +5385,26 @@ EditorNode::EditorNode() {
p->add_child(editor_layouts);
editor_layouts->connect("id_pressed", this, "_layout_menu_option");
p->add_submenu_item(TTR("Editor Layout"), "Layouts");
-
p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREN);
-
p->add_separator();
p->add_item(TTR("Manage Export Templates"), SETTINGS_MANAGE_EXPORT_TEMPLATES);
+
+ // Help Menu
+ MenuButton *help_menu = memnew(MenuButton);
+ left_menu_hb->add_child(help_menu);
+ help_menu->set_text(TTR("Help"));
+ help_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ p = help_menu->get_popup();
+ p->connect("id_pressed", this, "_menu_option");
+ p->add_icon_item(gui_base->get_icon("ClassList", "EditorIcons"), TTR("Classes"), HELP_CLASSES);
+ p->add_icon_item(gui_base->get_icon("Help", "EditorIcons"), TTR("Search"), HELP_SEARCH);
+ p->add_separator();
+ p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Online Docs"), HELP_DOCS);
+ p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Q&A"), HELP_QA);
+ p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Issue Tracker"), HELP_ISSUES);
+ p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Community"), HELP_COMMUNITY);
p->add_separator();
- p->add_item(TTR("About"), SETTINGS_ABOUT);
+ p->add_icon_item(gui_base->get_icon("GodotDocs", "EditorIcons"), TTR("About"), HELP_ABOUT);
//Separator *s1 = memnew( VSeparator );
//menu_panel->add_child(s1);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index b996505016..55b3aa94d3 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -186,12 +186,19 @@ private:
SETTINGS_PICK_MAIN_SCENE,
SETTINGS_TOGGLE_FULLSCREN,
SETTINGS_HELP,
- SETTINGS_ABOUT,
SOURCES_REIMPORT,
DEPENDENCY_LOAD_CHANGED_IMAGES,
DEPENDENCY_UPDATE_IMPORTED,
SCENE_TAB_CLOSE,
+ HELP_CLASSES,
+ HELP_SEARCH,
+ HELP_DOCS,
+ HELP_QA,
+ HELP_ISSUES,
+ HELP_COMMUNITY,
+ HELP_ABOUT,
+
IMPORT_PLUGIN_BASE = 100,
OBJECT_METHOD_BASE = 500,
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index d369064050..fde6d83aa8 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -38,7 +38,6 @@
#include "os/file_access.h"
#include "os/input.h"
#include "os/keyboard.h"
-#include "os/keyboard.h"
#include "os/os.h"
#include "scene/main/viewport.h"
@@ -48,6 +47,7 @@ void ScriptEditorBase::_bind_methods() {
ADD_SIGNAL(MethodInfo("name_changed"));
ADD_SIGNAL(MethodInfo("request_help_search", PropertyInfo(Variant::STRING, "topic")));
+ ADD_SIGNAL(MethodInfo("request_help_index"));
ADD_SIGNAL(MethodInfo("request_open_script_at_line", PropertyInfo(Variant::OBJECT, "script"), PropertyInfo(Variant::INT, "line")));
ADD_SIGNAL(MethodInfo("request_save_history"));
ADD_SIGNAL(MethodInfo("go_to_help", PropertyInfo(Variant::STRING, "what")));
@@ -1039,7 +1039,7 @@ void ScriptEditor::_notification(int p_what) {
EditorSettings::get_singleton()->connect("settings_changed", this, "_editor_settings_changed");
help_search->set_icon(get_icon("Help", "EditorIcons"));
- site_search->set_icon(get_icon("GodotDocs", "EditorIcons"));
+ site_search->set_icon(get_icon("Instance", "EditorIcons"));
class_search->set_icon(get_icon("ClassList", "EditorIcons"));
script_forward->set_icon(get_icon("Forward", "EditorIcons"));
@@ -1051,6 +1051,7 @@ void ScriptEditor::_notification(int p_what) {
get_tree()->connect("tree_changed", this, "_tree_changed");
editor->connect("request_help", this, "_request_help");
editor->connect("request_help_search", this, "_help_search");
+ editor->connect("request_help_index", this, "_help_index");
}
if (p_what == NOTIFICATION_EXIT_TREE) {
@@ -2028,6 +2029,10 @@ void ScriptEditor::set_live_auto_reload_running_scripts(bool p_enabled) {
auto_reload_running_scripts = p_enabled;
}
+void ScriptEditor::_help_index(String p_text) {
+ help_index->popup();
+}
+
void ScriptEditor::_help_search(String p_text) {
help_search_dialog->popup(p_text);
}
@@ -2069,6 +2074,7 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_goto_script_line", &ScriptEditor::_goto_script_line);
ClassDB::bind_method("_goto_script_line2", &ScriptEditor::_goto_script_line2);
ClassDB::bind_method("_help_search", &ScriptEditor::_help_search);
+ ClassDB::bind_method("_help_index", &ScriptEditor::_help_index);
ClassDB::bind_method("_save_history", &ScriptEditor::_save_history);
ClassDB::bind_method("_breaked", &ScriptEditor::_breaked);
@@ -2211,10 +2217,10 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
menu_hb->add_spacer();
site_search = memnew(ToolButton);
- site_search->set_text(TTR("Tutorials"));
+ site_search->set_text(TTR("Online Docs"));
site_search->connect("pressed", this, "_menu_option", varray(SEARCH_WEBSITE));
menu_hb->add_child(site_search);
- site_search->set_tooltip(TTR("Open https://godotengine.org at tutorials section."));
+ site_search->set_tooltip(TTR("Open Godot online documentation"));
class_search = memnew(ToolButton);
class_search->set_text(TTR("Classes"));
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index fb2f108277..455a888f0e 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -291,6 +291,7 @@ class ScriptEditor : public VBoxContainer {
void _unhandled_input(const Ref<InputEvent> &p_event);
void _help_search(String p_text);
+ void _help_index(String p_text);
void _history_forward();
void _history_back();