summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2019-10-31 16:29:42 +0100
committerNikolai Kosjar <nikolai.kosjar@qt.io>2019-11-01 09:31:32 +0000
commit6c1b11dd3e45e3fe3946ce0cc97914d44af1709b (patch)
tree82d12e218d570a9391bfadb8b1f131cd578551fa
parentc81e9a240669cd215caec539737014fce1eef8cf (diff)
downloadqt-creator-6c1b11dd3e45e3fe3946ce0cc97914d44af1709b.tar.gz
ProjectExplorer: Simplify
bugprone-branch-clone readability-simplify-boolean-expr Change-Id: Iaaac21e96a3e9db6b9819d77fdae623ede373e59 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--src/plugins/projectexplorer/abi.cpp5
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.cpp4
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp4
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp4
-rw-r--r--src/plugins/projectexplorer/projecttreewidget.cpp5
-rw-r--r--src/plugins/projectexplorer/projectwelcomepage.cpp1
-rw-r--r--src/plugins/projectexplorer/projectwindow.cpp2
7 files changed, 5 insertions, 20 deletions
diff --git a/src/plugins/projectexplorer/abi.cpp b/src/plugins/projectexplorer/abi.cpp
index 420a10ba98..42a34bbcdc 100644
--- a/src/plugins/projectexplorer/abi.cpp
+++ b/src/plugins/projectexplorer/abi.cpp
@@ -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;
diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index 8966177ec8..c5fb985707 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -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);
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp
index 956b5f2109..dbae037260 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp
@@ -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)
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 0880e3c3e5..30fdbcc58a 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -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)
diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp
index f18b21a9be..14e6feca16 100644
--- a/src/plugins/projectexplorer/projecttreewidget.cpp
+++ b/src/plugins/projectexplorer/projecttreewidget.cpp
@@ -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)) {
diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp
index 0f2bfb4dc3..8d74b3f648 100644
--- a/src/plugins/projectexplorer/projectwelcomepage.cpp
+++ b/src/plugins/projectexplorer/projectwelcomepage.cpp
@@ -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:
diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp
index 96cfc251d3..dfa20793e3 100644
--- a/src/plugins/projectexplorer/projectwindow.cpp
+++ b/src/plugins/projectexplorer/projectwindow.cpp
@@ -213,8 +213,6 @@ public:
{
switch (role) {
case Qt::DisplayRole:
- return m_project->displayName();
-
case ProjectDisplayNameRole:
return m_project->displayName();