[Macro Execute Dialog] add file name and file content filtering #10714
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds 2 labels and 2 line edits above the macro files list box:
Find file: [LineEditFile] Find in files: [LineEditFindInFiles]
[macro file names list box]
LineEditFile text is used to search the filenames for matches to the filter the user has entered. Example: if the user types in "a" (without the quotes) then only files with "a" in the filename get listed in the list box. Regular expressions are supported. A check is done if the text entered is a valid regex expression. If it is not valid, then we use a simpler text search with QString::contains().
LineEditFindInFiles text is used to further filter the results of the first filter to only include files containing text entered in LineEditFindInFiles. This is also a regular expression search unless it's an invalid regex expression, in which case QString::contains() is used instead.
In the filtering process we skip as many loops as possible. For example, if there is no content filter then we don't bother loading and reading the files to search for matches to the empty string. If there is no filename filter, then we just apply the content filter to the unfiltered filenames.
All searches are case-insensitive.
Notice in the screenshot, the regular expression calls for file names with an _ followed by a capital letter, and yet the results contain lower case matches. I considered adding a checkbox for case-sensitive, but I don't want to clutter up the dialog.