forked from qt-creator/qt-creator
Utils: Simplify
bugprone-branch-clone readability-simplify-boolean-expr Change-Id: I75ad6118275ad9231f21b578567c3c042414263b Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -338,9 +338,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
|
|||||||
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
|
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
|
||||||
"Running %1 %2 ...\n")
|
"Running %1 %2 ...\n")
|
||||||
.arg(makeFullPath.toUserOutput(), arguments.makeArguments.join(QLatin1Char(' '))));
|
.arg(makeFullPath.toUserOutput(), arguments.makeArguments.join(QLatin1Char(' '))));
|
||||||
if (!runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120, false, log, errorMessage))
|
return runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120, false, log, errorMessage);
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuildableHelperLibrary::getHelperFileInfoFor(const QStringList &validBinaryFilenames,
|
bool BuildableHelperLibrary::getHelperFileInfoFor(const QStringList &validBinaryFilenames,
|
||||||
|
@@ -236,16 +236,12 @@ static int cleanupSemanticsScore(const QString &text1, const QString &text2)
|
|||||||
|
|
||||||
static bool isWhitespace(const QChar &c)
|
static bool isWhitespace(const QChar &c)
|
||||||
{
|
{
|
||||||
if (c == ' ' || c == '\t')
|
return c == ' ' || c == '\t';
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isNewLine(const QChar &c)
|
static bool isNewLine(const QChar &c)
|
||||||
{
|
{
|
||||||
if (c == '\n')
|
return c == '\n';
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -719,9 +715,7 @@ static bool diffWithWhitespaceExpandedInEqualities(const QList<Diff> &leftInput,
|
|||||||
return false;
|
return false;
|
||||||
*rightOutput = decodeExpandedWhitespace(rightDiffList,
|
*rightOutput = decodeExpandedWhitespace(rightDiffList,
|
||||||
commonRightCodeMap, &ok);
|
commonRightCodeMap, &ok);
|
||||||
if (!ok)
|
return ok;
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void appendWithEqualitiesSquashed(const QList<Diff> &leftInput,
|
static void appendWithEqualitiesSquashed(const QList<Diff> &leftInput,
|
||||||
|
@@ -225,17 +225,13 @@ bool JsonSchema::typeMatches(const QString &expected, const QString &actual)
|
|||||||
|
|
||||||
bool JsonSchema::isCheckableType(const QString &s)
|
bool JsonSchema::isCheckableType(const QString &s)
|
||||||
{
|
{
|
||||||
if (s == QLatin1String("string")
|
return s == QLatin1String("string")
|
||||||
|| s == QLatin1String("number")
|
|| s == QLatin1String("number")
|
||||||
|| s == QLatin1String("integer")
|
|| s == QLatin1String("integer")
|
||||||
|| s == QLatin1String("boolean")
|
|| s == QLatin1String("boolean")
|
||||||
|| s == QLatin1String("object")
|
|| s == QLatin1String("object")
|
||||||
|| s == QLatin1String("array")
|
|| s == QLatin1String("array")
|
||||||
|| s == QLatin1String("null")) {
|
|| s == QLatin1String("null");
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList JsonSchema::validTypes() const
|
QStringList JsonSchema::validTypes() const
|
||||||
|
@@ -102,22 +102,14 @@ QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const QString &title,
|
|||||||
}
|
}
|
||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT FileDeletedPromptAnswer
|
QTCREATOR_UTILS_EXPORT FileDeletedPromptAnswer
|
||||||
fileDeletedPrompt(const QString &fileName, bool triggerExternally, QWidget *parent)
|
fileDeletedPrompt(const QString &fileName, QWidget *parent)
|
||||||
{
|
{
|
||||||
const QString title = QCoreApplication::translate("Utils::fileDeletedPrompt",
|
const QString title = QCoreApplication::translate("Utils::fileDeletedPrompt",
|
||||||
"File Has Been Removed");
|
"File Has Been Removed");
|
||||||
QString msg;
|
QString msg = QCoreApplication::translate("Utils::fileDeletedPrompt",
|
||||||
if (triggerExternally) {
|
|
||||||
msg = QCoreApplication::translate("Utils::fileDeletedPrompt",
|
|
||||||
"The file %1 has been removed from disk. "
|
"The file %1 has been removed from disk. "
|
||||||
"Do you want to save it under a different name, or close "
|
"Do you want to save it under a different name, or close "
|
||||||
"the editor?").arg(QDir::toNativeSeparators(fileName));
|
"the editor?").arg(QDir::toNativeSeparators(fileName));
|
||||||
} else {
|
|
||||||
msg = QCoreApplication::translate("Utils::fileDeletedPrompt",
|
|
||||||
"The file %1 has been removed from disk. "
|
|
||||||
"Do you want to save it under a different name, or close "
|
|
||||||
"the editor?").arg(QDir::toNativeSeparators(fileName));
|
|
||||||
}
|
|
||||||
QMessageBox box(QMessageBox::Question, title, msg, QMessageBox::NoButton, parent);
|
QMessageBox box(QMessageBox::Question, title, msg, QMessageBox::NoButton, parent);
|
||||||
QPushButton *close =
|
QPushButton *close =
|
||||||
box.addButton(QCoreApplication::translate("Utils::fileDeletedPrompt", "&Close"),
|
box.addButton(QCoreApplication::translate("Utils::fileDeletedPrompt", "&Close"),
|
||||||
|
@@ -62,7 +62,6 @@ enum FileDeletedPromptAnswer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT FileDeletedPromptAnswer fileDeletedPrompt(const QString &fileName,
|
QTCREATOR_UTILS_EXPORT FileDeletedPromptAnswer fileDeletedPrompt(const QString &fileName,
|
||||||
bool triggerExternally,
|
|
||||||
QWidget *parent);
|
QWidget *parent);
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
@@ -1199,7 +1199,6 @@ void DocumentManager::checkForReload()
|
|||||||
if (previousDeletedAnswer != FileDeletedCloseAll) {
|
if (previousDeletedAnswer != FileDeletedCloseAll) {
|
||||||
previousDeletedAnswer =
|
previousDeletedAnswer =
|
||||||
fileDeletedPrompt(document->filePath().toString(),
|
fileDeletedPrompt(document->filePath().toString(),
|
||||||
trigger == IDocument::TriggerExternal,
|
|
||||||
ICore::dialogParent());
|
ICore::dialogParent());
|
||||||
}
|
}
|
||||||
switch (previousDeletedAnswer) {
|
switch (previousDeletedAnswer) {
|
||||||
|
Reference in New Issue
Block a user