forked from qt-creator/qt-creator
Plugins M-V: Make static QRegularExpression instances static const
Change-Id: I291e61ac30786dfceda330d3dc73352da719c7d0 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -169,8 +169,8 @@ QString MercurialCommitWidget::repoRoot() const
|
|||||||
|
|
||||||
QString MercurialCommitWidget::cleanupDescription(const QString &input) const
|
QString MercurialCommitWidget::cleanupDescription(const QString &input) const
|
||||||
{
|
{
|
||||||
const QRegularExpression commentLine(QLatin1String("^HG:[^\\n]*(\\n|$)"),
|
static const QRegularExpression commentLine(QLatin1String("^HG:[^\\n]*(\\n|$)"),
|
||||||
QRegularExpression::MultilineOption);
|
QRegularExpression::MultilineOption);
|
||||||
QString message = input;
|
QString message = input;
|
||||||
message.remove(commentLine);
|
message.remove(commentLine);
|
||||||
return message;
|
return message;
|
||||||
|
@@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
namespace MesonProjectManager::Internal {
|
namespace MesonProjectManager::Internal {
|
||||||
|
|
||||||
static QRegularExpression ®Exp()
|
static const QRegularExpression ®Exp()
|
||||||
{
|
{
|
||||||
static QRegularExpression s_regexp{R"('([^']+)'+|([^', ]+)[, ]*)"};
|
static const QRegularExpression s_regexp{R"('([^']+)'+|([^', ]+)[, ]*)"};
|
||||||
return s_regexp;
|
return s_regexp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -107,7 +107,7 @@ bool NimToolchain::parseVersion(const FilePath &path, std::tuple<int, int, int>
|
|||||||
const QString version = process.readAllStandardOutput().section('\n', 0, 0);
|
const QString version = process.readAllStandardOutput().section('\n', 0, 0);
|
||||||
if (version.isEmpty())
|
if (version.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
const QRegularExpression regex("(\\d+)\\.(\\d+)\\.(\\d+)");
|
static const QRegularExpression regex("(\\d+)\\.(\\d+)\\.(\\d+)");
|
||||||
const QRegularExpressionMatch match = regex.match(version);
|
const QRegularExpressionMatch match = regex.match(version);
|
||||||
if (!match.hasMatch())
|
if (!match.hasMatch())
|
||||||
return false;
|
return false;
|
||||||
|
@@ -29,7 +29,7 @@ PendingChangesDialog::PendingChangesDialog(const QString &data, QWidget *parent)
|
|||||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
|
|
||||||
if (!data.isEmpty()) {
|
if (!data.isEmpty()) {
|
||||||
const QRegularExpression r(QLatin1String("Change\\s(\\d+?).*?\\s\\*?pending\\*?\\s(.+?)\n"));
|
static const QRegularExpression r("Change\\s(\\d+?).*?\\s\\*?pending\\*?\\s(.+?)\n");
|
||||||
QListWidgetItem *item;
|
QListWidgetItem *item;
|
||||||
QRegularExpressionMatchIterator it = r.globalMatch(data);
|
QRegularExpressionMatchIterator it = r.globalMatch(data);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
@@ -731,7 +731,8 @@ void PerforcePluginPrivate::startSubmitProject()
|
|||||||
const QStringList filesLines = filesResult.stdOut.split(QLatin1Char('\n'));
|
const QStringList filesLines = filesResult.stdOut.split(QLatin1Char('\n'));
|
||||||
QStringList depotFileNames;
|
QStringList depotFileNames;
|
||||||
for (const QString &line : filesLines) {
|
for (const QString &line : filesLines) {
|
||||||
depotFileNames.append(line.left(line.lastIndexOf(QRegularExpression("#[0-9]+\\s-\\s"))));
|
static const QRegularExpression regexp("#[0-9]+\\s-\\s");
|
||||||
|
depotFileNames.append(line.left(line.lastIndexOf(regexp)));
|
||||||
}
|
}
|
||||||
if (depotFileNames.isEmpty()) {
|
if (depotFileNames.isEmpty()) {
|
||||||
VcsOutputWindow::appendWarning(Tr::tr("Project has no files"));
|
VcsOutputWindow::appendWarning(Tr::tr("Project has no files"));
|
||||||
@@ -1447,7 +1448,7 @@ QString PerforcePluginPrivate::clientFilePath(const QString &serverFilePath)
|
|||||||
if (response.error)
|
if (response.error)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const QRegularExpression r("\\.\\.\\.\\sclientFile\\s(.+?)\n");
|
static const QRegularExpression r("\\.\\.\\.\\sclientFile\\s(.+?)\n");
|
||||||
const QRegularExpressionMatch match = r.match(response.stdOut);
|
const QRegularExpressionMatch match = r.match(response.stdOut);
|
||||||
return match.hasMatch() ? match.captured(1).trimmed() : QString();
|
return match.hasMatch() ? match.captured(1).trimmed() : QString();
|
||||||
}
|
}
|
||||||
@@ -1462,7 +1463,7 @@ QString PerforcePluginPrivate::pendingChangesData()
|
|||||||
if (userResponse.error)
|
if (userResponse.error)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const QRegularExpression r("User\\sname:\\s(\\S+?)\\s*?\n");
|
static const QRegularExpression r("User\\sname:\\s(\\S+?)\\s*?\n");
|
||||||
QTC_ASSERT(r.isValid(), return QString());
|
QTC_ASSERT(r.isValid(), return QString());
|
||||||
const QRegularExpressionMatch match = r.match(userResponse.stdOut);
|
const QRegularExpressionMatch match = r.match(userResponse.stdOut);
|
||||||
const QString user = match.hasMatch() ? match.captured(1).trimmed() : QString();
|
const QString user = match.hasMatch() ? match.captured(1).trimmed() : QString();
|
||||||
|
@@ -48,7 +48,7 @@ bool PerforceSubmitEditor::setFileContents(const QByteArray &contents)
|
|||||||
|
|
||||||
bool PerforceSubmitEditor::parseText(QString text)
|
bool PerforceSubmitEditor::parseText(QString text)
|
||||||
{
|
{
|
||||||
QRegularExpression formField(QLatin1String("^\\S+:"));
|
static const QRegularExpression formField("^\\S+:");
|
||||||
const QString newLine = QString(QLatin1Char('\n'));
|
const QString newLine = QString(QLatin1Char('\n'));
|
||||||
|
|
||||||
int matchLen;
|
int matchLen;
|
||||||
@@ -94,7 +94,7 @@ void PerforceSubmitEditor::updateFields()
|
|||||||
lines.removeFirst(); // that is the line break after 'Description:'
|
lines.removeFirst(); // that is the line break after 'Description:'
|
||||||
lines.removeLast(); // that is the empty line at the end
|
lines.removeLast(); // that is the empty line at the end
|
||||||
|
|
||||||
const QRegularExpression leadingTabPattern("^\\t");
|
static const QRegularExpression leadingTabPattern("^\\t");
|
||||||
QTC_CHECK(leadingTabPattern.isValid());
|
QTC_CHECK(leadingTabPattern.isValid());
|
||||||
|
|
||||||
lines.replaceInStrings(leadingTabPattern, QString());
|
lines.replaceInStrings(leadingTabPattern, QString());
|
||||||
@@ -122,7 +122,8 @@ void PerforceSubmitEditor::updateEntries()
|
|||||||
while (!lines.empty() && lines.last().isEmpty())
|
while (!lines.empty() && lines.last().isEmpty())
|
||||||
lines.removeLast();
|
lines.removeLast();
|
||||||
// Description
|
// Description
|
||||||
lines.replaceInStrings(QRegularExpression("^"), tab);
|
static const QRegularExpression regexp("^");
|
||||||
|
lines.replaceInStrings(regexp, tab);
|
||||||
m_entries.insert(QLatin1String("Description"), newLine + lines.join(newLine) + QLatin1String("\n\n"));
|
m_entries.insert(QLatin1String("Description"), newLine + lines.join(newLine) + QLatin1String("\n\n"));
|
||||||
QString files = newLine;
|
QString files = newLine;
|
||||||
// Re-build the file spec '<tab>file#add' from the user data
|
// Re-build the file spec '<tab>file#add' from the user data
|
||||||
|
@@ -472,7 +472,8 @@ Abi Abi::abiFromTargetTriplet(const QString &triple)
|
|||||||
if (machine.isEmpty())
|
if (machine.isEmpty())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const QStringList parts = machine.split(QRegularExpression("[ /-]"));
|
static const QRegularExpression splitRegexp("[ /-]");
|
||||||
|
const QStringList parts = machine.split(splitRegexp);
|
||||||
|
|
||||||
Architecture arch = UnknownArchitecture;
|
Architecture arch = UnknownArchitecture;
|
||||||
OS os = UnknownOS;
|
OS os = UnknownOS;
|
||||||
|
@@ -454,7 +454,7 @@ void GccToolchain::setInstallDir(const FilePath &installDir)
|
|||||||
QString GccToolchain::defaultDisplayName() const
|
QString GccToolchain::defaultDisplayName() const
|
||||||
{
|
{
|
||||||
QString type = typeDisplayName();
|
QString type = typeDisplayName();
|
||||||
const QRegularExpression regexp(binaryRegexp);
|
static const QRegularExpression regexp(binaryRegexp);
|
||||||
const QRegularExpressionMatch match = regexp.match(compilerCommand().fileName());
|
const QRegularExpressionMatch match = regexp.match(compilerCommand().fileName());
|
||||||
if (match.lastCapturedIndex() >= 1)
|
if (match.lastCapturedIndex() >= 1)
|
||||||
type += ' ' + match.captured(1);
|
type += ' ' + match.captured(1);
|
||||||
|
@@ -60,7 +60,7 @@ KitManagerConfigWidget::KitManagerConfigWidget(Kit *k, bool &isDefaultKit, bool
|
|||||||
"which for example determines the name of the shadow build directory."
|
"which for example determines the name of the shadow build directory."
|
||||||
"</p></body></html>").arg(QLatin1String("Kit:FileSystemName"));
|
"</p></body></html>").arg(QLatin1String("Kit:FileSystemName"));
|
||||||
m_fileSystemFriendlyNameLineEdit->setToolTip(toolTip);
|
m_fileSystemFriendlyNameLineEdit->setToolTip(toolTip);
|
||||||
QRegularExpression fileSystemFriendlyNameRegexp(QLatin1String("^[A-Za-z0-9_-]*$"));
|
static const QRegularExpression fileSystemFriendlyNameRegexp(QLatin1String("^[A-Za-z0-9_-]*$"));
|
||||||
Q_ASSERT(fileSystemFriendlyNameRegexp.isValid());
|
Q_ASSERT(fileSystemFriendlyNameRegexp.isValid());
|
||||||
m_fileSystemFriendlyNameLineEdit->setValidator(new QRegularExpressionValidator(fileSystemFriendlyNameRegexp, m_fileSystemFriendlyNameLineEdit));
|
m_fileSystemFriendlyNameLineEdit->setValidator(new QRegularExpressionValidator(fileSystemFriendlyNameRegexp, m_fileSystemFriendlyNameLineEdit));
|
||||||
|
|
||||||
|
@@ -2284,8 +2284,8 @@ ClangClInfo ClangClInfo::getInfo(const FilePath &filePath)
|
|||||||
|
|
||||||
static const auto parser = [](const QString &stdOut, const QString &) {
|
static const auto parser = [](const QString &stdOut, const QString &) {
|
||||||
ClangClInfo info;
|
ClangClInfo info;
|
||||||
const QRegularExpressionMatch versionMatch
|
static const QRegularExpression regexp("clang version (\\d+(\\.\\d+)+)");
|
||||||
= QRegularExpression("clang version (\\d+(\\.\\d+)+)").match(stdOut);
|
const QRegularExpressionMatch versionMatch = regexp.match(stdOut);
|
||||||
if (versionMatch.hasMatch())
|
if (versionMatch.hasMatch())
|
||||||
info.m_version = QVersionNumber::fromString(versionMatch.captured(1));
|
info.m_version = QVersionNumber::fromString(versionMatch.captured(1));
|
||||||
const QString targetKey = "Target:";
|
const QString targetKey = "Target:";
|
||||||
|
@@ -176,7 +176,8 @@ namespace {
|
|||||||
static QString generateSuffix(const QString &suffix)
|
static QString generateSuffix(const QString &suffix)
|
||||||
{
|
{
|
||||||
QString result = suffix;
|
QString result = suffix;
|
||||||
result.replace(QRegularExpression("[^a-zA-Z0-9_.-]"), QString('_')); // replace fishy character
|
static const QRegularExpression regexp("[^a-zA-Z0-9_.-]");
|
||||||
|
result.replace(regexp, QString('_')); // replace fishy character
|
||||||
if (!result.startsWith('.'))
|
if (!result.startsWith('.'))
|
||||||
result.prepend('.');
|
result.prepend('.');
|
||||||
return result;
|
return result;
|
||||||
|
@@ -74,7 +74,7 @@ QString PySideInstaller::usedPySide(const QString &text, const QString &mimeType
|
|||||||
{
|
{
|
||||||
using namespace Python::Constants;
|
using namespace Python::Constants;
|
||||||
if (mimeType == C_PY_MIMETYPE || mimeType == C_PY3_MIMETYPE || mimeType == C_PY_GUI_MIMETYPE) {
|
if (mimeType == C_PY_MIMETYPE || mimeType == C_PY3_MIMETYPE || mimeType == C_PY_GUI_MIMETYPE) {
|
||||||
static QRegularExpression
|
static const QRegularExpression
|
||||||
scanner("^\\s*(import|from)\\s+(PySide\\d)", QRegularExpression::MultilineOption);
|
scanner("^\\s*(import|from)\\s+(PySide\\d)", QRegularExpression::MultilineOption);
|
||||||
const QRegularExpressionMatch match = scanner.match(text);
|
const QRegularExpressionMatch match = scanner.match(text);
|
||||||
return match.captured(2);
|
return match.captured(2);
|
||||||
|
@@ -370,7 +370,7 @@ void PythonBuildSystem::parse()
|
|||||||
*/
|
*/
|
||||||
static void expandEnvironmentVariables(const Environment &env, QString &string)
|
static void expandEnvironmentVariables(const Environment &env, QString &string)
|
||||||
{
|
{
|
||||||
const QRegularExpression candidate("\\$\\$\\((.+)\\)");
|
static const QRegularExpression candidate("\\$\\$\\((.+)\\)");
|
||||||
|
|
||||||
QRegularExpressionMatch match;
|
QRegularExpressionMatch match;
|
||||||
int index = string.indexOf(candidate, 0, &match);
|
int index = string.indexOf(candidate, 0, &match);
|
||||||
|
@@ -361,7 +361,7 @@ QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplor
|
|||||||
}
|
}
|
||||||
if (targetAbi.os() == ProjectExplorer::Abi::DarwinOS) {
|
if (targetAbi.os() == ProjectExplorer::Abi::DarwinOS) {
|
||||||
// Reverse engineer the Xcode developer path from the compiler path
|
// Reverse engineer the Xcode developer path from the compiler path
|
||||||
const QRegularExpression compilerRe(
|
static const QRegularExpression compilerRe(
|
||||||
QStringLiteral("^(?<developerpath>.*)/Toolchains/(?:.+)\\.xctoolchain/usr/bin$"));
|
QStringLiteral("^(?<developerpath>.*)/Toolchains/(?:.+)\\.xctoolchain/usr/bin$"));
|
||||||
const QRegularExpressionMatch compilerReMatch = compilerRe.match(cxxCompilerPath.absolutePath().toString());
|
const QRegularExpressionMatch compilerReMatch = compilerRe.match(cxxCompilerPath.absolutePath().toString());
|
||||||
if (compilerReMatch.hasMatch()) {
|
if (compilerReMatch.hasMatch()) {
|
||||||
|
@@ -48,7 +48,8 @@ static QString toJSLiteral(const bool b)
|
|||||||
static QString toJSLiteral(const QString &str)
|
static QString toJSLiteral(const QString &str)
|
||||||
{
|
{
|
||||||
QString js = str;
|
QString js = str;
|
||||||
js.replace(QRegularExpression("([\\\\\"])"), "\\\\1");
|
static const QRegularExpression regexp("([\\\\\"])");
|
||||||
|
js.replace(regexp, "\\\\1");
|
||||||
js.prepend('"');
|
js.prepend('"');
|
||||||
js.append('"');
|
js.append('"');
|
||||||
return js;
|
return js;
|
||||||
|
@@ -32,7 +32,7 @@ const char qt_file_dialog_filter_reg_exp[] =
|
|||||||
|
|
||||||
static QStringList qt_clean_filter_list(const QString &filter)
|
static QStringList qt_clean_filter_list(const QString &filter)
|
||||||
{
|
{
|
||||||
const QRegularExpression regexp(qt_file_dialog_filter_reg_exp);
|
static const QRegularExpression regexp(qt_file_dialog_filter_reg_exp);
|
||||||
const QRegularExpressionMatch match = regexp.match(filter);
|
const QRegularExpressionMatch match = regexp.match(filter);
|
||||||
QString f = filter;
|
QString f = filter;
|
||||||
if (match.hasMatch())
|
if (match.hasMatch())
|
||||||
|
@@ -24,7 +24,8 @@ namespace QmakeProjectManager::Internal {
|
|||||||
|
|
||||||
static QString headerGuard(const QString &header)
|
static QString headerGuard(const QString &header)
|
||||||
{
|
{
|
||||||
return header.toUpper().replace(QRegularExpression("[^A-Z0-9]+"), QString("_"));
|
static const QRegularExpression regexp("[^A-Z0-9]+");
|
||||||
|
return header.toUpper().replace(regexp, QString("_"));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ProjectContents {
|
struct ProjectContents {
|
||||||
|
@@ -158,7 +158,7 @@ bool QmlJSHoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Docum
|
|||||||
const HelpItem::Links links = helpItem.links();
|
const HelpItem::Links links = helpItem.links();
|
||||||
|
|
||||||
// Check if the module name contains a major version.
|
// Check if the module name contains a major version.
|
||||||
static QRegularExpression version("^([^\\d]*)(\\d+)\\.*\\d*$");
|
static const QRegularExpression version("^([^\\d]*)(\\d+)\\.*\\d*$");
|
||||||
const QRegularExpressionMatch m = version.match(moduleName);
|
const QRegularExpressionMatch m = version.match(moduleName);
|
||||||
if (m.hasMatch()) {
|
if (m.hasMatch()) {
|
||||||
QMap<QString, QUrl> filteredUrlMap;
|
QMap<QString, QUrl> filteredUrlMap;
|
||||||
|
@@ -219,7 +219,7 @@ static QString getInitialDetails(const QmlEventType &event)
|
|||||||
if (event.rangeType() == Javascript)
|
if (event.rangeType() == Javascript)
|
||||||
details = Tr::tr("anonymous function");
|
details = Tr::tr("anonymous function");
|
||||||
} else {
|
} else {
|
||||||
QRegularExpression rewrite(QLatin1String("^\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)$"));
|
static const QRegularExpression rewrite("^\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)$");
|
||||||
QRegularExpressionMatch match = rewrite.match(details);
|
QRegularExpressionMatch match = rewrite.match(details);
|
||||||
if (match.hasMatch())
|
if (match.hasMatch())
|
||||||
details = match.captured(1) + QLatin1String(": ") + match.captured(3);
|
details = match.captured(1) + QLatin1String(": ") + match.captured(3);
|
||||||
|
@@ -84,7 +84,7 @@ const QString getMainQmlFile(const Utils::FilePath &projectFilePath)
|
|||||||
{
|
{
|
||||||
const QString defaultReturn = "content/App.qml";
|
const QString defaultReturn = "content/App.qml";
|
||||||
const QString data = readFileContents(projectFilePath);
|
const QString data = readFileContents(projectFilePath);
|
||||||
QRegularExpression regexp(R"x(mainFile: "(.*)")x");
|
static const QRegularExpression regexp(R"x(mainFile: "(.*)")x");
|
||||||
QRegularExpressionMatch match = regexp.match(data);
|
QRegularExpressionMatch match = regexp.match(data);
|
||||||
if (!match.hasMatch())
|
if (!match.hasMatch())
|
||||||
return defaultReturn;
|
return defaultReturn;
|
||||||
@@ -105,8 +105,8 @@ const Resolution resolutionFromConstants(const Utils::FilePath &projectFilePath)
|
|||||||
if (!reader.fetch(Utils::FilePath::fromString(fileName)))
|
if (!reader.fetch(Utils::FilePath::fromString(fileName)))
|
||||||
return {};
|
return {};
|
||||||
const QByteArray data = reader.data();
|
const QByteArray data = reader.data();
|
||||||
const QRegularExpression regexpWidth(R"x(readonly\s+property\s+int\s+width:\s+(\d*))x");
|
static const QRegularExpression regexpWidth(R"x(readonly\s+property\s+int\s+width:\s+(\d*))x");
|
||||||
const QRegularExpression regexpHeight(R"x(readonly\s+property\s+int\s+height:\s+(\d*))x");
|
static const QRegularExpression regexpHeight(R"x(readonly\s+property\s+int\s+height:\s+(\d*))x");
|
||||||
int width = -1;
|
int width = -1;
|
||||||
int height = -1;
|
int height = -1;
|
||||||
QRegularExpressionMatch match = regexpHeight.match(QString::fromUtf8(data));
|
QRegularExpressionMatch match = regexpHeight.match(QString::fromUtf8(data));
|
||||||
|
@@ -66,7 +66,8 @@ QString QnxVersionNumber::segment(int index) const
|
|||||||
|
|
||||||
QnxVersionNumber QnxVersionNumber::fromTargetName(const QString &targetName)
|
QnxVersionNumber QnxVersionNumber::fromTargetName(const QString &targetName)
|
||||||
{
|
{
|
||||||
return fromFileName(targetName, QRegularExpression("^target_(.*)$"));
|
static const QRegularExpression regexp("^target_(.*)$");
|
||||||
|
return fromFileName(targetName, regexp);
|
||||||
}
|
}
|
||||||
|
|
||||||
QnxVersionNumber QnxVersionNumber::fromFileName(const QString &fileName, const QRegularExpression ®Exp)
|
QnxVersionNumber QnxVersionNumber::fromFileName(const QString &fileName, const QRegularExpression ®Exp)
|
||||||
|
@@ -106,8 +106,8 @@ void Slog2InfoRunner::processLogLine(const QString &line)
|
|||||||
// The "\\s+(\\b.*)?$" represents a space followed by a message. We are unable to determinate
|
// The "\\s+(\\b.*)?$" represents a space followed by a message. We are unable to determinate
|
||||||
// how many spaces represent separators and how many are a part of the messages, so resulting
|
// how many spaces represent separators and how many are a part of the messages, so resulting
|
||||||
// messages has all whitespaces at the beginning of the message trimmed.
|
// messages has all whitespaces at the beginning of the message trimmed.
|
||||||
static QRegularExpression regexp(QLatin1String(
|
static const QRegularExpression regexp(
|
||||||
"^[a-zA-Z]+\\s+([0-9]+ [0-9]+:[0-9]+:[0-9]+.[0-9]+)\\s+(\\S+)(\\s+(\\S+))?\\s+([0-9]+)\\s+(.*)?$"));
|
"^[a-zA-Z]+\\s+([0-9]+ [0-9]+:[0-9]+:[0-9]+.[0-9]+)\\s+(\\S+)(\\s+(\\S+))?\\s+([0-9]+)\\s+(.*)?$");
|
||||||
|
|
||||||
const QRegularExpressionMatch match = regexp.match(line);
|
const QRegularExpressionMatch match = regexp.match(line);
|
||||||
if (!match.hasMatch())
|
if (!match.hasMatch())
|
||||||
|
@@ -1824,7 +1824,7 @@ FilePath QtVersionPrivate::mkspecFromVersionInfo(const QHash<ProKey, ProString>
|
|||||||
if (temp.size() == 2) {
|
if (temp.size() == 2) {
|
||||||
QString possibleFullPath = QString::fromLocal8Bit(temp.at(1).trimmed().constData());
|
QString possibleFullPath = QString::fromLocal8Bit(temp.at(1).trimmed().constData());
|
||||||
if (possibleFullPath.contains('$')) { // QTBUG-28792
|
if (possibleFullPath.contains('$')) { // QTBUG-28792
|
||||||
const QRegularExpression rex("\\binclude\\(([^)]+)/qmake\\.conf\\)");
|
static const QRegularExpression rex("\\binclude\\(([^)]+)/qmake\\.conf\\)");
|
||||||
const QRegularExpressionMatch match = rex.match(QString::fromLocal8Bit(f2.readAll()));
|
const QRegularExpressionMatch match = rex.match(QString::fromLocal8Bit(f2.readAll()));
|
||||||
if (match.hasMatch()) {
|
if (match.hasMatch()) {
|
||||||
possibleFullPath = mkspecFullPath.toString() + '/'
|
possibleFullPath = mkspecFullPath.toString() + '/'
|
||||||
@@ -2134,7 +2134,8 @@ static QStringList extractFieldsFromBuildString(const QByteArray &buildString)
|
|||||||
if (buildString.isEmpty() || buildString.size() > 4096)
|
if (buildString.isEmpty() || buildString.size() > 4096)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const QRegularExpression buildStringMatcher("^Qt "
|
static const QRegularExpression buildStringMatcher(
|
||||||
|
"^Qt "
|
||||||
"([\\d\\.a-zA-Z]*) " // Qt version
|
"([\\d\\.a-zA-Z]*) " // Qt version
|
||||||
"\\("
|
"\\("
|
||||||
"([\\w_-]+) " // Abi information
|
"([\\w_-]+) " // Abi information
|
||||||
|
@@ -41,8 +41,8 @@ QWidget *TreeItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
|
|||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
auto edit = new QLineEdit(parent);
|
auto edit = new QLineEdit(parent);
|
||||||
edit->setFocusPolicy(Qt::StrongFocus);
|
edit->setFocusPolicy(Qt::StrongFocus);
|
||||||
QRegularExpression rx("^(?!xml)[_a-z][a-z0-9-._]*$");
|
static const QRegularExpression rx("^(?!xml)[_a-z][a-z0-9-._]*$",
|
||||||
rx.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
|
QRegularExpression::CaseInsensitiveOption);
|
||||||
edit->setValidator(new QRegularExpressionValidator(rx, parent));
|
edit->setValidator(new QRegularExpressionValidator(rx, parent));
|
||||||
return edit;
|
return edit;
|
||||||
}
|
}
|
||||||
|
@@ -28,9 +28,8 @@ QWidget *SCAttributeItemDelegate::createEditor(QWidget *parent, const QStyleOpti
|
|||||||
if (index.column() == 0) {
|
if (index.column() == 0) {
|
||||||
auto edit = new QLineEdit(parent);
|
auto edit = new QLineEdit(parent);
|
||||||
edit->setFocusPolicy(Qt::StrongFocus);
|
edit->setFocusPolicy(Qt::StrongFocus);
|
||||||
QRegularExpression rx("^(?!xml)[_a-z][a-z0-9-._]*$");
|
static const QRegularExpression rx("^(?!xml)[_a-z][a-z0-9-._]*$",
|
||||||
rx.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
|
QRegularExpression::CaseInsensitiveOption);
|
||||||
|
|
||||||
edit->setValidator(new QRegularExpressionValidator(rx, parent));
|
edit->setValidator(new QRegularExpressionValidator(rx, parent));
|
||||||
return edit;
|
return edit;
|
||||||
}
|
}
|
||||||
|
@@ -514,7 +514,7 @@ void ObjectsMapEditorWidget::onPasteSymbolicNameTriggered()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// if name is not valid at all refuse to do anything
|
// if name is not valid at all refuse to do anything
|
||||||
const QRegularExpression validName("^:[^\t\n\r\f\b\v\a]+$");
|
static const QRegularExpression validName("^:[^\t\n\r\f\b\v\a]+$");
|
||||||
if (!validName.match(symbolicName).hasMatch())
|
if (!validName.match(symbolicName).hasMatch())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -137,7 +137,7 @@ ValidatingPropertyNameLineEdit::ValidatingPropertyNameLineEdit(const QStringList
|
|||||||
if (!edit)
|
if (!edit)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const QRegularExpression identifier("^[a-zA-Z0-9_]+$");
|
static const QRegularExpression identifier("^[a-zA-Z0-9_]+$");
|
||||||
const QString &value = edit->text();
|
const QString &value = edit->text();
|
||||||
|
|
||||||
return !m_forbidden.contains(value) && identifier.match(value).hasMatch();
|
return !m_forbidden.contains(value) && identifier.match(value).hasMatch();
|
||||||
|
@@ -87,7 +87,7 @@ static expected_str<void> loadXdefaults(const FilePath &path)
|
|||||||
if (!readResult)
|
if (!readResult)
|
||||||
return make_unexpected(readResult.error());
|
return make_unexpected(readResult.error());
|
||||||
|
|
||||||
QRegularExpression re(R"(.*\*(color[0-9]{1,2}|foreground|background):\s*(#[0-9a-f]{6}))");
|
static const QRegularExpression re(R"(.*\*(color[0-9]{1,2}|foreground|background):\s*(#[0-9a-f]{6}))");
|
||||||
|
|
||||||
for (const QByteArray &line : readResult->split('\n')) {
|
for (const QByteArray &line : readResult->split('\n')) {
|
||||||
if (line.trimmed().startsWith('!'))
|
if (line.trimmed().startsWith('!'))
|
||||||
|
@@ -80,7 +80,7 @@ IAssistProposal *DocumentContentCompletionProcessor::performAsync()
|
|||||||
const QString wordUnderCursor = interface()->textAt(pos, length);
|
const QString wordUnderCursor = interface()->textAt(pos, length);
|
||||||
const QString text = interface()->textDocument()->toPlainText();
|
const QString text = interface()->textDocument()->toPlainText();
|
||||||
|
|
||||||
const QRegularExpression wordRE("([\\p{L}_][\\p{L}0-9_]{2,})");
|
static const QRegularExpression wordRE("([\\p{L}_][\\p{L}0-9_]{2,})");
|
||||||
QSet<QString> words;
|
QSet<QString> words;
|
||||||
QRegularExpressionMatchIterator it = wordRE.globalMatch(text);
|
QRegularExpressionMatchIterator it = wordRE.globalMatch(text);
|
||||||
int wordUnderCursorFound = 0;
|
int wordUnderCursorFound = 0;
|
||||||
|
@@ -66,7 +66,7 @@ bool StorageSettings::removeTrailingWhitespace(const QString &fileName) const
|
|||||||
const QString ignoreFileTypesRegExp(R"(\s*((?>\*\.)?[\w\d\.\*]+)[,;]?\s*)");
|
const QString ignoreFileTypesRegExp(R"(\s*((?>\*\.)?[\w\d\.\*]+)[,;]?\s*)");
|
||||||
|
|
||||||
// use the ignore-files regex to extract the specified file patterns
|
// use the ignore-files regex to extract the specified file patterns
|
||||||
QRegularExpression re(ignoreFileTypesRegExp);
|
static const QRegularExpression re(ignoreFileTypesRegExp);
|
||||||
QRegularExpressionMatchIterator iter = re.globalMatch(m_ignoreFileTypes);
|
QRegularExpressionMatchIterator iter = re.globalMatch(m_ignoreFileTypes);
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
|
@@ -2457,7 +2457,8 @@ void TextEditorWidget::joinLines()
|
|||||||
QString cutLine = c.selectedText();
|
QString cutLine = c.selectedText();
|
||||||
|
|
||||||
// Collapse leading whitespaces to one or insert whitespace
|
// Collapse leading whitespaces to one or insert whitespace
|
||||||
cutLine.replace(QRegularExpression(QLatin1String("^\\s*")), QLatin1String(" "));
|
static const QRegularExpression regexp("^\\s*");
|
||||||
|
cutLine.replace(regexp, QLatin1String(" "));
|
||||||
c.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
|
c.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
|
||||||
c.removeSelectedText();
|
c.removeSelectedText();
|
||||||
|
|
||||||
@@ -8815,7 +8816,7 @@ void TextEditorWidget::autoIndent()
|
|||||||
void TextEditorWidget::rewrapParagraph()
|
void TextEditorWidget::rewrapParagraph()
|
||||||
{
|
{
|
||||||
const int paragraphWidth = marginSettings().m_marginColumn;
|
const int paragraphWidth = marginSettings().m_marginColumn;
|
||||||
const QRegularExpression anyLettersOrNumbers("\\w");
|
static const QRegularExpression anyLettersOrNumbers("\\w");
|
||||||
const TabSettings ts = d->m_document->tabSettings();
|
const TabSettings ts = d->m_document->tabSettings();
|
||||||
|
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
@@ -8868,7 +8869,7 @@ void TextEditorWidget::rewrapParagraph()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find end of paragraph.
|
// Find end of paragraph.
|
||||||
const QRegularExpression immovableDoxygenCommand(doxygenPrefix + "[@\\\\][a-zA-Z]{2,}");
|
static const QRegularExpression immovableDoxygenCommand(doxygenPrefix + "[@\\\\][a-zA-Z]{2,}");
|
||||||
QTC_CHECK(immovableDoxygenCommand.isValid());
|
QTC_CHECK(immovableDoxygenCommand.isValid());
|
||||||
while (cursor.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor)) {
|
while (cursor.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor)) {
|
||||||
QString text = cursor.block().text();
|
QString text = cursor.block().text();
|
||||||
|
@@ -1155,7 +1155,8 @@ HeobDialog::HeobDialog(QWidget *parent) :
|
|||||||
QtcSettings *settings = Core::ICore::settings();
|
QtcSettings *settings = Core::ICore::settings();
|
||||||
bool hasSelProfile = settings->contains(heobProfileC);
|
bool hasSelProfile = settings->contains(heobProfileC);
|
||||||
const QString selProfile = hasSelProfile ? settings->value(heobProfileC).toString() : "Heob";
|
const QString selProfile = hasSelProfile ? settings->value(heobProfileC).toString() : "Heob";
|
||||||
m_profiles = settings->childGroups().filter(QRegularExpression("^Heob\\.Profile\\."));
|
static const QRegularExpression regexp("^Heob\\.Profile\\.");
|
||||||
|
m_profiles = settings->childGroups().filter(regexp);
|
||||||
|
|
||||||
auto layout = new QVBoxLayout;
|
auto layout = new QVBoxLayout;
|
||||||
// disable resizing
|
// disable resizing
|
||||||
|
Reference in New Issue
Block a user