diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-02-27 20:19:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-27 20:19:55 +0100 |
commit | 7530824cc49242b4c760112ecd6b8b5be1e4a495 (patch) | |
tree | b2bddb3ccb6bb7fcc7a002f8a1763b4d8a8cda31 /editor | |
parent | 2b3431e2b7706894d1aeb865f7b4ef93345bbbd4 (diff) | |
parent | 8c80b602ac51c5bceec4f767692e694d9ce73450 (diff) |
Merge pull request #36077 from pycbouh/repeat-search-in-files
Add a button to quickly repeat last search in files
Diffstat (limited to 'editor')
-rw-r--r-- | editor/find_in_files.cpp | 14 | ||||
-rw-r--r-- | editor/find_in_files.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 5c012183e7..cdac5a7f27 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -594,6 +594,12 @@ FindInFilesPanel::FindInFilesPanel() { _status_label = memnew(Label); hbc->add_child(_status_label); + _refresh_button = memnew(Button); + _refresh_button->set_text(TTR("Refresh")); + _refresh_button->connect("pressed", this, "_on_refresh_button_clicked"); + _refresh_button->hide(); + hbc->add_child(_refresh_button); + _cancel_button = memnew(Button); _cancel_button->set_text(TTR("Cancel")); _cancel_button->connect_compat("pressed", this, "_on_cancel_button_clicked"); @@ -681,6 +687,7 @@ void FindInFilesPanel::start_search() { _finder->start(); update_replace_buttons(); + _refresh_button->hide(); _cancel_button->show(); } @@ -691,6 +698,7 @@ void FindInFilesPanel::stop_search() { _status_label->set_text(""); update_replace_buttons(); set_progress_visible(false); + _refresh_button->show(); _cancel_button->hide(); } @@ -793,9 +801,14 @@ void FindInFilesPanel::_on_finished() { _status_label->set_text(TTR("Search complete")); update_replace_buttons(); set_progress_visible(false); + _refresh_button->show(); _cancel_button->hide(); } +void FindInFilesPanel::_on_refresh_button_clicked() { + start_search(); +} + void FindInFilesPanel::_on_cancel_button_clicked() { stop_search(); } @@ -970,6 +983,7 @@ void FindInFilesPanel::_bind_methods() { ClassDB::bind_method("_on_result_found", &FindInFilesPanel::_on_result_found); ClassDB::bind_method("_on_item_edited", &FindInFilesPanel::_on_item_edited); ClassDB::bind_method("_on_finished", &FindInFilesPanel::_on_finished); + ClassDB::bind_method("_on_refresh_button_clicked", &FindInFilesPanel::_on_refresh_button_clicked); ClassDB::bind_method("_on_cancel_button_clicked", &FindInFilesPanel::_on_cancel_button_clicked); ClassDB::bind_method("_on_result_selected", &FindInFilesPanel::_on_result_selected); ClassDB::bind_method("_on_replace_text_changed", &FindInFilesPanel::_on_replace_text_changed); diff --git a/editor/find_in_files.h b/editor/find_in_files.h index 5dc4ef5e19..7002f750b7 100644 --- a/editor/find_in_files.h +++ b/editor/find_in_files.h @@ -179,6 +179,7 @@ protected: private: void _on_result_found(String fpath, int line_number, int begin, int end, String text); void _on_finished(); + void _on_refresh_button_clicked(); void _on_cancel_button_clicked(); void _on_result_selected(); void _on_item_edited(); @@ -206,6 +207,7 @@ private: Label *_search_text_label; Tree *_results_display; Label *_status_label; + Button *_refresh_button; Button *_cancel_button; ProgressBar *_progress_bar; Map<String, TreeItem *> _file_items; |