forked from qt-creator/qt-creator
More deprecation induced busywork
QString::count() will vanish. Change-Id: I65672fa648c0969930e9398ec4e541a0771c8a57 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -24,8 +24,8 @@ namespace Utils {
|
|||||||
static int commonPrefix(const QString &text1, const QString &text2)
|
static int commonPrefix(const QString &text1, const QString &text2)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
const int text1Count = text1.count();
|
const int text1Count = text1.size();
|
||||||
const int text2Count = text2.count();
|
const int text2Count = text2.size();
|
||||||
const int maxCount = qMin(text1Count, text2Count);
|
const int maxCount = qMin(text1Count, text2Count);
|
||||||
while (i < maxCount) {
|
while (i < maxCount) {
|
||||||
if (text1.at(i) != text2.at(i))
|
if (text1.at(i) != text2.at(i))
|
||||||
@@ -38,8 +38,8 @@ static int commonPrefix(const QString &text1, const QString &text2)
|
|||||||
static int commonSuffix(const QString &text1, const QString &text2)
|
static int commonSuffix(const QString &text1, const QString &text2)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
const int text1Count = text1.count();
|
const int text1Count = text1.size();
|
||||||
const int text2Count = text2.count();
|
const int text2Count = text2.size();
|
||||||
const int maxCount = qMin(text1Count, text2Count);
|
const int maxCount = qMin(text1Count, text2Count);
|
||||||
while (i < maxCount) {
|
while (i < maxCount) {
|
||||||
if (text1.at(text1Count - i - 1) != text2.at(text2Count - i - 1))
|
if (text1.at(text1Count - i - 1) != text2.at(text2Count - i - 1))
|
||||||
@@ -52,8 +52,8 @@ static int commonSuffix(const QString &text1, const QString &text2)
|
|||||||
static int commonOverlap(const QString &text1, const QString &text2)
|
static int commonOverlap(const QString &text1, const QString &text2)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
const int text1Count = text1.count();
|
const int text1Count = text1.size();
|
||||||
const int text2Count = text2.count();
|
const int text2Count = text2.size();
|
||||||
const int maxCount = qMin(text1Count, text2Count);
|
const int maxCount = qMin(text1Count, text2Count);
|
||||||
while (i < maxCount) {
|
while (i < maxCount) {
|
||||||
if (QStringView(text1).mid(text1Count - maxCount + i) == QStringView(text2).left(maxCount - i))
|
if (QStringView(text1).mid(text1Count - maxCount + i) == QStringView(text2).left(maxCount - i))
|
||||||
@@ -66,7 +66,7 @@ static int commonOverlap(const QString &text1, const QString &text2)
|
|||||||
static QList<Diff> decode(const QList<Diff> &diffList, const QStringList &lines)
|
static QList<Diff> decode(const QList<Diff> &diffList, const QStringList &lines)
|
||||||
{
|
{
|
||||||
QList<Diff> newDiffList;
|
QList<Diff> newDiffList;
|
||||||
newDiffList.reserve(diffList.count());
|
newDiffList.reserve(diffList.size());
|
||||||
for (const Diff &diff : diffList) {
|
for (const Diff &diff : diffList) {
|
||||||
QString text;
|
QString text;
|
||||||
for (QChar c : diff.text) {
|
for (QChar c : diff.text) {
|
||||||
@@ -80,7 +80,7 @@ static QList<Diff> decode(const QList<Diff> &diffList, const QStringList &lines)
|
|||||||
|
|
||||||
static QList<Diff> squashEqualities(const QList<Diff> &diffList)
|
static QList<Diff> squashEqualities(const QList<Diff> &diffList)
|
||||||
{
|
{
|
||||||
if (diffList.count() < 3) // we need at least 3 items
|
if (diffList.size() < 3) // we need at least 3 items
|
||||||
return diffList;
|
return diffList;
|
||||||
|
|
||||||
QList<Diff> newDiffList;
|
QList<Diff> newDiffList;
|
||||||
@@ -88,20 +88,20 @@ static QList<Diff> squashEqualities(const QList<Diff> &diffList)
|
|||||||
Diff thisDiff = diffList.at(1);
|
Diff thisDiff = diffList.at(1);
|
||||||
Diff nextDiff = diffList.at(2);
|
Diff nextDiff = diffList.at(2);
|
||||||
int i = 2;
|
int i = 2;
|
||||||
while (i < diffList.count()) {
|
while (i < diffList.size()) {
|
||||||
if (prevDiff.command == Diff::Equal
|
if (prevDiff.command == Diff::Equal
|
||||||
&& nextDiff.command == Diff::Equal) {
|
&& nextDiff.command == Diff::Equal) {
|
||||||
if (thisDiff.text.endsWith(prevDiff.text)) {
|
if (thisDiff.text.endsWith(prevDiff.text)) {
|
||||||
thisDiff.text = prevDiff.text
|
thisDiff.text = prevDiff.text
|
||||||
+ thisDiff.text.left(thisDiff.text.count()
|
+ thisDiff.text.left(thisDiff.text.size()
|
||||||
- prevDiff.text.count());
|
- prevDiff.text.size());
|
||||||
nextDiff.text = prevDiff.text + nextDiff.text;
|
nextDiff.text = prevDiff.text + nextDiff.text;
|
||||||
} else if (thisDiff.text.startsWith(nextDiff.text)) {
|
} else if (thisDiff.text.startsWith(nextDiff.text)) {
|
||||||
prevDiff.text += nextDiff.text;
|
prevDiff.text += nextDiff.text;
|
||||||
thisDiff.text = thisDiff.text.mid(nextDiff.text.count())
|
thisDiff.text = thisDiff.text.mid(nextDiff.text.size())
|
||||||
+ nextDiff.text;
|
+ nextDiff.text;
|
||||||
i++;
|
i++;
|
||||||
if (i < diffList.count())
|
if (i < diffList.size())
|
||||||
nextDiff = diffList.at(i);
|
nextDiff = diffList.at(i);
|
||||||
newDiffList.append(prevDiff);
|
newDiffList.append(prevDiff);
|
||||||
} else {
|
} else {
|
||||||
@@ -113,11 +113,11 @@ static QList<Diff> squashEqualities(const QList<Diff> &diffList)
|
|||||||
prevDiff = thisDiff;
|
prevDiff = thisDiff;
|
||||||
thisDiff = nextDiff;
|
thisDiff = nextDiff;
|
||||||
i++;
|
i++;
|
||||||
if (i < diffList.count())
|
if (i < diffList.size())
|
||||||
nextDiff = diffList.at(i);
|
nextDiff = diffList.at(i);
|
||||||
}
|
}
|
||||||
newDiffList.append(prevDiff);
|
newDiffList.append(prevDiff);
|
||||||
if (i == diffList.count())
|
if (i == diffList.size())
|
||||||
newDiffList.append(thisDiff);
|
newDiffList.append(thisDiff);
|
||||||
return newDiffList;
|
return newDiffList;
|
||||||
}
|
}
|
||||||
@@ -132,9 +132,9 @@ static QList<Diff> cleanupOverlaps(const QList<Diff> &diffList)
|
|||||||
// DEL(XXXXABC), INS(DEFXXXX) -> INS(DEF), EQ(XXXX), DEL(ABC)
|
// DEL(XXXXABC), INS(DEFXXXX) -> INS(DEF), EQ(XXXX), DEL(ABC)
|
||||||
QList<Diff> newDiffList;
|
QList<Diff> newDiffList;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < diffList.count()) {
|
while (i < diffList.size()) {
|
||||||
Diff thisDiff = diffList.at(i);
|
Diff thisDiff = diffList.at(i);
|
||||||
Diff nextDiff = i < diffList.count() - 1
|
Diff nextDiff = i < diffList.size() - 1
|
||||||
? diffList.at(i + 1)
|
? diffList.at(i + 1)
|
||||||
: Diff(Diff::Equal);
|
: Diff(Diff::Equal);
|
||||||
if (thisDiff.command == Diff::Delete
|
if (thisDiff.command == Diff::Delete
|
||||||
@@ -142,9 +142,9 @@ static QList<Diff> cleanupOverlaps(const QList<Diff> &diffList)
|
|||||||
const int delInsOverlap = commonOverlap(thisDiff.text, nextDiff.text);
|
const int delInsOverlap = commonOverlap(thisDiff.text, nextDiff.text);
|
||||||
const int insDelOverlap = commonOverlap(nextDiff.text, thisDiff.text);
|
const int insDelOverlap = commonOverlap(nextDiff.text, thisDiff.text);
|
||||||
if (delInsOverlap >= insDelOverlap) {
|
if (delInsOverlap >= insDelOverlap) {
|
||||||
if (delInsOverlap > thisDiff.text.count() / 2
|
if (delInsOverlap > thisDiff.text.size() / 2
|
||||||
|| delInsOverlap > nextDiff.text.count() / 2) {
|
|| delInsOverlap > nextDiff.text.size() / 2) {
|
||||||
thisDiff.text = thisDiff.text.left(thisDiff.text.count() - delInsOverlap);
|
thisDiff.text = thisDiff.text.left(thisDiff.text.size() - delInsOverlap);
|
||||||
const Diff equality(Diff::Equal, nextDiff.text.left(delInsOverlap));
|
const Diff equality(Diff::Equal, nextDiff.text.left(delInsOverlap));
|
||||||
nextDiff.text = nextDiff.text.mid(delInsOverlap);
|
nextDiff.text = nextDiff.text.mid(delInsOverlap);
|
||||||
newDiffList.append(thisDiff);
|
newDiffList.append(thisDiff);
|
||||||
@@ -155,9 +155,9 @@ static QList<Diff> cleanupOverlaps(const QList<Diff> &diffList)
|
|||||||
newDiffList.append(nextDiff);
|
newDiffList.append(nextDiff);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (insDelOverlap > thisDiff.text.count() / 2
|
if (insDelOverlap > thisDiff.text.size() / 2
|
||||||
|| insDelOverlap > nextDiff.text.count() / 2) {
|
|| insDelOverlap > nextDiff.text.size() / 2) {
|
||||||
nextDiff.text = nextDiff.text.left(nextDiff.text.count() - insDelOverlap);
|
nextDiff.text = nextDiff.text.left(nextDiff.text.size() - insDelOverlap);
|
||||||
const Diff equality(Diff::Equal, thisDiff.text.left(insDelOverlap));
|
const Diff equality(Diff::Equal, thisDiff.text.left(insDelOverlap));
|
||||||
thisDiff.text = thisDiff.text.mid(insDelOverlap);
|
thisDiff.text = thisDiff.text.mid(insDelOverlap);
|
||||||
newDiffList.append(nextDiff);
|
newDiffList.append(nextDiff);
|
||||||
@@ -186,7 +186,7 @@ static int cleanupSemanticsScore(const QString &text1, const QString &text2)
|
|||||||
if (text1.isEmpty() || text2.isEmpty()) // Edges
|
if (text1.isEmpty() || text2.isEmpty()) // Edges
|
||||||
return 6;
|
return 6;
|
||||||
|
|
||||||
const QChar char1 = text1[text1.count() - 1];
|
const QChar char1 = text1[text1.size() - 1];
|
||||||
const QChar char2 = text2[0];
|
const QChar char2 = text2[0];
|
||||||
const bool nonAlphaNumeric1 = !char1.isLetterOrNumber();
|
const bool nonAlphaNumeric1 = !char1.isLetterOrNumber();
|
||||||
const bool nonAlphaNumeric2 = !char2.isLetterOrNumber();
|
const bool nonAlphaNumeric2 = !char2.isLetterOrNumber();
|
||||||
@@ -256,19 +256,19 @@ QList<Diff> Differ::moveWhitespaceIntoEqualities(const QList<Diff> &input)
|
|||||||
{
|
{
|
||||||
QList<Diff> output = input;
|
QList<Diff> output = input;
|
||||||
|
|
||||||
for (int i = 0; i < output.count(); i++) {
|
for (int i = 0; i < output.size(); i++) {
|
||||||
Diff diff = output[i];
|
Diff diff = output[i];
|
||||||
|
|
||||||
if (diff.command != Diff::Equal) {
|
if (diff.command != Diff::Equal) {
|
||||||
if (i > 0) { // check previous equality
|
if (i > 0) { // check previous equality
|
||||||
Diff &previousDiff = output[i - 1];
|
Diff &previousDiff = output[i - 1];
|
||||||
const int previousDiffCount = previousDiff.text.count();
|
const int previousDiffCount = previousDiff.text.size();
|
||||||
if (previousDiff.command == Diff::Equal
|
if (previousDiff.command == Diff::Equal
|
||||||
&& previousDiffCount
|
&& previousDiffCount
|
||||||
&& isWhitespace(previousDiff.text.at(previousDiffCount - 1))) {
|
&& isWhitespace(previousDiff.text.at(previousDiffCount - 1))) {
|
||||||
// previous diff ends with whitespace
|
// previous diff ends with whitespace
|
||||||
int j = 0;
|
int j = 0;
|
||||||
while (j < diff.text.count()) {
|
while (j < diff.text.size()) {
|
||||||
if (!isWhitespace(diff.text.at(j)))
|
if (!isWhitespace(diff.text.at(j)))
|
||||||
break;
|
break;
|
||||||
++j;
|
++j;
|
||||||
@@ -280,10 +280,10 @@ QList<Diff> Differ::moveWhitespaceIntoEqualities(const QList<Diff> &input)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i < output.count() - 1) { // check next equality
|
if (i < output.size() - 1) { // check next equality
|
||||||
const int diffCount = diff.text.count();
|
const int diffCount = diff.text.size();
|
||||||
Diff &nextDiff = output[i + 1];
|
Diff &nextDiff = output[i + 1];
|
||||||
const int nextDiffCount = nextDiff.text.count();
|
const int nextDiffCount = nextDiff.text.size();
|
||||||
if (nextDiff.command == Diff::Equal
|
if (nextDiff.command == Diff::Equal
|
||||||
&& nextDiffCount
|
&& nextDiffCount
|
||||||
&& (isWhitespace(nextDiff.text.at(0)) || isNewLine(nextDiff.text.at(0)))) {
|
&& (isWhitespace(nextDiff.text.at(0)) || isNewLine(nextDiff.text.at(0)))) {
|
||||||
@@ -331,7 +331,7 @@ static QString encodeReducedWhitespace(const QString &input,
|
|||||||
|
|
||||||
int inputIndex = 0;
|
int inputIndex = 0;
|
||||||
int outputIndex = 0;
|
int outputIndex = 0;
|
||||||
while (inputIndex < input.count()) {
|
while (inputIndex < input.size()) {
|
||||||
QChar c = input.at(inputIndex);
|
QChar c = input.at(inputIndex);
|
||||||
|
|
||||||
if (isWhitespace(c)) {
|
if (isWhitespace(c)) {
|
||||||
@@ -339,7 +339,7 @@ static QString encodeReducedWhitespace(const QString &input,
|
|||||||
codeMap->insert(outputIndex, QString(c));
|
codeMap->insert(outputIndex, QString(c));
|
||||||
++inputIndex;
|
++inputIndex;
|
||||||
|
|
||||||
while (inputIndex < input.count()) {
|
while (inputIndex < input.size()) {
|
||||||
QChar reducedChar = input.at(inputIndex);
|
QChar reducedChar = input.at(inputIndex);
|
||||||
|
|
||||||
if (!isWhitespace(reducedChar))
|
if (!isWhitespace(reducedChar))
|
||||||
@@ -372,10 +372,10 @@ static QList<Diff> decodeReducedWhitespace(const QList<Diff> &input,
|
|||||||
auto it = codeMap.constBegin();
|
auto it = codeMap.constBegin();
|
||||||
const auto itEnd = codeMap.constEnd();
|
const auto itEnd = codeMap.constEnd();
|
||||||
for (Diff diff : input) {
|
for (Diff diff : input) {
|
||||||
const int diffCount = diff.text.count();
|
const int diffCount = diff.text.size();
|
||||||
while ((it != itEnd) && (it.key() < counter + diffCount)) {
|
while ((it != itEnd) && (it.key() < counter + diffCount)) {
|
||||||
const int reversePosition = diffCount + counter - it.key();
|
const int reversePosition = diffCount + counter - it.key();
|
||||||
const int updatedDiffCount = diff.text.count();
|
const int updatedDiffCount = diff.text.size();
|
||||||
diff.text.replace(updatedDiffCount - reversePosition, 1, it.value());
|
diff.text.replace(updatedDiffCount - reversePosition, 1, it.value());
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
@@ -502,8 +502,8 @@ static QString encodeExpandedWhitespace(const QString &leftEquality,
|
|||||||
rightCodeMap->clear();
|
rightCodeMap->clear();
|
||||||
QString output;
|
QString output;
|
||||||
|
|
||||||
const int leftCount = leftEquality.count();
|
const int leftCount = leftEquality.size();
|
||||||
const int rightCount = rightEquality.count();
|
const int rightCount = rightEquality.size();
|
||||||
int leftIndex = 0;
|
int leftIndex = 0;
|
||||||
int rightIndex = 0;
|
int rightIndex = 0;
|
||||||
while (leftIndex < leftCount && rightIndex < rightCount) {
|
while (leftIndex < leftCount && rightIndex < rightCount) {
|
||||||
@@ -534,8 +534,8 @@ static QString encodeExpandedWhitespace(const QString &leftEquality,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!leftWhitespaces.isEmpty() && !rightWhitespaces.isEmpty()) {
|
if (!leftWhitespaces.isEmpty() && !rightWhitespaces.isEmpty()) {
|
||||||
const int replacementPosition = output.count();
|
const int replacementPosition = output.size();
|
||||||
const int replacementSize = qMax(leftWhitespaces.count(), rightWhitespaces.count());
|
const int replacementSize = qMax(leftWhitespaces.size(), rightWhitespaces.size());
|
||||||
const QString replacement(replacementSize, ' ');
|
const QString replacement(replacementSize, ' ');
|
||||||
leftCodeMap->insert(replacementPosition, {replacementSize, leftWhitespaces});
|
leftCodeMap->insert(replacementPosition, {replacementSize, leftWhitespaces});
|
||||||
rightCodeMap->insert(replacementPosition, {replacementSize, rightWhitespaces});
|
rightCodeMap->insert(replacementPosition, {replacementSize, rightWhitespaces});
|
||||||
@@ -574,14 +574,14 @@ static QList<Diff> decodeExpandedWhitespace(const QList<Diff> &input,
|
|||||||
auto it = codeMap.constBegin();
|
auto it = codeMap.constBegin();
|
||||||
const auto itEnd = codeMap.constEnd();
|
const auto itEnd = codeMap.constEnd();
|
||||||
for (Diff diff : input) {
|
for (Diff diff : input) {
|
||||||
const int diffCount = diff.text.count();
|
const int diffCount = diff.text.size();
|
||||||
while ((it != itEnd) && (it.key() < counter + diffCount)) {
|
while ((it != itEnd) && (it.key() < counter + diffCount)) {
|
||||||
const int replacementSize = it.value().first;
|
const int replacementSize = it.value().first;
|
||||||
const int reversePosition = diffCount + counter - it.key();
|
const int reversePosition = diffCount + counter - it.key();
|
||||||
if (reversePosition < replacementSize)
|
if (reversePosition < replacementSize)
|
||||||
return QList<Diff>(); // replacement exceeds one Diff
|
return QList<Diff>(); // replacement exceeds one Diff
|
||||||
const QString replacement = it.value().second;
|
const QString replacement = it.value().second;
|
||||||
const int updatedDiffCount = diff.text.count();
|
const int updatedDiffCount = diff.text.size();
|
||||||
diff.text.replace(updatedDiffCount - reversePosition,
|
diff.text.replace(updatedDiffCount - reversePosition,
|
||||||
replacementSize, replacement);
|
replacementSize, replacement);
|
||||||
++it;
|
++it;
|
||||||
@@ -619,8 +619,8 @@ static bool diffWithWhitespaceExpandedInEqualities(const QList<Diff> &leftInput,
|
|||||||
leftOutput->clear();
|
leftOutput->clear();
|
||||||
rightOutput->clear();
|
rightOutput->clear();
|
||||||
|
|
||||||
const int leftCount = leftInput.count();
|
const int leftCount = leftInput.size();
|
||||||
const int rightCount = rightInput.count();
|
const int rightCount = rightInput.size();
|
||||||
int l = 0;
|
int l = 0;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
@@ -649,10 +649,10 @@ static bool diffWithWhitespaceExpandedInEqualities(const QList<Diff> &leftInput,
|
|||||||
|
|
||||||
// join code map positions with common maps
|
// join code map positions with common maps
|
||||||
for (auto it = leftCodeMap.cbegin(), end = leftCodeMap.cend(); it != end; ++it)
|
for (auto it = leftCodeMap.cbegin(), end = leftCodeMap.cend(); it != end; ++it)
|
||||||
commonLeftCodeMap.insert(leftText.count() + it.key(), it.value());
|
commonLeftCodeMap.insert(leftText.size() + it.key(), it.value());
|
||||||
|
|
||||||
for (auto it = rightCodeMap.cbegin(), end = rightCodeMap.cend(); it != end; ++it)
|
for (auto it = rightCodeMap.cbegin(), end = rightCodeMap.cend(); it != end; ++it)
|
||||||
commonRightCodeMap.insert(rightText.count() + it.key(), it.value());
|
commonRightCodeMap.insert(rightText.size() + it.key(), it.value());
|
||||||
|
|
||||||
leftText.append(commonEquality);
|
leftText.append(commonEquality);
|
||||||
rightText.append(commonEquality);
|
rightText.append(commonEquality);
|
||||||
@@ -739,8 +739,8 @@ void Differ::ignoreWhitespaceBetweenEqualities(const QList<Diff> &leftInput,
|
|||||||
leftOutput->clear();
|
leftOutput->clear();
|
||||||
rightOutput->clear();
|
rightOutput->clear();
|
||||||
|
|
||||||
const int leftCount = leftInput.count();
|
const int leftCount = leftInput.size();
|
||||||
const int rightCount = rightInput.count();
|
const int rightCount = rightInput.size();
|
||||||
int l = 0;
|
int l = 0;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
@@ -836,8 +836,8 @@ void Differ::diffBetweenEqualities(const QList<Diff> &leftInput,
|
|||||||
leftOutput->clear();
|
leftOutput->clear();
|
||||||
rightOutput->clear();
|
rightOutput->clear();
|
||||||
|
|
||||||
const int leftCount = leftInput.count();
|
const int leftCount = leftInput.size();
|
||||||
const int rightCount = rightInput.count();
|
const int rightCount = rightInput.size();
|
||||||
int l = 0;
|
int l = 0;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
@@ -1000,8 +1000,8 @@ QList<Diff> Differ::preprocess1AndDiff(const QString &text1, const QString &text
|
|||||||
const int suffixCount = commonSuffix(newText1, newText2);
|
const int suffixCount = commonSuffix(newText1, newText2);
|
||||||
if (suffixCount) {
|
if (suffixCount) {
|
||||||
suffix = newText1.right(suffixCount);
|
suffix = newText1.right(suffixCount);
|
||||||
newText1 = newText1.left(newText1.count() - suffixCount);
|
newText1 = newText1.left(newText1.size() - suffixCount);
|
||||||
newText2 = newText2.left(newText2.count() - suffixCount);
|
newText2 = newText2.left(newText2.size() - suffixCount);
|
||||||
}
|
}
|
||||||
QList<Diff> diffList = preprocess2AndDiff(newText1, newText2);
|
QList<Diff> diffList = preprocess2AndDiff(newText1, newText2);
|
||||||
if (prefixCount)
|
if (prefixCount)
|
||||||
@@ -1025,28 +1025,27 @@ QList<Diff> Differ::preprocess2AndDiff(const QString &text1, const QString &text
|
|||||||
return diffList;
|
return diffList;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text1.count() != text2.count())
|
if (text1.size() != text2.size()) {
|
||||||
{
|
const QString longtext = text1.size() > text2.size() ? text1 : text2;
|
||||||
const QString longtext = text1.count() > text2.count() ? text1 : text2;
|
const QString shorttext = text1.size() > text2.size() ? text2 : text1;
|
||||||
const QString shorttext = text1.count() > text2.count() ? text2 : text1;
|
|
||||||
const int i = longtext.indexOf(shorttext);
|
const int i = longtext.indexOf(shorttext);
|
||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
const Diff::Command command = (text1.count() > text2.count())
|
const Diff::Command command = (text1.size() > text2.size())
|
||||||
? Diff::Delete : Diff::Insert;
|
? Diff::Delete : Diff::Insert;
|
||||||
diffList.append(Diff(command, longtext.left(i)));
|
diffList.append(Diff(command, longtext.left(i)));
|
||||||
diffList.append(Diff(Diff::Equal, shorttext));
|
diffList.append(Diff(Diff::Equal, shorttext));
|
||||||
diffList.append(Diff(command, longtext.mid(i + shorttext.count())));
|
diffList.append(Diff(command, longtext.mid(i + shorttext.size())));
|
||||||
return diffList;
|
return diffList;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shorttext.count() == 1) {
|
if (shorttext.size() == 1) {
|
||||||
diffList.append(Diff(Diff::Delete, text1));
|
diffList.append(Diff(Diff::Delete, text1));
|
||||||
diffList.append(Diff(Diff::Insert, text2));
|
diffList.append(Diff(Diff::Insert, text2));
|
||||||
return diffList;
|
return diffList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_currentDiffMode != Differ::CharMode && text1.count() > 80 && text2.count() > 80)
|
if (m_currentDiffMode != Differ::CharMode && text1.size() > 80 && text2.size() > 80)
|
||||||
return diffNonCharMode(text1, text2);
|
return diffNonCharMode(text1, text2);
|
||||||
|
|
||||||
return diffMyers(text1, text2);
|
return diffMyers(text1, text2);
|
||||||
@@ -1054,8 +1053,8 @@ QList<Diff> Differ::preprocess2AndDiff(const QString &text1, const QString &text
|
|||||||
|
|
||||||
QList<Diff> Differ::diffMyers(const QString &text1, const QString &text2)
|
QList<Diff> Differ::diffMyers(const QString &text1, const QString &text2)
|
||||||
{
|
{
|
||||||
const int n = text1.count();
|
const int n = text1.size();
|
||||||
const int m = text2.count();
|
const int m = text2.size();
|
||||||
const bool odd = (n + m) % 2;
|
const bool odd = (n + m) % 2;
|
||||||
const int D = odd ? (n + m) / 2 + 1 : (n + m) / 2;
|
const int D = odd ? (n + m) / 2 + 1 : (n + m) / 2;
|
||||||
const int delta = n - m;
|
const int delta = n - m;
|
||||||
@@ -1191,12 +1190,12 @@ QList<Diff> Differ::diffNonCharMode(const QString &text1, const QString &text2)
|
|||||||
QString lastDelete;
|
QString lastDelete;
|
||||||
QString lastInsert;
|
QString lastInsert;
|
||||||
QList<Diff> newDiffList;
|
QList<Diff> newDiffList;
|
||||||
for (int i = 0; i <= diffList.count(); i++) {
|
for (int i = 0; i <= diffList.size(); i++) {
|
||||||
if (m_future && m_future->isCanceled()) {
|
if (m_future && m_future->isCanceled()) {
|
||||||
m_currentDiffMode = diffMode;
|
m_currentDiffMode = diffMode;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const Diff diffItem = i < diffList.count()
|
const Diff diffItem = i < diffList.size()
|
||||||
? diffList.at(i)
|
? diffList.at(i)
|
||||||
: Diff(Diff::Equal); // dummy, ensure we process to the end
|
: Diff(Diff::Equal); // dummy, ensure we process to the end
|
||||||
// even when diffList doesn't end with equality
|
// even when diffList doesn't end with equality
|
||||||
@@ -1240,14 +1239,14 @@ int Differ::findSubtextEnd(const QString &text,
|
|||||||
if (m_currentDiffMode == Differ::LineMode) {
|
if (m_currentDiffMode == Differ::LineMode) {
|
||||||
int subtextEnd = text.indexOf('\n', subtextStart);
|
int subtextEnd = text.indexOf('\n', subtextStart);
|
||||||
if (subtextEnd == -1)
|
if (subtextEnd == -1)
|
||||||
subtextEnd = text.count() - 1;
|
subtextEnd = text.size() - 1;
|
||||||
return ++subtextEnd;
|
return ++subtextEnd;
|
||||||
} else if (m_currentDiffMode == Differ::WordMode) {
|
} else if (m_currentDiffMode == Differ::WordMode) {
|
||||||
if (!text.at(subtextStart).isLetter())
|
if (!text.at(subtextStart).isLetter())
|
||||||
return subtextStart + 1;
|
return subtextStart + 1;
|
||||||
int i = subtextStart + 1;
|
int i = subtextStart + 1;
|
||||||
|
|
||||||
const int count = text.count();
|
const int count = text.size();
|
||||||
while (i < count && text.at(i).isLetter())
|
while (i < count && text.at(i).isLetter())
|
||||||
i++;
|
i++;
|
||||||
return i;
|
return i;
|
||||||
@@ -1262,7 +1261,7 @@ QString Differ::encode(const QString &text,
|
|||||||
int subtextStart = 0;
|
int subtextStart = 0;
|
||||||
int subtextEnd = -1;
|
int subtextEnd = -1;
|
||||||
QString codes;
|
QString codes;
|
||||||
while (subtextEnd < text.count()) {
|
while (subtextEnd < text.size()) {
|
||||||
subtextEnd = findSubtextEnd(text, subtextStart);
|
subtextEnd = findSubtextEnd(text, subtextStart);
|
||||||
const QString line = text.mid(subtextStart, subtextEnd - subtextStart);
|
const QString line = text.mid(subtextStart, subtextEnd - subtextStart);
|
||||||
subtextStart = subtextEnd;
|
subtextStart = subtextEnd;
|
||||||
@@ -1271,8 +1270,8 @@ QString Differ::encode(const QString &text,
|
|||||||
codes += QChar(static_cast<ushort>(lineToCode->value(line)));
|
codes += QChar(static_cast<ushort>(lineToCode->value(line)));
|
||||||
} else {
|
} else {
|
||||||
lines->append(line);
|
lines->append(line);
|
||||||
lineToCode->insert(line, lines->count() - 1);
|
lineToCode->insert(line, lines->size() - 1);
|
||||||
codes += QChar(static_cast<ushort>(lines->count() - 1));
|
codes += QChar(static_cast<ushort>(lines->size() - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return codes;
|
return codes;
|
||||||
@@ -1283,8 +1282,8 @@ QList<Diff> Differ::merge(const QList<Diff> &diffList)
|
|||||||
QString lastDelete;
|
QString lastDelete;
|
||||||
QString lastInsert;
|
QString lastInsert;
|
||||||
QList<Diff> newDiffList;
|
QList<Diff> newDiffList;
|
||||||
for (int i = 0; i <= diffList.count(); i++) {
|
for (int i = 0; i <= diffList.size(); i++) {
|
||||||
Diff diff = i < diffList.count()
|
Diff diff = i < diffList.size()
|
||||||
? diffList.at(i)
|
? diffList.at(i)
|
||||||
: Diff(Diff::Equal); // dummy, ensure we process to the end
|
: Diff(Diff::Equal); // dummy, ensure we process to the end
|
||||||
// even when diffList doesn't end with equality
|
// even when diffList doesn't end with equality
|
||||||
@@ -1314,8 +1313,8 @@ QList<Diff> Differ::merge(const QList<Diff> &diffList)
|
|||||||
const int suffixCount = commonSuffix(lastDelete, lastInsert);
|
const int suffixCount = commonSuffix(lastDelete, lastInsert);
|
||||||
if (suffixCount) {
|
if (suffixCount) {
|
||||||
const QString suffix = lastDelete.right(suffixCount);
|
const QString suffix = lastDelete.right(suffixCount);
|
||||||
lastDelete = lastDelete.left(lastDelete.count() - suffixCount);
|
lastDelete = lastDelete.left(lastDelete.size() - suffixCount);
|
||||||
lastInsert = lastInsert.left(lastInsert.count() - suffixCount);
|
lastInsert = lastInsert.left(lastInsert.size() - suffixCount);
|
||||||
|
|
||||||
diff.text.prepend(suffix);
|
diff.text.prepend(suffix);
|
||||||
}
|
}
|
||||||
@@ -1342,7 +1341,7 @@ QList<Diff> Differ::merge(const QList<Diff> &diffList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<Diff> squashedDiffList = squashEqualities(newDiffList);
|
QList<Diff> squashedDiffList = squashEqualities(newDiffList);
|
||||||
if (squashedDiffList.count() != newDiffList.count())
|
if (squashedDiffList.size() != newDiffList.size())
|
||||||
return merge(squashedDiffList);
|
return merge(squashedDiffList);
|
||||||
|
|
||||||
return squashedDiffList;
|
return squashedDiffList;
|
||||||
@@ -1363,8 +1362,8 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
|
|||||||
int inserts = 0;
|
int inserts = 0;
|
||||||
// equality index, equality data
|
// equality index, equality data
|
||||||
QList<EqualityData> equalities;
|
QList<EqualityData> equalities;
|
||||||
for (int i = 0; i <= diffList.count(); i++) {
|
for (int i = 0; i <= diffList.size(); i++) {
|
||||||
const Diff diff = i < diffList.count()
|
const Diff diff = i < diffList.size()
|
||||||
? diffList.at(i)
|
? diffList.at(i)
|
||||||
: Diff(Diff::Equal); // dummy, ensure we process to the end
|
: Diff(Diff::Equal); // dummy, ensure we process to the end
|
||||||
// even when diffList doesn't end with equality
|
// even when diffList doesn't end with equality
|
||||||
@@ -1374,10 +1373,10 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
|
|||||||
previousData.deletesAfter = deletes;
|
previousData.deletesAfter = deletes;
|
||||||
previousData.insertsAfter = inserts;
|
previousData.insertsAfter = inserts;
|
||||||
}
|
}
|
||||||
if (i < diffList.count()) { // don't insert dummy
|
if (i < diffList.size()) { // don't insert dummy
|
||||||
EqualityData data;
|
EqualityData data;
|
||||||
data.equalityIndex = i;
|
data.equalityIndex = i;
|
||||||
data.textCount = diff.text.count();
|
data.textCount = diff.text.size();
|
||||||
data.deletesBefore = deletes;
|
data.deletesBefore = deletes;
|
||||||
data.insertsBefore = inserts;
|
data.insertsBefore = inserts;
|
||||||
equalities.append(data);
|
equalities.append(data);
|
||||||
@@ -1386,15 +1385,15 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (diff.command == Diff::Delete)
|
if (diff.command == Diff::Delete)
|
||||||
deletes += diff.text.count();
|
deletes += diff.text.size();
|
||||||
else if (diff.command == Diff::Insert)
|
else if (diff.command == Diff::Insert)
|
||||||
inserts += diff.text.count();
|
inserts += diff.text.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<int, bool> equalitiesToBeSplit;
|
QMap<int, bool> equalitiesToBeSplit;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < equalities.count()) {
|
while (i < equalities.size()) {
|
||||||
const EqualityData &data = equalities.at(i);
|
const EqualityData &data = equalities.at(i);
|
||||||
if (data.textCount <= qMax(data.deletesBefore, data.insertsBefore)
|
if (data.textCount <= qMax(data.deletesBefore, data.insertsBefore)
|
||||||
&& data.textCount <= qMax(data.deletesAfter, data.insertsAfter)) {
|
&& data.textCount <= qMax(data.deletesAfter, data.insertsAfter)) {
|
||||||
@@ -1403,7 +1402,7 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
|
|||||||
previousData.deletesAfter += data.textCount + data.deletesAfter;
|
previousData.deletesAfter += data.textCount + data.deletesAfter;
|
||||||
previousData.insertsAfter += data.textCount + data.insertsAfter;
|
previousData.insertsAfter += data.textCount + data.insertsAfter;
|
||||||
}
|
}
|
||||||
if (i < equalities.count() - 1) {
|
if (i < equalities.size() - 1) {
|
||||||
EqualityData &nextData = equalities[i + 1];
|
EqualityData &nextData = equalities[i + 1];
|
||||||
nextData.deletesBefore += data.textCount + data.deletesBefore;
|
nextData.deletesBefore += data.textCount + data.deletesBefore;
|
||||||
nextData.insertsBefore += data.textCount + data.insertsBefore;
|
nextData.insertsBefore += data.textCount + data.insertsBefore;
|
||||||
@@ -1418,7 +1417,7 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<Diff> newDiffList;
|
QList<Diff> newDiffList;
|
||||||
for (int i = 0; i < diffList.count(); i++) {
|
for (int i = 0; i < diffList.size(); i++) {
|
||||||
const Diff &diff = diffList.at(i);
|
const Diff &diff = diffList.at(i);
|
||||||
if (equalitiesToBeSplit.contains(i)) {
|
if (equalitiesToBeSplit.contains(i)) {
|
||||||
newDiffList.append(Diff(Diff::Delete, diff.text));
|
newDiffList.append(Diff(Diff::Delete, diff.text));
|
||||||
@@ -1433,7 +1432,7 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
|
|||||||
|
|
||||||
QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
|
QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
|
||||||
{
|
{
|
||||||
if (diffList.count() < 3) // we need at least 3 items
|
if (diffList.size() < 3) // we need at least 3 items
|
||||||
return diffList;
|
return diffList;
|
||||||
|
|
||||||
QList<Diff> newDiffList;
|
QList<Diff> newDiffList;
|
||||||
@@ -1441,7 +1440,7 @@ QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
|
|||||||
Diff thisDiff = diffList.at(1);
|
Diff thisDiff = diffList.at(1);
|
||||||
Diff nextDiff = diffList.at(2);
|
Diff nextDiff = diffList.at(2);
|
||||||
int i = 2;
|
int i = 2;
|
||||||
while (i < diffList.count()) {
|
while (i < diffList.size()) {
|
||||||
if (prevDiff.command == Diff::Equal
|
if (prevDiff.command == Diff::Equal
|
||||||
&& nextDiff.command == Diff::Equal) {
|
&& nextDiff.command == Diff::Equal) {
|
||||||
|
|
||||||
@@ -1453,9 +1452,9 @@ QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
|
|||||||
// Shift the edit as far left as possible
|
// Shift the edit as far left as possible
|
||||||
const int suffixCount = commonSuffix(equality1, edit);
|
const int suffixCount = commonSuffix(equality1, edit);
|
||||||
if (suffixCount) {
|
if (suffixCount) {
|
||||||
const QString commonString = edit.mid(edit.count() - suffixCount);
|
const QString commonString = edit.mid(edit.size() - suffixCount);
|
||||||
equality1 = equality1.left(equality1.count() - suffixCount);
|
equality1 = equality1.left(equality1.size() - suffixCount);
|
||||||
edit = commonString + edit.left(edit.count() - suffixCount);
|
edit = commonString + edit.left(edit.size() - suffixCount);
|
||||||
equality2 = commonString + equality2;
|
equality2 = commonString + equality2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1488,7 +1487,7 @@ QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
|
|||||||
newDiffList.append(prevDiff); // append modified equality1
|
newDiffList.append(prevDiff); // append modified equality1
|
||||||
if (bestEquality2.isEmpty()) {
|
if (bestEquality2.isEmpty()) {
|
||||||
i++;
|
i++;
|
||||||
if (i < diffList.count())
|
if (i < diffList.size())
|
||||||
nextDiff = diffList.at(i); // omit equality2
|
nextDiff = diffList.at(i); // omit equality2
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1497,11 +1496,11 @@ QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
|
|||||||
prevDiff = thisDiff;
|
prevDiff = thisDiff;
|
||||||
thisDiff = nextDiff;
|
thisDiff = nextDiff;
|
||||||
i++;
|
i++;
|
||||||
if (i < diffList.count())
|
if (i < diffList.size())
|
||||||
nextDiff = diffList.at(i);
|
nextDiff = diffList.at(i);
|
||||||
}
|
}
|
||||||
newDiffList.append(prevDiff);
|
newDiffList.append(prevDiff);
|
||||||
if (i == diffList.count())
|
if (i == diffList.size())
|
||||||
newDiffList.append(thisDiff);
|
newDiffList.append(thisDiff);
|
||||||
return newDiffList;
|
return newDiffList;
|
||||||
}
|
}
|
||||||
|
@@ -151,12 +151,12 @@ bool FileNameValidatingLineEdit::validateFileNameExtension(const QString &fileNa
|
|||||||
if (!requiredExtensions.isEmpty()) {
|
if (!requiredExtensions.isEmpty()) {
|
||||||
for (const QString &requiredExtension : requiredExtensions) {
|
for (const QString &requiredExtension : requiredExtensions) {
|
||||||
QString extension = QLatin1Char('.') + requiredExtension;
|
QString extension = QLatin1Char('.') + requiredExtension;
|
||||||
if (fileName.endsWith(extension, Qt::CaseSensitive) && extension.count() < fileName.count())
|
if (fileName.endsWith(extension, Qt::CaseSensitive) && extension.size() < fileName.size())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorMessage) {
|
if (errorMessage) {
|
||||||
if (requiredExtensions.count() == 1)
|
if (requiredExtensions.size() == 1)
|
||||||
*errorMessage = Tr::tr("File extension %1 is required:").arg(requiredExtensions.first());
|
*errorMessage = Tr::tr("File extension %1 is required:").arg(requiredExtensions.first());
|
||||||
else
|
else
|
||||||
*errorMessage = Tr::tr("File extensions %1 are required:").arg(requiredExtensions.join(QLatin1String(", ")));
|
*errorMessage = Tr::tr("File extensions %1 are required:").arg(requiredExtensions.join(QLatin1String(", ")));
|
||||||
|
@@ -201,7 +201,7 @@ void HighlightingItemDelegate::drawText(QPainter *painter,
|
|||||||
static QString replaceNewLine(QString text)
|
static QString replaceNewLine(QString text)
|
||||||
{
|
{
|
||||||
static const QChar nl = '\n';
|
static const QChar nl = '\n';
|
||||||
for (int i = 0; i < text.count(); ++i)
|
for (int i = 0; i < text.size(); ++i)
|
||||||
if (text.at(i) == nl)
|
if (text.at(i) == nl)
|
||||||
text[i] = QChar::LineSeparator;
|
text[i] = QChar::LineSeparator;
|
||||||
return text;
|
return text;
|
||||||
|
@@ -449,7 +449,7 @@ void OutputFormatter::append(const QString &text, const QTextCharFormat &format)
|
|||||||
d->cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
|
d->cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor);
|
||||||
startPos = crPos + 1;
|
startPos = crPos + 1;
|
||||||
}
|
}
|
||||||
if (startPos < text.count())
|
if (startPos < text.size())
|
||||||
d->cursor.insertText(text.mid(startPos), format);
|
d->cursor.insertText(text.mid(startPos), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -303,7 +303,7 @@ bool ProjectIntroPage::validateProjectName(const QString &name, QString *errorMe
|
|||||||
|
|
||||||
// if pos is set by validate it is cought at the bottom where it shows
|
// if pos is set by validate it is cought at the bottom where it shows
|
||||||
// a more detailed error message
|
// a more detailed error message
|
||||||
if (validatorState != QValidator::Acceptable && (pos == -1 || pos >= name.count())) {
|
if (validatorState != QValidator::Acceptable && (pos == -1 || pos >= name.size())) {
|
||||||
if (errorMessage) {
|
if (errorMessage) {
|
||||||
if (d->m_projectNameValidatorUserMessage.isEmpty())
|
if (d->m_projectNameValidatorUserMessage.isEmpty())
|
||||||
*errorMessage = Tr::tr("Project name is invalid.");
|
*errorMessage = Tr::tr("Project name is invalid.");
|
||||||
|
@@ -235,9 +235,9 @@ QString TemplateEngine::processText(MacroExpander *expander, const QString &inpu
|
|||||||
|
|
||||||
// Expand \n, \t and handle line continuation:
|
// Expand \n, \t and handle line continuation:
|
||||||
QString result;
|
QString result;
|
||||||
result.reserve(out.count());
|
result.reserve(out.size());
|
||||||
bool isEscaped = false;
|
bool isEscaped = false;
|
||||||
for (int i = 0; i < out.count(); ++i) {
|
for (int i = 0; i < out.size(); ++i) {
|
||||||
const QChar c = out.at(i);
|
const QChar c = out.at(i);
|
||||||
|
|
||||||
if (isEscaped) {
|
if (isEscaped) {
|
||||||
|
@@ -54,10 +54,10 @@ static QString formatResult(double value)
|
|||||||
|
|
||||||
QString beforeDecimalPoint = QString::number(value, 'f', 0);
|
QString beforeDecimalPoint = QString::number(value, 'f', 0);
|
||||||
QString afterDecimalPoint = QString::number(value, 'f', 20);
|
QString afterDecimalPoint = QString::number(value, 'f', 20);
|
||||||
afterDecimalPoint.remove(0, beforeDecimalPoint.count() + 1);
|
afterDecimalPoint.remove(0, beforeDecimalPoint.size() + 1);
|
||||||
|
|
||||||
const int beforeUse = qMin(beforeDecimalPoint.count(), significantDigits);
|
const int beforeUse = qMin(beforeDecimalPoint.size(), significantDigits);
|
||||||
const int beforeRemove = beforeDecimalPoint.count() - beforeUse;
|
const int beforeRemove = beforeDecimalPoint.size() - beforeUse;
|
||||||
|
|
||||||
beforeDecimalPoint.chop(beforeRemove);
|
beforeDecimalPoint.chop(beforeRemove);
|
||||||
for (int i = 0; i < beforeRemove; ++i)
|
for (int i = 0; i < beforeRemove; ++i)
|
||||||
@@ -67,12 +67,12 @@ static QString formatResult(double value)
|
|||||||
if (beforeDecimalPoint == QString("0") && !afterDecimalPoint.isEmpty()) {
|
if (beforeDecimalPoint == QString("0") && !afterDecimalPoint.isEmpty()) {
|
||||||
++afterUse;
|
++afterUse;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < afterDecimalPoint.count() && afterDecimalPoint.at(i) == '0')
|
while (i < afterDecimalPoint.size() && afterDecimalPoint.at(i) == '0')
|
||||||
++i;
|
++i;
|
||||||
afterUse += i;
|
afterUse += i;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int afterRemove = afterDecimalPoint.count() - afterUse;
|
const int afterRemove = afterDecimalPoint.size() - afterUse;
|
||||||
afterDecimalPoint.chop(afterRemove);
|
afterDecimalPoint.chop(afterRemove);
|
||||||
|
|
||||||
QString result = beforeDecimalPoint;
|
QString result = beforeDecimalPoint;
|
||||||
|
@@ -230,7 +230,7 @@ QString DiagnosticTextInfo::option() const
|
|||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
const int index = m_squareBracketStartIndex + 1;
|
const int index = m_squareBracketStartIndex + 1;
|
||||||
return m_text.mid(index, m_text.count() - index - 1);
|
return m_text.mid(index, m_text.size() - index - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DiagnosticTextInfo::category() const
|
QString DiagnosticTextInfo::category() const
|
||||||
|
@@ -215,13 +215,13 @@ bool CMakeConfigItem::less(const CMakeConfigItem &a, const CMakeConfigItem &b)
|
|||||||
CMakeConfigItem CMakeConfigItem::fromString(const QString &s)
|
CMakeConfigItem CMakeConfigItem::fromString(const QString &s)
|
||||||
{
|
{
|
||||||
// Strip comments (only at start of line!):
|
// Strip comments (only at start of line!):
|
||||||
int commentStart = s.count();
|
int commentStart = s.size();
|
||||||
for (int i = 0; i < s.count(); ++i) {
|
for (int i = 0; i < s.size(); ++i) {
|
||||||
const QChar c = s.at(i);
|
const QChar c = s.at(i);
|
||||||
if (c == ' ' || c == '\t')
|
if (c == ' ' || c == '\t')
|
||||||
continue;
|
continue;
|
||||||
else if ((c == '#')
|
else if ((c == '#')
|
||||||
|| (c == '/' && i < s.count() - 1 && s.at(i + 1) == '/')) {
|
|| (c == '/' && i < s.size() - 1 && s.at(i + 1) == '/')) {
|
||||||
commentStart = i;
|
commentStart = i;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@@ -234,7 +234,7 @@ CMakeConfigItem CMakeConfigItem::fromString(const QString &s)
|
|||||||
int firstPos = -1;
|
int firstPos = -1;
|
||||||
int colonPos = -1;
|
int colonPos = -1;
|
||||||
int equalPos = -1;
|
int equalPos = -1;
|
||||||
for (int i = 0; i < line.count(); ++i) {
|
for (int i = 0; i < line.size(); ++i) {
|
||||||
const QChar c = s.at(i);
|
const QChar c = s.at(i);
|
||||||
if (firstPos < 0 && !c.isSpace()) {
|
if (firstPos < 0 && !c.isSpace()) {
|
||||||
firstPos = i;
|
firstPos = i;
|
||||||
@@ -371,7 +371,7 @@ CMakeConfig CMakeConfig::fromFile(const Utils::FilePath &cacheFile, QString *err
|
|||||||
if (pieces.isEmpty())
|
if (pieces.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QTC_ASSERT(pieces.count() == 3, continue);
|
QTC_ASSERT(pieces.size() == 3, continue);
|
||||||
const QByteArray key = pieces.at(0);
|
const QByteArray key = pieces.at(0);
|
||||||
const QByteArray type = pieces.at(1);
|
const QByteArray type = pieces.at(1);
|
||||||
const QByteArray value = pieces.at(2);
|
const QByteArray value = pieces.at(2);
|
||||||
@@ -387,7 +387,7 @@ CMakeConfig CMakeConfig::fromFile(const Utils::FilePath &cacheFile, QString *err
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set advanced flags:
|
// Set advanced flags:
|
||||||
for (int i = 0; i < result.count(); ++i) {
|
for (int i = 0; i < result.size(); ++i) {
|
||||||
CMakeConfigItem &item = result[i];
|
CMakeConfigItem &item = result[i];
|
||||||
item.isAdvanced = advancedSet.contains(item.key);
|
item.isAdvanced = advancedSet.contains(item.key);
|
||||||
|
|
||||||
|
@@ -169,7 +169,7 @@ void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
|
|||||||
|
|
||||||
// find the end of a filename
|
// find the end of a filename
|
||||||
int endPos = column;
|
int endPos = column;
|
||||||
while (endPos < block.count()) {
|
while (endPos < block.size()) {
|
||||||
if (isValidFileNameChar(block, endPos)) {
|
if (isValidFileNameChar(block, endPos)) {
|
||||||
buffer.append(block.at(endPos));
|
buffer.append(block.at(endPos));
|
||||||
endPos++;
|
endPos++;
|
||||||
|
@@ -28,7 +28,7 @@ static std::pair<int, QString> lineNumberInfo(const QStyleOptionViewItem &option
|
|||||||
if (lineNumber < 1)
|
if (lineNumber < 1)
|
||||||
return {0, {}};
|
return {0, {}};
|
||||||
const QString lineNumberText = QString::number(lineNumber);
|
const QString lineNumberText = QString::number(lineNumber);
|
||||||
const int lineNumberDigits = qMax(minimumLineNumberDigits, lineNumberText.count());
|
const int lineNumberDigits = qMax(minimumLineNumberDigits, lineNumberText.size());
|
||||||
const int fontWidth = option.fontMetrics.horizontalAdvance(QString(lineNumberDigits, QLatin1Char('0')));
|
const int fontWidth = option.fontMetrics.horizontalAdvance(QString(lineNumberDigits, QLatin1Char('0')));
|
||||||
const QStyle *style = option.widget ? option.widget->style() : QApplication::style();
|
const QStyle *style = option.widget ? option.widget->style() : QApplication::style();
|
||||||
return {lineNumberAreaHorizontalPadding + fontWidth + lineNumberAreaHorizontalPadding
|
return {lineNumberAreaHorizontalPadding + fontWidth + lineNumberAreaHorizontalPadding
|
||||||
|
@@ -177,7 +177,7 @@ QString HelpItem::extractContent(bool extended) const
|
|||||||
// include separators for major vs minor vs patch version.
|
// include separators for major vs minor vs patch version.
|
||||||
static QVersionNumber qtVersionHeuristic(const QString &digits)
|
static QVersionNumber qtVersionHeuristic(const QString &digits)
|
||||||
{
|
{
|
||||||
if (digits.count() > 6 || digits.count() < 3)
|
if (digits.size() > 6 || digits.size() < 3)
|
||||||
return {}; // suspicious version number
|
return {}; // suspicious version number
|
||||||
|
|
||||||
for (const QChar &digit : digits)
|
for (const QChar &digit : digits)
|
||||||
@@ -188,7 +188,7 @@ static QVersionNumber qtVersionHeuristic(const QString &digits)
|
|||||||
// When we have 4 digits, we split it like: ABCD -> A.BC.D
|
// When we have 4 digits, we split it like: ABCD -> A.BC.D
|
||||||
// When we have 5 digits, we split it like: ABCDE -> A.BC.DE
|
// When we have 5 digits, we split it like: ABCDE -> A.BC.DE
|
||||||
// When we have 6 digits, we split it like: ABCDEF -> AB.CD.EF
|
// When we have 6 digits, we split it like: ABCDEF -> AB.CD.EF
|
||||||
switch (digits.count()) {
|
switch (digits.size()) {
|
||||||
case 3:
|
case 3:
|
||||||
return QVersionNumber(digits.mid(0, 1).toInt(),
|
return QVersionNumber(digits.mid(0, 1).toInt(),
|
||||||
digits.mid(1, 1).toInt(),
|
digits.mid(1, 1).toInt(),
|
||||||
|
@@ -80,7 +80,7 @@ public:
|
|||||||
QTC_ASSERT((topLevel.isEmpty() && !vc) || (!topLevel.isEmpty() && vc), return);
|
QTC_ASSERT((topLevel.isEmpty() && !vc) || (!topLevel.isEmpty() && vc), return);
|
||||||
|
|
||||||
FilePath tmpDir = dir;
|
FilePath tmpDir = dir;
|
||||||
while (tmpDir.toString().count() >= topLevelString.count() && !tmpDir.isEmpty()) {
|
while (tmpDir.toString().size() >= topLevelString.size() && !tmpDir.isEmpty()) {
|
||||||
m_cachedMatches.insert(tmpDir, {vc, topLevel});
|
m_cachedMatches.insert(tmpDir, {vc, topLevel});
|
||||||
// if no vc was found, this might mean we're inside a repo internal directory (.git)
|
// if no vc was found, this might mean we're inside a repo internal directory (.git)
|
||||||
// Cache only input directory, not parents
|
// Cache only input directory, not parents
|
||||||
@@ -237,7 +237,7 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const FilePath &inpu
|
|||||||
for (auto i = allThatCanManage.constBegin(); i != allThatCanManage.constEnd(); ++i) {
|
for (auto i = allThatCanManage.constBegin(); i != allThatCanManage.constEnd(); ++i) {
|
||||||
const QString firstString = i->first.toString();
|
const QString firstString = i->first.toString();
|
||||||
// If topLevel was already cached for another VC, skip this one
|
// If topLevel was already cached for another VC, skip this one
|
||||||
if (tmpDir.toString().count() < firstString.count())
|
if (tmpDir.toString().size() < firstString.size())
|
||||||
continue;
|
continue;
|
||||||
d->cache(i->second, i->first, tmpDir);
|
d->cache(i->second, i->first, tmpDir);
|
||||||
tmpDir = i->first.parentDir();
|
tmpDir = i->first.parentDir();
|
||||||
@@ -458,7 +458,7 @@ static FileHash makeHash(const QStringList &list)
|
|||||||
FileHash result;
|
FileHash result;
|
||||||
for (const QString &i : list) {
|
for (const QString &i : list) {
|
||||||
QStringList parts = i.split(QLatin1Char(':'));
|
QStringList parts = i.split(QLatin1Char(':'));
|
||||||
QTC_ASSERT(parts.count() == 2, continue);
|
QTC_ASSERT(parts.size() == 2, continue);
|
||||||
result.insert(FilePath::fromString(QString::fromLatin1(TEST_PREFIX) + parts.at(0)),
|
result.insert(FilePath::fromString(QString::fromLatin1(TEST_PREFIX) + parts.at(0)),
|
||||||
FilePath::fromString(QString::fromLatin1(TEST_PREFIX) + parts.at(1)));
|
FilePath::fromString(QString::fromLatin1(TEST_PREFIX) + parts.at(1)));
|
||||||
}
|
}
|
||||||
@@ -547,7 +547,7 @@ void CorePlugin::testVcsManager()
|
|||||||
// qDebug() << "Expecting:" << result;
|
// qDebug() << "Expecting:" << result;
|
||||||
|
|
||||||
const QStringList split = result.split(QLatin1Char(':'));
|
const QStringList split = result.split(QLatin1Char(':'));
|
||||||
QCOMPARE(split.count(), 4);
|
QCOMPARE(split.size(), 4);
|
||||||
QVERIFY(split.at(3) == QLatin1String("*") || split.at(3) == QLatin1String("-"));
|
QVERIFY(split.at(3) == QLatin1String("*") || split.at(3) == QLatin1String("-"));
|
||||||
|
|
||||||
|
|
||||||
|
@@ -58,7 +58,7 @@ static bool isElectricInLine(const QChar ch, const QString &text)
|
|||||||
case '<':
|
case '<':
|
||||||
case '>': {
|
case '>': {
|
||||||
// Electric if at line beginning (after space indentation)
|
// Electric if at line beginning (after space indentation)
|
||||||
for (int i = 0, len = text.count(); i < len; ++i) {
|
for (int i = 0, len = text.size(); i < len; ++i) {
|
||||||
if (!text.at(i).isSpace())
|
if (!text.at(i).isSpace())
|
||||||
return text.at(i) == ch;
|
return text.at(i) == ch;
|
||||||
}
|
}
|
||||||
|
@@ -339,7 +339,7 @@ static QString addConstRefIfNeeded(const QString &argument)
|
|||||||
"long", "short", "char", "signed",
|
"long", "short", "char", "signed",
|
||||||
"unsigned", "qint64", "quint64"});
|
"unsigned", "qint64", "quint64"});
|
||||||
|
|
||||||
for (int i = 0; i < nonConstRefs.count(); i++) {
|
for (int i = 0; i < nonConstRefs.size(); i++) {
|
||||||
const QString &nonConstRef = nonConstRefs.at(i);
|
const QString &nonConstRef = nonConstRefs.at(i);
|
||||||
if (argument == nonConstRef || argument.startsWith(nonConstRef + ' '))
|
if (argument == nonConstRef || argument.startsWith(nonConstRef + ' '))
|
||||||
return argument;
|
return argument;
|
||||||
@@ -350,7 +350,7 @@ static QString addConstRefIfNeeded(const QString &argument)
|
|||||||
static QString formatArgument(const QString &argument)
|
static QString formatArgument(const QString &argument)
|
||||||
{
|
{
|
||||||
QString formattedArgument = argument;
|
QString formattedArgument = argument;
|
||||||
int i = argument.count();
|
int i = argument.size();
|
||||||
while (i > 0) { // from the end of the "argument" string
|
while (i > 0) { // from the end of the "argument" string
|
||||||
i--;
|
i--;
|
||||||
const QChar c = argument.at(i); // take the char
|
const QChar c = argument.at(i); // take the char
|
||||||
@@ -373,8 +373,8 @@ static QString addParameterNames(const QString &functionSignature, const QString
|
|||||||
if (lastParen != -1)
|
if (lastParen != -1)
|
||||||
argumentsString.truncate(lastParen);
|
argumentsString.truncate(lastParen);
|
||||||
const QStringList arguments = argumentsString.split(',', Qt::SkipEmptyParts);
|
const QStringList arguments = argumentsString.split(',', Qt::SkipEmptyParts);
|
||||||
const int pCount = parameterNames.count();
|
const int pCount = parameterNames.size();
|
||||||
const int aCount = arguments.count();
|
const int aCount = arguments.size();
|
||||||
for (int i = 0; i < aCount; ++i) {
|
for (int i = 0; i < aCount; ++i) {
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
functionName += ", ";
|
functionName += ", ";
|
||||||
|
@@ -316,7 +316,7 @@ static SideBySideDiffOutput diffOutput(QPromise<SideBySideShowResults> &promise,
|
|||||||
addChunkLine(RightSide, -2);
|
addChunkLine(RightSide, -2);
|
||||||
blockNumber++;
|
blockNumber++;
|
||||||
} else {
|
} else {
|
||||||
for (int j = 0; j < contextFileData.chunks.count(); j++) {
|
for (int j = 0; j < contextFileData.chunks.size(); j++) {
|
||||||
const ChunkData &chunkData = contextFileData.chunks.at(j);
|
const ChunkData &chunkData = contextFileData.chunks.at(j);
|
||||||
|
|
||||||
int leftLineNumber = chunkData.startingLineNumber[LeftSide];
|
int leftLineNumber = chunkData.startingLineNumber[LeftSide];
|
||||||
@@ -331,7 +331,7 @@ static SideBySideDiffOutput diffOutput(QPromise<SideBySideShowResults> &promise,
|
|||||||
blockNumber++;
|
blockNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int rows = chunkData.rows.count();
|
const int rows = chunkData.rows.size();
|
||||||
output.side[LeftSide].diffData.m_chunkInfo.setChunkIndex(blockNumber, rows, j);
|
output.side[LeftSide].diffData.m_chunkInfo.setChunkIndex(blockNumber, rows, j);
|
||||||
output.side[RightSide].diffData.m_chunkInfo.setChunkIndex(blockNumber, rows, j);
|
output.side[RightSide].diffData.m_chunkInfo.setChunkIndex(blockNumber, rows, j);
|
||||||
|
|
||||||
@@ -342,11 +342,11 @@ static SideBySideDiffOutput diffOutput(QPromise<SideBySideShowResults> &promise,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j == contextFileData.chunks.count() - 1) { // the last chunk
|
if (j == contextFileData.chunks.size() - 1) { // the last chunk
|
||||||
int skippedLines = -2;
|
int skippedLines = -2;
|
||||||
if (chunkData.contextChunk) {
|
if (chunkData.contextChunk) {
|
||||||
// if it's context chunk
|
// if it's context chunk
|
||||||
skippedLines = chunkData.rows.count();
|
skippedLines = chunkData.rows.size();
|
||||||
} else if (!contextFileData.lastChunkAtTheEndOfFile
|
} else if (!contextFileData.lastChunkAtTheEndOfFile
|
||||||
&& !contextFileData.contextChunksIncluded) {
|
&& !contextFileData.contextChunksIncluded) {
|
||||||
// if not a context chunk and not a chunk at the end of file
|
// if not a context chunk and not a chunk at the end of file
|
||||||
@@ -381,7 +381,7 @@ void SideDiffData::setLineNumber(int blockNumber, int lineNumber)
|
|||||||
{
|
{
|
||||||
const QString lineNumberString = QString::number(lineNumber);
|
const QString lineNumberString = QString::number(lineNumber);
|
||||||
m_lineNumbers.insert(blockNumber, lineNumber);
|
m_lineNumbers.insert(blockNumber, lineNumber);
|
||||||
m_lineNumberDigits = qMax(m_lineNumberDigits, lineNumberString.count());
|
m_lineNumberDigits = qMax(m_lineNumberDigits, lineNumberString.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideDiffData::setFileInfo(int blockNumber, const DiffFileInfo &fileInfo)
|
void SideDiffData::setFileInfo(int blockNumber, const DiffFileInfo &fileInfo)
|
||||||
@@ -986,7 +986,7 @@ void SideBySideDiffEditorWidget::setFontSettings(const FontSettings &fontSetting
|
|||||||
void SideBySideDiffEditorWidget::jumpToOriginalFileRequested(DiffSide side, int diffFileIndex,
|
void SideBySideDiffEditorWidget::jumpToOriginalFileRequested(DiffSide side, int diffFileIndex,
|
||||||
int lineNumber, int columnNumber)
|
int lineNumber, int columnNumber)
|
||||||
{
|
{
|
||||||
if (diffFileIndex < 0 || diffFileIndex >= m_controller.m_contextFileData.count())
|
if (diffFileIndex < 0 || diffFileIndex >= m_controller.m_contextFileData.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const FileData fileData = m_controller.m_contextFileData.at(diffFileIndex);
|
const FileData fileData = m_controller.m_contextFileData.at(diffFileIndex);
|
||||||
@@ -1007,7 +1007,7 @@ void SideBySideDiffEditorWidget::jumpToOriginalFileRequested(DiffSide side, int
|
|||||||
int thisLineNumber = chunkData.startingLineNumber[side];
|
int thisLineNumber = chunkData.startingLineNumber[side];
|
||||||
int otherLineNumber = chunkData.startingLineNumber[otherSide];
|
int otherLineNumber = chunkData.startingLineNumber[otherSide];
|
||||||
|
|
||||||
for (int j = 0; j < chunkData.rows.count(); j++) {
|
for (int j = 0; j < chunkData.rows.size(); j++) {
|
||||||
const RowData rowData = chunkData.rows.at(j);
|
const RowData rowData = chunkData.rows.at(j);
|
||||||
if (rowData.line[side].textLineType == TextLineData::TextLine)
|
if (rowData.line[side].textLineType == TextLineData::TextLine)
|
||||||
thisLineNumber++;
|
thisLineNumber++;
|
||||||
|
@@ -91,7 +91,7 @@ bool operator<(const CommitData::StateFilePair &a, const CommitData::StateFilePa
|
|||||||
|
|
||||||
bool CommitData::checkLine(const QString &stateInfo, const QString &file)
|
bool CommitData::checkLine(const QString &stateInfo, const QString &file)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(stateInfo.count() == 2, return false);
|
QTC_ASSERT(stateInfo.size() == 2, return false);
|
||||||
|
|
||||||
if (stateInfo == "??") {
|
if (stateInfo == "??") {
|
||||||
files.push_back({FileStates(UntrackedFile), file});
|
files.push_back({FileStates(UntrackedFile), file});
|
||||||
|
@@ -2405,7 +2405,7 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR
|
|||||||
const int pos = line.lastIndexOf(pattern);
|
const int pos = line.lastIndexOf(pattern);
|
||||||
if (pos != -1) {
|
if (pos != -1) {
|
||||||
branchFound = true;
|
branchFound = true;
|
||||||
const QString branchName = line.mid(pos + pattern.count());
|
const QString branchName = line.mid(pos + pattern.size());
|
||||||
if (!headFound && line.startsWith(headSha)) {
|
if (!headFound && line.startsWith(headSha)) {
|
||||||
branches[0] = branchName;
|
branches[0] = branchName;
|
||||||
headFound = true;
|
headFound = true;
|
||||||
@@ -2816,7 +2816,7 @@ bool GitClient::addAndCommit(const FilePath &repositoryDirectory,
|
|||||||
if (state & (ModifiedFile | AddedFile | DeletedFile | TypeChangedFile)) {
|
if (state & (ModifiedFile | AddedFile | DeletedFile | TypeChangedFile)) {
|
||||||
filesToReset.append(file);
|
filesToReset.append(file);
|
||||||
} else if (state & (RenamedFile | CopiedFile)) {
|
} else if (state & (RenamedFile | CopiedFile)) {
|
||||||
const QString newFile = file.mid(file.indexOf(renameSeparator) + renameSeparator.count());
|
const QString newFile = file.mid(file.indexOf(renameSeparator) + renameSeparator.size());
|
||||||
filesToReset.append(newFile);
|
filesToReset.append(newFile);
|
||||||
}
|
}
|
||||||
} else if (state & UnmergedFile && checked) {
|
} else if (state & UnmergedFile && checked) {
|
||||||
|
@@ -578,7 +578,7 @@ QString Kit::toHtml(const Tasks &additional, const QString &extraText) const
|
|||||||
const KitAspect::ItemList list = aspect->toUserOutput(this);
|
const KitAspect::ItemList list = aspect->toUserOutput(this);
|
||||||
for (const KitAspect::Item &j : list) {
|
for (const KitAspect::Item &j : list) {
|
||||||
QString contents = j.second;
|
QString contents = j.second;
|
||||||
if (contents.count() > 256) {
|
if (contents.size() > 256) {
|
||||||
int pos = contents.lastIndexOf("<br>", 256);
|
int pos = contents.lastIndexOf("<br>", 256);
|
||||||
if (pos < 0) // no linebreak, so cut early.
|
if (pos < 0) // no linebreak, so cut early.
|
||||||
pos = 80;
|
pos = 80;
|
||||||
|
@@ -45,9 +45,10 @@ void RawProjectPart::setFiles(const QStringList &files,
|
|||||||
this->getMimeType = getMimeType;
|
this->getMimeType = getMimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString trimTrailingSlashes(const QString &path) {
|
static QString trimTrailingSlashes(const QString &path)
|
||||||
|
{
|
||||||
QString p = path;
|
QString p = path;
|
||||||
while (p.endsWith('/') && p.count() > 1) {
|
while (p.endsWith('/') && p.size() > 1) {
|
||||||
p.chop(1);
|
p.chop(1);
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
|
@@ -79,9 +79,9 @@ static QStringList parseRawLine(const QByteArray &raw)
|
|||||||
static QString unescape(const QString &input)
|
static QString unescape(const QString &input)
|
||||||
{
|
{
|
||||||
QString result;
|
QString result;
|
||||||
for (int i = 0; i < input.count(); ++i) {
|
for (int i = 0; i < input.size(); ++i) {
|
||||||
if (input.at(i) == '\\') {
|
if (input.at(i) == '\\') {
|
||||||
if (i == input.count() - 1)
|
if (i == input.size() - 1)
|
||||||
continue;
|
continue;
|
||||||
if (input.at(i + 1) == 'n') {
|
if (input.at(i + 1) == 'n') {
|
||||||
result.append('\n');
|
result.append('\n');
|
||||||
@@ -123,16 +123,16 @@ static bool parseTaskFile(QString *errorString, const FilePath &name)
|
|||||||
Task::TaskType type = Task::Unknown;
|
Task::TaskType type = Task::Unknown;
|
||||||
int line = -1;
|
int line = -1;
|
||||||
|
|
||||||
if (chunks.count() == 1) {
|
if (chunks.size() == 1) {
|
||||||
description = chunks.at(0);
|
description = chunks.at(0);
|
||||||
} else if (chunks.count() == 2) {
|
} else if (chunks.size() == 2) {
|
||||||
type = typeFrom(chunks.at(0));
|
type = typeFrom(chunks.at(0));
|
||||||
description = chunks.at(1);
|
description = chunks.at(1);
|
||||||
} else if (chunks.count() == 3) {
|
} else if (chunks.size() == 3) {
|
||||||
file = chunks.at(0);
|
file = chunks.at(0);
|
||||||
type = typeFrom(chunks.at(1));
|
type = typeFrom(chunks.at(1));
|
||||||
description = chunks.at(2);
|
description = chunks.at(2);
|
||||||
} else if (chunks.count() >= 4) {
|
} else if (chunks.size() >= 4) {
|
||||||
file = chunks.at(0);
|
file = chunks.at(0);
|
||||||
bool ok;
|
bool ok;
|
||||||
line = chunks.at(1).toInt(&ok);
|
line = chunks.at(1).toInt(&ok);
|
||||||
|
@@ -142,7 +142,7 @@ void ProFileEditorWidget::findLinkAt(const QTextCursor &cursor,
|
|||||||
bool doBackwardScan = true;
|
bool doBackwardScan = true;
|
||||||
|
|
||||||
if (posCurlyPwd >= 0) {
|
if (posCurlyPwd >= 0) {
|
||||||
const int end = chunkStart + posCurlyPwd + curlyPwd.count();
|
const int end = chunkStart + posCurlyPwd + curlyPwd.size();
|
||||||
const int start = chunkStart + posCurlyPwd;
|
const int start = chunkStart + posCurlyPwd;
|
||||||
if (start <= column && end >= column) {
|
if (start <= column && end >= column) {
|
||||||
buffer = pwd;
|
buffer = pwd;
|
||||||
@@ -151,7 +151,7 @@ void ProFileEditorWidget::findLinkAt(const QTextCursor &cursor,
|
|||||||
doBackwardScan = false;
|
doBackwardScan = false;
|
||||||
}
|
}
|
||||||
} else if (posPwd >= 0) {
|
} else if (posPwd >= 0) {
|
||||||
const int end = chunkStart + posPwd + pwd.count();
|
const int end = chunkStart + posPwd + pwd.size();
|
||||||
const int start = chunkStart + posPwd;
|
const int start = chunkStart + posPwd;
|
||||||
if (start <= column && end >= column) {
|
if (start <= column && end >= column) {
|
||||||
buffer = pwd;
|
buffer = pwd;
|
||||||
@@ -173,19 +173,19 @@ void ProFileEditorWidget::findLinkAt(const QTextCursor &cursor,
|
|||||||
|
|
||||||
if (doBackwardScan
|
if (doBackwardScan
|
||||||
&& beginPos > 0
|
&& beginPos > 0
|
||||||
&& block.mid(beginPos - 1, pwd.count()) == pwd
|
&& block.mid(beginPos - 1, pwd.size()) == pwd
|
||||||
&& (block.at(beginPos + pwd.count() - 1) == '/' || block.at(beginPos + pwd.count() - 1) == '\\')) {
|
&& (block.at(beginPos + pwd.size() - 1) == '/' || block.at(beginPos + pwd.size() - 1) == '\\')) {
|
||||||
buffer.prepend("$$");
|
buffer.prepend("$$");
|
||||||
beginPos -= 2;
|
beginPos -= 2;
|
||||||
} else if (doBackwardScan
|
} else if (doBackwardScan
|
||||||
&& beginPos >= curlyPwd.count() - 1
|
&& beginPos >= curlyPwd.size() - 1
|
||||||
&& block.mid(beginPos - curlyPwd.count() + 1, curlyPwd.count()) == curlyPwd) {
|
&& block.mid(beginPos - curlyPwd.size() + 1, curlyPwd.size()) == curlyPwd) {
|
||||||
buffer.prepend(pwd);
|
buffer.prepend(pwd);
|
||||||
beginPos -= curlyPwd.count();
|
beginPos -= curlyPwd.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the end of a filename
|
// find the end of a filename
|
||||||
while (endPos < block.count()) {
|
while (endPos < block.size()) {
|
||||||
QChar c = block.at(endPos);
|
QChar c = block.at(endPos);
|
||||||
if (isValidFileNameChar(c)) {
|
if (isValidFileNameChar(c)) {
|
||||||
buffer.append(c);
|
buffer.append(c);
|
||||||
|
@@ -83,7 +83,7 @@ static void splitIdInBaseNameAndNumber(const QString &id, QString *baseId, int *
|
|||||||
{
|
{
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
while (counter < id.count()) {
|
while (counter < id.size()) {
|
||||||
bool canConvertToInteger = false;
|
bool canConvertToInteger = false;
|
||||||
int newNumber = id.right(counter + 1).toInt(&canConvertToInteger);
|
int newNumber = id.right(counter + 1).toInt(&canConvertToInteger);
|
||||||
if (canConvertToInteger)
|
if (canConvertToInteger)
|
||||||
@@ -94,7 +94,7 @@ static void splitIdInBaseNameAndNumber(const QString &id, QString *baseId, int *
|
|||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
*baseId = id.left(id.count() - counter);
|
*baseId = id.left(id.size() - counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setupIdRenamingHash(const ModelNode &modelNode, QHash<QString, QString> &idRenamingHash, AbstractView *view)
|
static void setupIdRenamingHash(const ModelNode &modelNode, QHash<QString, QString> &idRenamingHash, AbstractView *view)
|
||||||
|
@@ -49,7 +49,7 @@ inline static QString doubleToString(const PropertyName &propertyName, double d)
|
|||||||
|
|
||||||
static QString unicodeEscape(const QString &stringValue)
|
static QString unicodeEscape(const QString &stringValue)
|
||||||
{
|
{
|
||||||
if (stringValue.count() == 1) {
|
if (stringValue.size() == 1) {
|
||||||
ushort code = stringValue.at(0).unicode();
|
ushort code = stringValue.at(0).unicode();
|
||||||
bool isUnicode = code <= 127;
|
bool isUnicode = code <= 127;
|
||||||
if (isUnicode) {
|
if (isUnicode) {
|
||||||
@@ -289,7 +289,7 @@ QString QmlTextGenerator::escape(const QString &value)
|
|||||||
{
|
{
|
||||||
QString result = value;
|
QString result = value;
|
||||||
|
|
||||||
if (value.count() == 6 && value.startsWith("\\u")) //Do not dobule escape unicode chars
|
if (value.size() == 6 && value.startsWith("\\u")) //Do not dobule escape unicode chars
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
result.replace(QStringLiteral("\\"), QStringLiteral("\\\\"));
|
result.replace(QStringLiteral("\\"), QStringLiteral("\\\\"));
|
||||||
|
@@ -65,7 +65,7 @@ static void splitIdInBaseNameAndNumber(const QString &id, QString *baseId, int *
|
|||||||
{
|
{
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
while (counter < id.count()) {
|
while (counter < id.size()) {
|
||||||
bool canConvertToInteger = false;
|
bool canConvertToInteger = false;
|
||||||
int newNumber = id.right(counter + 1).toInt(&canConvertToInteger);
|
int newNumber = id.right(counter + 1).toInt(&canConvertToInteger);
|
||||||
if (canConvertToInteger)
|
if (canConvertToInteger)
|
||||||
@@ -76,7 +76,7 @@ static void splitIdInBaseNameAndNumber(const QString &id, QString *baseId, int *
|
|||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
*baseId = id.left(id.count() - counter);
|
*baseId = id.left(id.size() - counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StylesheetMerger::syncNodeProperties(ModelNode &outputNode, const ModelNode &inputNode, bool skipDuplicates)
|
void StylesheetMerger::syncNodeProperties(ModelNode &outputNode, const ModelNode &inputNode, bool skipDuplicates)
|
||||||
|
@@ -165,7 +165,7 @@ bool isHexDigit(ushort c)
|
|||||||
|
|
||||||
QString fixEscapedUnicodeChar(const QString &value) //convert "\u2939"
|
QString fixEscapedUnicodeChar(const QString &value) //convert "\u2939"
|
||||||
{
|
{
|
||||||
if (value.count() == 6 && value.at(0) == QLatin1Char('\\') && value.at(1) == QLatin1Char('u') &&
|
if (value.size() == 6 && value.at(0) == QLatin1Char('\\') && value.at(1) == QLatin1Char('u') &&
|
||||||
isHexDigit(value.at(2).unicode()) && isHexDigit(value.at(3).unicode()) &&
|
isHexDigit(value.at(2).unicode()) && isHexDigit(value.at(3).unicode()) &&
|
||||||
isHexDigit(value.at(4).unicode()) && isHexDigit(value.at(5).unicode())) {
|
isHexDigit(value.at(4).unicode()) && isHexDigit(value.at(5).unicode())) {
|
||||||
return convertUnicode(value.at(2).unicode(), value.at(3).unicode(), value.at(4).unicode(), value.at(5).unicode());
|
return convertUnicode(value.at(2).unicode(), value.at(3).unicode(), value.at(4).unicode(), value.at(5).unicode());
|
||||||
@@ -655,7 +655,7 @@ public:
|
|||||||
{
|
{
|
||||||
QStringList astValueList = astValue.split(QStringLiteral("."));
|
QStringList astValueList = astValue.split(QStringLiteral("."));
|
||||||
|
|
||||||
if (astValueList.count() == 2) {
|
if (astValueList.size() == 2) {
|
||||||
//Check for global Qt enums
|
//Check for global Qt enums
|
||||||
if (astValueList.constFirst() == QStringLiteral("Qt")
|
if (astValueList.constFirst() == QStringLiteral("Qt")
|
||||||
&& globalQtEnums().contains(astValueList.constLast()))
|
&& globalQtEnums().contains(astValueList.constLast()))
|
||||||
|
@@ -2130,7 +2130,7 @@ static QStringList extractFieldsFromBuildString(const QByteArray &buildString)
|
|||||||
|
|
||||||
const QString endian = abiInfo.takeFirst();
|
const QString endian = abiInfo.takeFirst();
|
||||||
QTC_ASSERT(endian.endsWith("_endian"), return QStringList());
|
QTC_ASSERT(endian.endsWith("_endian"), return QStringList());
|
||||||
result.append(endian.left(endian.count() - 7)); // without the "_endian"
|
result.append(endian.left(endian.size() - 7)); // without the "_endian"
|
||||||
|
|
||||||
result.append(abiInfo.takeFirst()); // pointer
|
result.append(abiInfo.takeFirst()); // pointer
|
||||||
|
|
||||||
@@ -2160,7 +2160,7 @@ static QStringList extractFieldsFromBuildString(const QByteArray &buildString)
|
|||||||
static Abi refineAbiFromBuildString(const QByteArray &buildString, const Abi &probableAbi)
|
static Abi refineAbiFromBuildString(const QByteArray &buildString, const Abi &probableAbi)
|
||||||
{
|
{
|
||||||
QStringList buildStringData = extractFieldsFromBuildString(buildString);
|
QStringList buildStringData = extractFieldsFromBuildString(buildString);
|
||||||
if (buildStringData.count() != 9)
|
if (buildStringData.size() != 9)
|
||||||
return probableAbi;
|
return probableAbi;
|
||||||
|
|
||||||
const QString compiler = buildStringData.at(8);
|
const QString compiler = buildStringData.at(8);
|
||||||
|
@@ -189,7 +189,7 @@ SnippetParseResult Snippet::parse(const QString &snippet)
|
|||||||
if (!errorMessage.isEmpty())
|
if (!errorMessage.isEmpty())
|
||||||
return {SnippetParseError{errorMessage, {}, -1}};
|
return {SnippetParseError{errorMessage, {}, -1}};
|
||||||
|
|
||||||
const int count = preprocessedSnippet.count();
|
const int count = preprocessedSnippet.size();
|
||||||
NameMangler *mangler = nullptr;
|
NameMangler *mangler = nullptr;
|
||||||
|
|
||||||
QMap<QString, int> variableIndexes;
|
QMap<QString, int> variableIndexes;
|
||||||
@@ -404,7 +404,7 @@ void Internal::TextEditorPlugin::testSnippetParsing()
|
|||||||
QCOMPARE(manglerId, expected.manglerId);
|
QCOMPARE(manglerId, expected.manglerId);
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < parts.count(); ++i)
|
for (int i = 0; i < parts.size(); ++i)
|
||||||
rangesCompare(snippet.parts.at(i), parts.at(i));
|
rangesCompare(snippet.parts.at(i), parts.at(i));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -270,7 +270,7 @@ QVariantMap AddQtData::addQt(const QVariantMap &map) const
|
|||||||
for (QVariantMap::const_iterator i = map.begin(); i != map.end(); ++i) {
|
for (QVariantMap::const_iterator i = map.begin(); i != map.end(); ++i) {
|
||||||
if (!i.key().startsWith(QLatin1String(PREFIX)))
|
if (!i.key().startsWith(QLatin1String(PREFIX)))
|
||||||
continue;
|
continue;
|
||||||
QString number = i.key().mid(QString::fromLatin1(PREFIX).count());
|
QString number = i.key().mid(QString::fromLatin1(PREFIX).size());
|
||||||
bool ok;
|
bool ok;
|
||||||
int count = number.toInt(&ok);
|
int count = number.toInt(&ok);
|
||||||
if (ok && count >= versionCount)
|
if (ok && count >= versionCount)
|
||||||
|
Reference in New Issue
Block a user