OSDN Git Service

Gcc: Cause less update signals to be sent
authorTobias Hunger <tobias.hunger@nokia.com>
Thu, 14 Apr 2011 12:51:28 +0000 (14:51 +0200)
committerTobias Hunger <tobias.hunger@nokia.com>
Thu, 14 Apr 2011 12:57:53 +0000 (14:57 +0200)
Cause less update signals to be sent when changing the compiler path.

src/plugins/projectexplorer/gcctoolchain.cpp

index a018347..9417b3c 100644 (file)
@@ -386,18 +386,24 @@ void GccToolChain::setCompilerPath(const QString &path)
     if (path == m_compilerPath)
         return;
 
-    if (displayName() == defaultDisplayName())
-        setDisplayName(typeName());
+    bool resetDisplayName = displayName() == defaultDisplayName();
+
     m_compilerPath = path;
     m_supportedAbis.clear();
 
+    Abi currentAbi = m_targetAbi;
+
     m_targetAbi = Abi();
     if (!m_compilerPath.isEmpty()) {
         updateSupportedAbis();
-        if (!m_supportedAbis.isEmpty())
-            m_targetAbi = m_supportedAbis.at(0);
+        if (!m_supportedAbis.isEmpty()) {
+            if (m_supportedAbis.contains(currentAbi))
+                m_targetAbi = currentAbi;
+            else
+                m_targetAbi = m_supportedAbis.at(0);
+        }
 
-        if (displayName() == typeName())
+        if (resetDisplayName)
             setDisplayName(defaultDisplayName());
     }
     updateId(); // Will trigger toolChainUpdated()!