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;
|
||||
}
|
||||
|
@ -32,13 +32,13 @@ class SortProxy : public QSortFilterProxyModel {
|
||||
|
||||
const auto& mod = model->at(source_row);
|
||||
|
||||
if (mod.name().contains(filterRegExp()))
|
||||
if (mod.name().contains(filterRegularExpression()))
|
||||
return true;
|
||||
if (mod.description().contains(filterRegExp()))
|
||||
if (mod.description().contains(filterRegularExpression()))
|
||||
return true;
|
||||
|
||||
for (auto& author : mod.authors()) {
|
||||
if (author.contains(filterRegExp())) {
|
||||
if (author.contains(filterRegularExpression())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <QClipboard>
|
||||
#include <QKeyEvent>
|
||||
#include <QMenu>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
@ -154,7 +155,7 @@ public:
|
||||
if (role == Qt::DisplayRole || role == Qt::EditRole)
|
||||
{
|
||||
QVariant result = sourceModel()->data(mapToSource(proxyIndex), role);
|
||||
return result.toString().remove(QRegExp("\\.png$"));
|
||||
return result.toString().remove(QRegularExpression("\\.png$"));
|
||||
}
|
||||
if (role == Qt::DecorationRole)
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
protected:
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||
{
|
||||
const QString pattern = filterRegExp().pattern();
|
||||
const QString pattern = filterRegularExpression().pattern();
|
||||
const auto model = static_cast<PageModel *>(sourceModel());
|
||||
const auto page = model->pages().at(sourceRow);
|
||||
if (!page->shouldDisplay())
|
||||
|
Reference in New Issue
Block a user