summaryrefslogtreecommitdiff
path: root/editor/settings_config_dialog.cpp
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2019-10-06 17:13:56 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2019-10-06 17:56:34 +0200
commit724b9bc0ce91fdb55c80fc0de25365c94f960364 (patch)
treea763f38f629b74ce2533399c0178f2b277874bfe /editor/settings_config_dialog.cpp
parent1d9233c3882afe888b9396f7f2aac917d4dcac4d (diff)
Focus the search box when pressing Ctrl+F in Project/Editor Settings
Diffstat (limited to 'editor/settings_config_dialog.cpp')
-rw-r--r--editor/settings_config_dialog.cpp50
1 files changed, 24 insertions, 26 deletions
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index c9c1f9c3e0..f8425ebe22 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -140,32 +140,35 @@ void EditorSettingsDialog::_notification(int p_what) {
void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
- Ref<InputEventKey> k = p_event;
+ const Ref<InputEventKey> k = p_event;
- if (k.is_valid() && is_window_modal_on_top()) {
+ if (k.is_valid() && is_window_modal_on_top() && k->is_pressed()) {
- if (k->is_pressed()) {
+ bool handled = false;
- bool handled = false;
+ if (ED_IS_SHORTCUT("editor/undo", p_event)) {
+ String action = undo_redo->get_current_action_name();
+ if (action != "")
+ EditorNode::get_log()->add_message("Undo: " + action, EditorLog::MSG_TYPE_EDITOR);
+ undo_redo->undo();
+ handled = true;
+ }
- if (ED_IS_SHORTCUT("editor/undo", p_event)) {
- String action = undo_redo->get_current_action_name();
- if (action != "")
- EditorNode::get_log()->add_message("Undo: " + action, EditorLog::MSG_TYPE_EDITOR);
- undo_redo->undo();
- handled = true;
- }
- if (ED_IS_SHORTCUT("editor/redo", p_event)) {
- undo_redo->redo();
- String action = undo_redo->get_current_action_name();
- if (action != "")
- EditorNode::get_log()->add_message("Redo: " + action, EditorLog::MSG_TYPE_EDITOR);
- handled = true;
- }
+ if (ED_IS_SHORTCUT("editor/redo", p_event)) {
+ undo_redo->redo();
+ String action = undo_redo->get_current_action_name();
+ if (action != "")
+ EditorNode::get_log()->add_message("Redo: " + action, EditorLog::MSG_TYPE_EDITOR);
+ handled = true;
+ }
- if (handled) {
- accept_event();
- }
+ if (k->get_scancode_with_modifiers() == (KEY_MASK_CMD | KEY_F)) {
+ _focus_current_search_box();
+ handled = true;
+ }
+
+ if (handled) {
+ accept_event();
}
}
}
@@ -408,7 +411,6 @@ EditorSettingsDialog::EditorSettingsDialog() {
tabs->set_tab_align(TabContainer::ALIGN_LEFT);
tabs->connect("tab_changed", this, "_tabs_tab_changed");
add_child(tabs);
- //set_child_rect(tabs);
// General Tab
@@ -425,7 +427,6 @@ EditorSettingsDialog::EditorSettingsDialog() {
hbc->add_child(search_box);
inspector = memnew(SectionedInspector);
- //inspector->hide_top_label();
inspector->get_inspector()->set_use_filter(true);
inspector->register_search_box(search_box);
inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
@@ -474,7 +475,6 @@ EditorSettingsDialog::EditorSettingsDialog() {
shortcuts->set_v_size_flags(SIZE_EXPAND_FILL);
shortcuts->set_columns(2);
shortcuts->set_hide_root(true);
- //shortcuts->set_hide_folding(true);
shortcuts->set_column_titles_visible(true);
shortcuts->set_column_title(0, TTR("Name"));
shortcuts->set_column_title(1, TTR("Binding"));
@@ -495,9 +495,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
press_a_key->connect("gui_input", this, "_wait_for_key");
press_a_key->connect("confirmed", this, "_press_a_key_confirm");
- //get_ok()->set_text("Apply");
set_hide_on_ok(true);
- //get_cancel()->set_text("Close");
timer = memnew(Timer);
timer->set_wait_time(1.5);