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",
|
||||
"Running %1 %2 ...\n")
|
||||
.arg(makeFullPath.toUserOutput(), arguments.makeArguments.join(QLatin1Char(' '))));
|
||||
if (!runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120, false, log, errorMessage))
|
||||
return false;
|
||||
return true;
|
||||
return runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120, false, log, errorMessage);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (c == ' ' || c == '\t')
|
||||
return true;
|
||||
return false;
|
||||
return c == ' ' || c == '\t';
|
||||
}
|
||||
|
||||
static bool isNewLine(const QChar &c)
|
||||
{
|
||||
if (c == '\n')
|
||||
return true;
|
||||
return false;
|
||||
return c == '\n';
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -719,9 +715,7 @@ static bool diffWithWhitespaceExpandedInEqualities(const QList<Diff> &leftInput,
|
||||
return false;
|
||||
*rightOutput = decodeExpandedWhitespace(rightDiffList,
|
||||
commonRightCodeMap, &ok);
|
||||
if (!ok)
|
||||
return false;
|
||||
return true;
|
||||
return ok;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (s == QLatin1String("string")
|
||||
|| s == QLatin1String("number")
|
||||
|| s == QLatin1String("integer")
|
||||
|| s == QLatin1String("boolean")
|
||||
|| s == QLatin1String("object")
|
||||
|| s == QLatin1String("array")
|
||||
|| s == QLatin1String("null")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return s == QLatin1String("string")
|
||||
|| s == QLatin1String("number")
|
||||
|| s == QLatin1String("integer")
|
||||
|| s == QLatin1String("boolean")
|
||||
|| s == QLatin1String("object")
|
||||
|| s == QLatin1String("array")
|
||||
|| s == QLatin1String("null");
|
||||
}
|
||||
|
||||
QStringList JsonSchema::validTypes() const
|
||||
|
@@ -102,22 +102,14 @@ QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const QString &title,
|
||||
}
|
||||
|
||||
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",
|
||||
"File Has Been Removed");
|
||||
QString msg;
|
||||
if (triggerExternally) {
|
||||
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));
|
||||
} 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));
|
||||
}
|
||||
QString 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);
|
||||
QPushButton *close =
|
||||
box.addButton(QCoreApplication::translate("Utils::fileDeletedPrompt", "&Close"),
|
||||
|
@@ -62,7 +62,6 @@ enum FileDeletedPromptAnswer {
|
||||
};
|
||||
|
||||
QTCREATOR_UTILS_EXPORT FileDeletedPromptAnswer fileDeletedPrompt(const QString &fileName,
|
||||
bool triggerExternally,
|
||||
QWidget *parent);
|
||||
|
||||
} // namespace Utils
|
||||
|
@@ -1199,7 +1199,6 @@ void DocumentManager::checkForReload()
|
||||
if (previousDeletedAnswer != FileDeletedCloseAll) {
|
||||
previousDeletedAnswer =
|
||||
fileDeletedPrompt(document->filePath().toString(),
|
||||
trigger == IDocument::TriggerExternal,
|
||||
ICore::dialogParent());
|
||||
}
|
||||
switch (previousDeletedAnswer) {
|
||||
|
Reference in New Issue
Block a user