diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-02-16 15:26:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-16 15:26:02 +0100 |
commit | b5c0a892d45b1a9df10aaf0f468252925ea2a4b9 (patch) | |
tree | ca006460a31bf1ec8031e40952394a39e824d5f0 /editor/find_in_files.cpp | |
parent | eeda603355bdaf76d138d2646b3e4316924efe29 (diff) | |
parent | dcd2a92af3cc85b50ee2c02dc64589da6d429e8c (diff) |
Merge pull request #58163 from jmb462/notification-chunk-A
Diffstat (limited to 'editor/find_in_files.cpp')
-rw-r--r-- | editor/find_in_files.cpp | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 929f8b8d2c..eff9185c71 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -103,9 +103,11 @@ void FindInFiles::set_filter(const Set<String> &exts) { _extension_filter = exts; } -void FindInFiles::_notification(int p_notification) { - if (p_notification == NOTIFICATION_PROCESS) { - _process(); +void FindInFiles::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_PROCESS: { + _process(); + } break; } } @@ -456,26 +458,28 @@ Set<String> FindInFilesDialog::get_filter() const { } void FindInFilesDialog::_notification(int p_what) { - if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { - if (is_visible()) { - // Doesn't work more than once if not deferred... - _search_text_line_edit->call_deferred(SNAME("grab_focus")); - _search_text_line_edit->select_all(); - // Extensions might have changed in the meantime, we clean them and instance them again. - for (int i = 0; i < _filters_container->get_child_count(); i++) { - _filters_container->get_child(i)->queue_delete(); - } - Array exts = ProjectSettings::get_singleton()->get("editor/script/search_in_file_extensions"); - for (int i = 0; i < exts.size(); ++i) { - CheckBox *cb = memnew(CheckBox); - cb->set_text(exts[i]); - if (!_filters_preferences.has(exts[i])) { - _filters_preferences[exts[i]] = true; + switch (p_what) { + case NOTIFICATION_VISIBILITY_CHANGED: { + if (is_visible()) { + // Doesn't work more than once if not deferred... + _search_text_line_edit->call_deferred(SNAME("grab_focus")); + _search_text_line_edit->select_all(); + // Extensions might have changed in the meantime, we clean them and instance them again. + for (int i = 0; i < _filters_container->get_child_count(); i++) { + _filters_container->get_child(i)->queue_delete(); + } + Array exts = ProjectSettings::get_singleton()->get("editor/script/search_in_file_extensions"); + for (int i = 0; i < exts.size(); ++i) { + CheckBox *cb = memnew(CheckBox); + cb->set_text(exts[i]); + if (!_filters_preferences.has(exts[i])) { + _filters_preferences[exts[i]] = true; + } + cb->set_pressed(_filters_preferences[exts[i]]); + _filters_container->add_child(cb); } - cb->set_pressed(_filters_preferences[exts[i]]); - _filters_container->add_child(cb); } - } + } break; } } @@ -687,11 +691,15 @@ void FindInFilesPanel::stop_search() { } void FindInFilesPanel::_notification(int p_what) { - if (p_what == NOTIFICATION_PROCESS) { - _progress_bar->set_as_ratio(_finder->get_progress()); - } else if (p_what == NOTIFICATION_THEME_CHANGED) { - _search_text_label->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts"))); - _results_display->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts"))); + switch (p_what) { + case NOTIFICATION_PROCESS: { + _progress_bar->set_as_ratio(_finder->get_progress()); + } break; + + case NOTIFICATION_THEME_CHANGED: { + _search_text_label->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts"))); + _results_display->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts"))); + } break; } } |