mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-09 14:41:42 +02:00
qt: Replace QRegExp
with QRegularExpression
Co-authored-by: Pavol Rusnak <pavol@rusnak.io> Co-authored-by: Jarol Rodriguez <jarolrod@tutanota.com>
This commit is contained in:
parent
c378535e28
commit
ace9af5688
@ -56,6 +56,7 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPluginLoader>
|
#include <QPluginLoader>
|
||||||
#include <QProgressDialog>
|
#include <QProgressDialog>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
@ -294,10 +295,11 @@ QString getDefaultDataDirectory()
|
|||||||
|
|
||||||
QString ExtractFirstSuffixFromFilter(const QString& filter)
|
QString ExtractFirstSuffixFromFilter(const QString& filter)
|
||||||
{
|
{
|
||||||
QRegExp filter_re(".* \\(\\*\\.(.*)[ \\)]");
|
QRegularExpression filter_re(QStringLiteral(".* \\(\\*\\.(.*)[ \\)]"), QRegularExpression::InvertedGreedinessOption);
|
||||||
QString suffix;
|
QString suffix;
|
||||||
if (filter_re.exactMatch(filter)) {
|
QRegularExpressionMatch m = filter_re.match(filter);
|
||||||
suffix = filter_re.cap(1);
|
if (m.hasMatch()) {
|
||||||
|
suffix = m.captured(1);
|
||||||
}
|
}
|
||||||
return suffix;
|
return suffix;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QRegExp>
|
#include <QRegularExpression>
|
||||||
|
#include <QString>
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
#include <QTextTable>
|
#include <QTextTable>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
@ -44,9 +45,8 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
|
|||||||
/// HTML-format the license message from the core
|
/// HTML-format the license message from the core
|
||||||
QString licenseInfoHTML = QString::fromStdString(LicenseInfo());
|
QString licenseInfoHTML = QString::fromStdString(LicenseInfo());
|
||||||
// Make URLs clickable
|
// Make URLs clickable
|
||||||
QRegExp uri("<(.*)>", Qt::CaseSensitive, QRegExp::RegExp2);
|
QRegularExpression uri(QStringLiteral("<(.*)>"), QRegularExpression::InvertedGreedinessOption);
|
||||||
uri.setMinimal(true); // use non-greedy matching
|
licenseInfoHTML.replace(uri, QStringLiteral("<a href=\"\\1\">\\1</a>"));
|
||||||
licenseInfoHTML.replace(uri, "<a href=\"\\1\">\\1</a>");
|
|
||||||
// Replace newlines with HTML breaks
|
// Replace newlines with HTML breaks
|
||||||
licenseInfoHTML.replace("\n", "<br>");
|
licenseInfoHTML.replace("\n", "<br>");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user