// validator/locale for input
QString amount_rx = R"(^\d{0,8}[\.]\d{0,12}$)";
- QRegExp rx;
+ QRegularExpression rx;
rx.setPattern(amount_rx);
- QValidator *validator = new QRegExpValidator(rx, this);
+ QValidator *validator = new QRegularExpressionValidator(rx, this);
ui->lineFrom->setValidator(validator);
ui->lineTo->setValidator(validator);
ui->setupUi(this);
QString amount_rx = R"(^\d{0,8}[\.,]\d{0,12}|(all)$)";
- QRegExp rx;
+ QRegularExpression rx;
rx.setPattern(amount_rx);
- QValidator *validator = new QRegExpValidator(rx, this);
+ QValidator *validator = new QRegularExpressionValidator(rx, this);
ui->lineAmount->setValidator(validator);
connect(m_ctx.get(), &AppContext::initiateTransaction, this, &SendWidget::onInitiateTransaction);
#include <QClipboard>
#include <QFileDialog>
#include <QMessageBox>
-#include <QRegExpValidator>
+#include <QRegularExpressionValidator>
#include "WalletManager.h"
ui->setupUi(this);
QString amount_rx = R"(^\d{0,8}[\.]\d{0,12}|(all)$)";
- QRegExp rx;
+ QRegularExpression rx;
rx.setPattern(amount_rx);
- QValidator *validator = new QRegExpValidator(rx, this);
+ QValidator *validator = new QRegularExpressionValidator(rx, this);
ui->line_amountXMR->setValidator(validator);
connect(ui->line_amountXMR, &QLineEdit::textChanged, this, &PaymentRequestDialog::updatePaymentRequest);
}
if (!trailing_zeroes) {
- amountStr.remove(QRegExp("0+$"));
- amountStr.remove(QRegExp("\\.$"));
+ amountStr.remove(QRegularExpression("0+$"));
+ amountStr.remove(QRegularExpression("\\.$"));
}
return amountStr;
: QSortFilterProxyModel(parent),
m_searchRegExp("")
{
- m_searchRegExp.setCaseSensitivity(Qt::CaseInsensitive);
- m_searchRegExp.setPatternSyntax(QRegExp::RegExp);
+ m_searchRegExp.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
}
bool AddressBookProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
}
private:
- QRegExp m_searchRegExp;
+ QRegularExpression m_searchRegExp;
};
#endif //FEATHER_ADDRESSBOOKPROXYMODEL_H
, m_searchCaseSensitiveRegExp("")
, m_hidePrimary(hidePrimary)
{
- m_searchRegExp.setCaseSensitivity(Qt::CaseInsensitive);
- m_searchRegExp.setPatternSyntax(QRegExp::FixedString);
- m_searchCaseSensitiveRegExp.setPatternSyntax(QRegExp::FixedString);
+ m_searchRegExp.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
}
bool SubaddressProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
return false;
}
- if (!m_searchRegExp.isEmpty()) {
+ if (!m_searchRegExp.pattern().isEmpty()) {
return address.contains(m_searchCaseSensitiveRegExp) || label.contains(m_searchRegExp);
}
return (m_showUsed || !isUsed);
Subaddress *m_subaddress;
QStringList m_hiddenAddresses;
- QRegExp m_searchRegExp;
- QRegExp m_searchCaseSensitiveRegExp;
+ QRegularExpression m_searchRegExp;
+ QRegularExpression m_searchCaseSensitiveRegExp;
bool m_showUsed = false;
bool m_showHidden = false;
bool m_hidePrimary;
qint64 WalletKeysFile::getModified(const QFileInfo &info) {
qint64 m = info.lastModified().toSecsSinceEpoch();
- QFileInfo cacheFile = QFileInfo(info.absoluteFilePath().replace(QRegExp(".keys$"), ""));
+ QFileInfo cacheFile = QFileInfo(info.absoluteFilePath().replace(QRegularExpression(".keys$"), ""));
qint64 cacheLastModified = cacheFile.lastModified().toSecsSinceEpoch();
if (cacheFile.exists() && cacheLastModified > m) {
m = cacheLastModified;
qDebug() << "wallet .keys search initiated";
auto now = high_resolution_clock::now();
- QRegExp rx("*.keys");
- rx.setPatternSyntax(QRegExp::Wildcard);
+ QRegularExpression rx(QRegularExpression::wildcardToRegularExpression("*.keys"));
QStringList walletPaths;
for(auto i = 0; i != m_walletDirectories.length(); i++) {
#include "utils/TorManager.h"
#include <QScreen>
-#include <QDesktopWidget>
#include <QDesktopServices>
#include <QRegularExpression>
#include <cstdio>
#include <cstdlib>
#include <iostream>
-#include <QRegExp>
+#include <QRegularExpression>
#include <QtNetwork>
#include "utils/childproc.h"
#include "utils/SemanticVersion.h"
return false;
}
-QStringList fileFind(const QRegExp &pattern, const QString &baseDir, int level, int depth, const int maxPerDir) {
+QStringList fileFind(const QRegularExpression &pattern, const QString &baseDir, int level, int depth, const int maxPerDir) {
// like `find /foo -name -maxdepth 2 "*.jpg"`
QStringList rtn;
QDir dir(baseDir);
const auto fn = fileInfo.fileName();
const auto path = fileInfo.filePath();
+ QRegularExpression re(QRegularExpression::anchoredPattern(pattern.pattern()));
+ QRegularExpressionMatch match = re.match(fn);
+
if (fileInfo.isDir()) {
if (level + 1 <= depth)
rtn << fileFind(pattern, path, level + 1, depth, maxPerDir);
}
- else if (pattern.exactMatch(fn))
+ else if (match.hasMatch()) {
rtn << path;
+ }
}
return rtn;
}
#ifndef FEATHER_UTILS_H
#define FEATHER_UTILS_H
-#include <QRegExp>
+#include <QRegularExpression>
#include <QStandardItemModel>
#include <QApplication>
#include <QTextCharFormat>
QByteArray fileOpenQRC(const QString &path);
bool fileWrite(const QString &path, const QString &data);
bool pixmapWrite(const QString &path, const QPixmap &pixmap);
- QStringList fileFind(const QRegExp &pattern, const QString &baseDir, int level, int depth, int maxPerDir);
+ QStringList fileFind(const QRegularExpression &pattern, const QString &baseDir, int level, int depth, int maxPerDir);
bool dirExists(const QString &path);
QString defaultWalletDir();
#ifndef FEATHER_NETWORKING_H
#define FEATHER_NETWORKING_H
-#include <QRegExp>
+#include <QRegularExpression>
#include <QtNetwork>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#define FEATHER_NODES_H
#include <QTimer>
-#include <QRegExp>
+#include <QRegularExpression>
#include <QApplication>
#include <QtNetwork>
#include <QNetworkAccessManager>
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-FileCopyrightText: 2020-2022 The Monero Project
-#include <QRegExp>
+#include <QRegularExpression>
#include <QMessageBox>
#include "tails.h"
return "";
QByteArray data = Utils::fileOpen("/etc/os-release");
- QRegExp re(R"(TAILS_VERSION_ID="(\d+.\d+))");
- int pos = re.indexIn(data);
- if (pos >= 0) {
- return re.cap(1);
+ QRegularExpression re(R"(TAILS_VERSION_ID="(\d+.\d+))");
+ QRegularExpressionMatch match = re.match(data);
+ if (match.hasMatch()) {
+ return match.captured(1);
}
return "";
}
// SPDX-FileCopyrightText: 2020-2022 The Monero Project
#include <QScreen>
-#include <QDesktopWidget>
#include <QDesktopServices>
#include "utils/Utils.h"
#include <cstdio>
#include <cstdlib>
#include <iostream>
-#include <QRegExp>
+#include <QRegularExpression>
#include <QtNetwork>
#include <QApplication>
#include <QMainWindow>
{
ui->setupUi(this);
- QRegExp yearRe(R"(\d{2,4}-\d{1,2}-\d{1,2})");
- QValidator *yearValidator = new QRegExpValidator(yearRe, this);
+ QRegularExpression yearRe(R"(\d{2,4}-\d{1,2}-\d{1,2})");
+ QValidator *yearValidator = new QRegularExpressionValidator(yearRe, this);
ui->line_creationDate->setValidator(yearValidator);
- QRegExp heightRe(R"(\d{7})");
- QValidator *heightValidator = new QRegExpValidator(heightRe, this);
+ QRegularExpression heightRe(R"(\d{7})");
+ QValidator *heightValidator = new QRegularExpressionValidator(heightRe, this);
ui->line_restoreHeight->setValidator(heightValidator);
connect(ui->line_creationDate, &QLineEdit::textEdited, this, &RestoreHeightWidget::onCreationDateChanged);
{
ui->setupUi(this);
- QRegExp yearRe(R"(\d{2,4}-\d{1,2}-\d{1,2})");
- QValidator *yearValidator = new QRegExpValidator(yearRe, this);
+ QRegularExpression yearRe(R"(\d{2,4}-\d{1,2}-\d{1,2})");
+ QValidator *yearValidator = new QRegularExpressionValidator(yearRe, this);
ui->line_creationDate->setValidator(yearValidator);
- QRegExp heightRe(R"(\d{7})");
- QValidator *heightValidator = new QRegExpValidator(heightRe, this);
+ QRegularExpression heightRe(R"(\d{7})");
+ QValidator *heightValidator = new QRegularExpressionValidator(heightRe, this);
ui->line_restoreHeight->setValidator(heightValidator);
QPixmap pixmap = QPixmap(":/assets/images/unpaid.png");