ProjectExplorer: Simplify

bugprone-branch-clone
readability-simplify-boolean-expr

Change-Id: Iaaac21e96a3e9db6b9819d77fdae623ede373e59
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Nikolai Kosjar
2019-10-31 16:29:42 +01:00
parent c81e9a2406
commit 6c1b11dd3e
7 changed files with 5 additions and 20 deletions

View File

@@ -209,7 +209,6 @@ static Abi macAbiForCpu(quint32 type) {
case 0x01000000 + 7: // CPU_TYPE_X86_64
return Abi(Abi::X86Architecture, Abi::DarwinOS, Abi::GenericFlavor, Abi::MachOFormat, 64);
case 18: // CPU_TYPE_POWERPC
return Abi(Abi::PowerPCArchitecture, Abi::DarwinOS, Abi::GenericFlavor, Abi::MachOFormat, 32);
case 0x01000000 + 18: // CPU_TYPE_POWERPC64
return Abi(Abi::PowerPCArchitecture, Abi::DarwinOS, Abi::GenericFlavor, Abi::MachOFormat, 32);
case 12: // CPU_TYPE_ARM
@@ -515,9 +514,7 @@ Abi Abi::abiFromTargetTriplet(const QString &triple)
if (flavor == UnknownFlavor)
flavor = GenericFlavor;
format = ElfFormat;
} else if (p == "android") {
flavor = AndroidLinuxFlavor;
} else if (p == "androideabi") {
} else if (p == "android" || p == "androideabi") {
flavor = AndroidLinuxFlavor;
} else if (p.startsWith("freebsd")) {
os = BsdOS;

View File

@@ -1339,9 +1339,7 @@ void GccToolChainConfigWidget::handleCompilerCommandChange()
// Find a good ABI for the new compiler:
Abi newAbi;
if (customAbi)
newAbi = currentAbi;
else if (abiList.contains(currentAbi))
if (customAbi || abiList.contains(currentAbi))
newAbi = currentAbi;
m_abiWidget->setAbis(abiList, newAbi);

View File

@@ -977,9 +977,7 @@ bool ListField::validate(MacroExpander *expander, QString *message)
return false;
updateIndex();
if (selectionModel()->hasSelection())
return true;
return false;
return selectionModel()->hasSelection();
}
void ListField::initializeData(MacroExpander *expander)

View File

@@ -2791,9 +2791,7 @@ bool ProjectExplorerPlugin::coreAboutToClose()
if (box.clickedButton() != closeAnyway)
return false;
}
if (!dd->m_outputPane.aboutToClose())
return false;
return true;
return dd->m_outputPane.aboutToClose();
}
static bool hasDeploySettings(Project *pro)

View File

@@ -376,10 +376,7 @@ Node *ProjectTreeWidget::nodeForFile(const FilePath &fileName)
if (ProjectNode *projectNode = project->rootProjectNode()) {
projectNode->forEachGenericNode([&](Node *node) {
if (node->filePath() == fileName) {
if (!bestNode) {
bestNode = node;
bestNodeExpandCount = ProjectTreeWidget::expandedCount(node);
} else if (priority(node) < priority(bestNode)) {
if (!bestNode || priority(node) < priority(bestNode)) {
bestNode = node;
bestNodeExpandCount = ProjectTreeWidget::expandedCount(node);
} else if (priority(node) == priority(bestNode)) {

View File

@@ -82,7 +82,6 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const
case Qt::DisplayRole:
return data.second;
case Qt::ToolTipRole:
return data.first;
case FilePathRole:
return data.first;
case PrettyFilePathRole:

View File

@@ -213,8 +213,6 @@ public:
{
switch (role) {
case Qt::DisplayRole:
return m_project->displayName();
case ProjectDisplayNameRole:
return m_project->displayName();