refactor: replace QRegExp with QRegularExpression
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QAction>
|
||||
#include <QRegExpValidator>
|
||||
#include <QRegularExpressionValidator>
|
||||
#include <QJsonDocument>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -39,9 +39,9 @@ ProfileSetupDialog::ProfileSetupDialog(MinecraftAccountPtr accountToSetup, QWidg
|
||||
yellowIcon = APPLICATION->getThemedIcon("status-yellow");
|
||||
badIcon = APPLICATION->getThemedIcon("status-bad");
|
||||
|
||||
QRegExp permittedNames("[a-zA-Z0-9_]{3,16}");
|
||||
QRegularExpression permittedNames("[a-zA-Z0-9_]{3,16}");
|
||||
auto nameEdit = ui->nameEdit;
|
||||
nameEdit->setValidator(new QRegExpValidator(permittedNames));
|
||||
nameEdit->setValidator(new QRegularExpressionValidator(permittedNames));
|
||||
nameEdit->setClearButtonEnabled(true);
|
||||
validityAction = nameEdit->addAction(yellowIcon, QLineEdit::LeadingPosition);
|
||||
connect(nameEdit, &QLineEdit::textEdited, this, &ProfileSetupDialog::nameEdited);
|
||||
|
@@ -22,10 +22,10 @@ void SkinUploadDialog::on_buttonBox_accepted()
|
||||
{
|
||||
QString fileName;
|
||||
QString input = ui->skinPathTextBox->text();
|
||||
QRegExp urlPrefixMatcher("^([a-z]+)://.+$");
|
||||
QRegularExpression urlPrefixMatcher(QRegularExpression::anchoredPattern("^([a-z]+)://.+$"));
|
||||
bool isLocalFile = false;
|
||||
// it has an URL prefix -> it is an URL
|
||||
if(urlPrefixMatcher.exactMatch(input))
|
||||
if(urlPrefixMatcher.match(input).hasMatch()) // TODO: does this work?
|
||||
{
|
||||
QUrl fileURL = input;
|
||||
if(fileURL.isValid())
|
||||
|
@@ -58,7 +58,7 @@ QString reprocessMarkdown(QByteArray markdown)
|
||||
QString output = hoedown.process(markdown);
|
||||
|
||||
// HACK: easier than customizing hoedown
|
||||
output.replace(QRegExp("GH-([0-9]+)"), "<a href=\"https://github.com/PolyMC/PolyMC/issues/\\1\">GH-\\1</a>");
|
||||
output.replace(QRegularExpression("GH-([0-9]+)"), "<a href=\"https://github.com/PolyMC/PolyMC/issues/\\1\">GH-\\1</a>");
|
||||
qDebug() << output;
|
||||
return output;
|
||||
}
|
||||
|
Reference in New Issue
Block a user