| 470 | } |
| 471 | |
| 472 | EditorLog::EditorLog() { |
| 473 | save_state_timer = memnew(Timer); |
| 474 | save_state_timer->set_wait_time(2); |
| 475 | save_state_timer->set_one_shot(true); |
| 476 | save_state_timer->connect("timeout", callable_mp(this, &EditorLog::_save_state)); |
| 477 | add_child(save_state_timer); |
| 478 | |
| 479 | line_limit = int(EDITOR_GET("run/output/max_lines")); |
| 480 | EditorSettings::get_singleton()->connect("settings_changed", callable_mp(this, &EditorLog::_editor_settings_changed)); |
| 481 | |
| 482 | HBoxContainer *hb = this; |
| 483 | |
| 484 | VBoxContainer *vb_left = memnew(VBoxContainer); |
| 485 | vb_left->set_custom_minimum_size(Size2(0, 180) * EDSCALE); |
| 486 | vb_left->set_v_size_flags(SIZE_EXPAND_FILL); |
| 487 | vb_left->set_h_size_flags(SIZE_EXPAND_FILL); |
| 488 | hb->add_child(vb_left); |
| 489 | |
| 490 | // Log - Rich Text Label. |
| 491 | log = memnew(RichTextLabel); |
| 492 | log->set_threaded(true); |
| 493 | log->set_use_bbcode(true); |
| 494 | log->set_scroll_follow(true); |
| 495 | log->set_selection_enabled(true); |
| 496 | log->set_context_menu_enabled(true); |
| 497 | log->set_focus_mode(FOCUS_CLICK); |
| 498 | log->set_v_size_flags(SIZE_EXPAND_FILL); |
| 499 | log->set_h_size_flags(SIZE_EXPAND_FILL); |
| 500 | log->set_deselect_on_focus_loss_enabled(false); |
| 501 | log->connect("meta_clicked", callable_mp(this, &EditorLog::_meta_clicked)); |
| 502 | vb_left->add_child(log); |
| 503 | |
| 504 | // Search box |
| 505 | search_box = memnew(LineEdit); |
| 506 | search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); |
| 507 | search_box->set_placeholder(TTR("Filter Messages")); |
| 508 | search_box->set_accessibility_name(TTRC("Filter Messages")); |
| 509 | search_box->set_clear_button_enabled(true); |
| 510 | search_box->set_visible(true); |
| 511 | search_box->connect(SceneStringName(text_changed), callable_mp(this, &EditorLog::_search_changed)); |
| 512 | vb_left->add_child(search_box); |
| 513 | |
| 514 | VBoxContainer *vb_right = memnew(VBoxContainer); |
| 515 | hb->add_child(vb_right); |
| 516 | |
| 517 | // Tools grid |
| 518 | HBoxContainer *hb_tools = memnew(HBoxContainer); |
| 519 | hb_tools->set_h_size_flags(SIZE_SHRINK_CENTER); |
| 520 | vb_right->add_child(hb_tools); |
| 521 | |
| 522 | // Clear. |
| 523 | clear_button = memnew(Button); |
| 524 | clear_button->set_accessibility_name(TTRC("Clear Log")); |
| 525 | clear_button->set_theme_type_variation(SceneStringName(FlatButton)); |
| 526 | clear_button->set_focus_mode(FOCUS_ACCESSIBILITY); |
| 527 | clear_button->set_shortcut(ED_SHORTCUT("editor/clear_output", TTRC("Clear Output"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::ALT | Key::K)); |
| 528 | clear_button->connect(SceneStringName(pressed), callable_mp(this, &EditorLog::_clear_request)); |
| 529 | hb_tools->add_child(clear_button); |
nothing calls this directly
no test coverage detected