Picking up #606 (labeled "Up for grabs") and applying #606#pullrequestreview-984607067 and #606 (comment).
Replaces occurrences of QRegExp usage with QRegularExpression as part of the roadmap for Qt6 integration.
Picking up #606 (labeled "Up for grabs") and applying #606#pullrequestreview-984607067 and #606 (comment).
Replaces occurrences of QRegExp usage with QRegularExpression as part of the roadmap for Qt6 integration.
What is your opinion about #606 (comment)?
That looks good to me. I'll take a look at it. Would you suggest a class/file to allocate the utility function?
What is your opinion about #606 (comment)?
That looks good to me. I'll take a look at it. Would you suggest a class/file to allocate the utility function?
namespace GUIUtil in qt/guiutil.{h,cpp}?
134 | + 135 | + filter = QString("PNG Image (*.png)"); 136 | + QCOMPARE(GUIUtil::extractFirstSuffixFromFilter(filter), "png"); 137 | + 138 | + filter = QString("Wallet Data (*.dat)"); 139 | + QCOMPARE(GUIUtil::extractFirstSuffixFromFilter(filter), "dat");
Why 4 tests with the only suffix? Maybe just two tests? First test with one suffix, another one with two suffixes.
135 | + filter = QString("PNG Image (*.png)"); 136 | + QCOMPARE(GUIUtil::extractFirstSuffixFromFilter(filter), "png"); 137 | + 138 | + filter = QString("Wallet Data (*.dat)"); 139 | + QCOMPARE(GUIUtil::extractFirstSuffixFromFilter(filter), "dat"); 140 | +
Drop empty line?
21 | @@ -22,7 +22,7 @@ 22 | #include <QCloseEvent> 23 | #include <QLabel> 24 | #include <QMainWindow> 25 | -#include <QRegExp> 26 | +#include <QRegularExpression>
Add #include <QString> as well (due to using QStringLiteral)?
Approach ACK c0c8b33748637372ee5b267f6bbcce33a5380f4d.
Suggesting to split the first commit into separated ones:
extractFirstSuffixFromFilter() function (I'd prefer to use UpperCamelCase name convention for this new standalone function)QRegExp with QRegularExpressionAlso please apply clang-format-diff.py for each your commit.
Extract the 'Extract first suffix from filter pattern...'
functionality into a testable utility function
Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
Co-authored-by: Jarol Rodriguez <jarolrod@tutanota.com>
122 | @@ -123,6 +123,13 @@ namespace GUIUtil 123 | */ 124 | QString getDefaultDataDirectory(); 125 | 126 | + 127 | + /** Extract first suffix from filter pattern "Description (*.foo)" or "Description (*.foo *.bar ...). 128 | + 129 | + @param[in] filter Filter specification such as "Comma Separated Files (*.csv)" 130 | + */
Please consult with Coding Style (Doxygen-compatible comments).
@hebasto thanks for the review. Force-pushed https://github.com/bitcoin-core/gui/pull/620/commits/67364ebe4c499eb8effe8dac11a5e3648f30c6c7 addressing your suggestions.
ACK 67364ebe4c499eb8effe8dac11a5e3648f30c6c7
Code review and lightly tested ACK 67364ebe4c499eb8effe8dac11a5e3648f30c6c7