forked from qt-creator/qt-creator
Utils: Purge asConst
Replace by qAsConst. Change-Id: I3301366f73c066c86f08df7188d70dc3b613c55c Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
11336fb604
commit
7d3a79c696
@@ -37,7 +37,6 @@
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <coreplugin/documentmanager.h>
|
||||
|
||||
#include <utils/asconst.h>
|
||||
#include <utils/execmenu.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
#include <vcsbase/vcscommand.h>
|
||||
|
||||
#include <utils/asconst.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QDateTime>
|
||||
@@ -138,7 +137,7 @@ public:
|
||||
fn.append(nodes.first()->sha);
|
||||
nodes.removeFirst();
|
||||
|
||||
for (const BranchNode *n : Utils::asConst(nodes))
|
||||
for (const BranchNode *n : qAsConst(nodes))
|
||||
fn.append(n->name);
|
||||
|
||||
return fn;
|
||||
@@ -328,7 +327,7 @@ Qt::ItemFlags BranchModel::flags(const QModelIndex &index) const
|
||||
|
||||
void BranchModel::clear()
|
||||
{
|
||||
for (BranchNode *root : Utils::asConst(m_rootNode->children)) {
|
||||
for (BranchNode *root : qAsConst(m_rootNode->children)) {
|
||||
while (root->count())
|
||||
delete root->children.takeLast();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "gitutils.h"
|
||||
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <utils/asconst.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
@@ -127,7 +126,7 @@ bool BranchUtils::checkout()
|
||||
|
||||
QList<Stash> stashes;
|
||||
client->synchronousStashList(m_repository, &stashes);
|
||||
for (const Stash &stash : Utils::asConst(stashes)) {
|
||||
for (const Stash &stash : qAsConst(stashes)) {
|
||||
if (stash.message.startsWith(popMessageStart)) {
|
||||
branchCheckoutDialog.foundStashForNextBranch();
|
||||
break;
|
||||
@@ -155,7 +154,7 @@ bool BranchUtils::checkout()
|
||||
|
||||
QString stashName;
|
||||
client->synchronousStashList(m_repository, &stashes);
|
||||
for (const Stash &stash : Utils::asConst(stashes)) {
|
||||
for (const Stash &stash : qAsConst(stashes)) {
|
||||
if (stash.message.startsWith(popMessageStart)) {
|
||||
stashName = stash.name;
|
||||
break;
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "ui_authenticationdialog.h"
|
||||
#include "gerritserver.h"
|
||||
|
||||
#include <utils/asconst.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <utils/asconst.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/progressindicator.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <vcsbase/vcsoutputwindow.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/asconst.h>
|
||||
#include <utils/synchronousprocess.h>
|
||||
|
||||
#include <QJsonArray>
|
||||
@@ -933,7 +932,7 @@ void GerritModel::resultRetrieved(const QByteArray &output)
|
||||
std::stable_sort(changes.begin(), changes.end(), gerritChangeLessThan);
|
||||
numberIndexHash.clear();
|
||||
|
||||
for (const GerritChangePtr &c : Utils::asConst(changes)) {
|
||||
for (const GerritChangePtr &c : qAsConst(changes)) {
|
||||
// Avoid duplicate entries for example in the (unlikely)
|
||||
// case people do self-reviews.
|
||||
if (!itemForNumber(c->number)) {
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/asconst.h>
|
||||
#include <utils/checkablemessagebox.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
@@ -1516,7 +1515,7 @@ QString GitClient::synchronousTopic(const QString &workingDirectory) const
|
||||
const QString dereference("^{}");
|
||||
QString remoteBranch;
|
||||
|
||||
for (const QString &ref : Utils::asConst(references)) {
|
||||
for (const QString &ref : qAsConst(references)) {
|
||||
int derefInd = ref.indexOf(dereference);
|
||||
if (ref.startsWith(tagStart))
|
||||
return ref.mid(tagStart.size(), (derefInd == -1) ? -1 : derefInd - tagStart.size());
|
||||
@@ -1579,7 +1578,7 @@ void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const
|
||||
QStringList parents;
|
||||
QString errorMessage;
|
||||
synchronousParentRevisions(workingDirectory, revision, &parents, &errorMessage);
|
||||
for (const QString &p : Utils::asConst(parents)) {
|
||||
for (const QString &p : qAsConst(parents)) {
|
||||
const SynchronousProcessResponse resp2 = vcsFullySynchronousExec(
|
||||
workingDirectory, {"describe", "--tags", "--abbrev=0", p}, silentFlags);
|
||||
QString pf = resp2.stdOut();
|
||||
@@ -1715,7 +1714,7 @@ bool GitClient::stashNameFromMessage(const QString &workingDirectory,
|
||||
QList<Stash> stashes;
|
||||
if (!synchronousStashList(workingDirectory, &stashes, errorMessage))
|
||||
return false;
|
||||
for (const Stash &s : Utils::asConst(stashes)) {
|
||||
for (const Stash &s : qAsConst(stashes)) {
|
||||
if (s.message == message) {
|
||||
*name = s.name;
|
||||
return true;
|
||||
@@ -2081,7 +2080,7 @@ void GitClient::updateSubmodulesIfNeeded(const QString &workingDirectory, bool p
|
||||
|
||||
void GitClient::finishSubmoduleUpdate()
|
||||
{
|
||||
for (const QString &submoduleDir : Utils::asConst(m_updatedSubmodules))
|
||||
for (const QString &submoduleDir : qAsConst(m_updatedSubmodules))
|
||||
endStashScope(submoduleDir);
|
||||
m_updatedSubmodules.clear();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/asconst.h>
|
||||
#include <utils/fancylineedit.h>
|
||||
#include <utils/filesearch.h>
|
||||
#include <utils/fileutils.h>
|
||||
@@ -121,7 +120,7 @@ public:
|
||||
QRegularExpressionMatch regexpMatch = regexp.match(line);
|
||||
single.regexpCapturedTexts = regexpMatch.capturedTexts();
|
||||
}
|
||||
for (auto match : Utils::asConst(matches)) {
|
||||
for (auto match : qAsConst(matches)) {
|
||||
single.matchStart = match.first;
|
||||
single.matchLength = match.second;
|
||||
resultList->append(single);
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
|
||||
#include <utils/asconst.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include "githighlighters.h"
|
||||
@@ -138,7 +137,7 @@ void GitRebaseHighlighter::highlightBlock(const QString &text)
|
||||
changeIndex += changeLen;
|
||||
}
|
||||
} else {
|
||||
for (const RebaseAction &action : Utils::asConst(m_actions)) {
|
||||
for (const RebaseAction &action : qAsConst(m_actions)) {
|
||||
if (action.exp.indexIn(text) != -1) {
|
||||
const int len = action.exp.matchedLength();
|
||||
setFormat(0, len, formatForCategory(action.formatCategory));
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
|
||||
#include <coreplugin/messagebox.h>
|
||||
#include <utils/asconst.h>
|
||||
#include <utils/parameteraction.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -1360,15 +1359,15 @@ void GitPlugin::updateActions(VcsBasePlugin::ActionState as)
|
||||
// Note: This menu is visible if there is no repository. Only
|
||||
// 'Create Repository'/'Show' actions should be available.
|
||||
const QString fileName = Utils::quoteAmpersands(state.currentFileName());
|
||||
for (ParameterAction *fileAction : Utils::asConst(m_fileActions))
|
||||
for (ParameterAction *fileAction : qAsConst(m_fileActions))
|
||||
fileAction->setParameter(fileName);
|
||||
// If the current file looks like a patch, offer to apply
|
||||
m_applyCurrentFilePatchAction->setParameter(state.currentPatchFileDisplayName());
|
||||
const QString projectName = state.currentProjectName();
|
||||
for (ParameterAction *projectAction : Utils::asConst(m_projectActions))
|
||||
for (ParameterAction *projectAction : qAsConst(m_projectActions))
|
||||
projectAction->setParameter(projectName);
|
||||
|
||||
for (QAction *repositoryAction : Utils::asConst(m_repositoryActions))
|
||||
for (QAction *repositoryAction : qAsConst(m_repositoryActions))
|
||||
repositoryAction->setEnabled(repositoryEnabled);
|
||||
|
||||
m_submoduleUpdateAction->setVisible(repositoryEnabled
|
||||
|
||||
Reference in New Issue
Block a user