forked from qt-creator/qt-creator
Add toolChainUpdated signal
Add toolChainUpdated(ToolChain *) to ToolChainManager and make sure it is triggered in the right places. Reviewed-by: dt
This commit is contained in:
@@ -302,9 +302,14 @@ Abi GccToolChain::targetAbi() const
|
||||
|
||||
void GccToolChain::setTargetAbi(const Abi &abi)
|
||||
{
|
||||
if (abi == m_targetAbi)
|
||||
return;
|
||||
|
||||
updateSupportedAbis();
|
||||
if (m_supportedAbis.contains(abi))
|
||||
if (m_supportedAbis.contains(abi)) {
|
||||
m_targetAbi = abi;
|
||||
toolChainUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
QList<Abi> GccToolChain::supportedAbis() const
|
||||
@@ -348,7 +353,10 @@ void GccToolChain::addToEnvironment(Utils::Environment &env) const
|
||||
|
||||
void GccToolChain::setDebuggerCommand(const QString &d)
|
||||
{
|
||||
if (m_debuggerCommand == d)
|
||||
return;
|
||||
m_debuggerCommand = d;
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
QString GccToolChain::debuggerCommand() const
|
||||
@@ -385,7 +393,7 @@ void GccToolChain::setCompilerPath(const QString &path)
|
||||
if (displayName() == typeName())
|
||||
setDisplayName(defaultDisplayName());
|
||||
}
|
||||
updateId();
|
||||
updateId(); // Will trigger toolChainUpdated()!
|
||||
}
|
||||
|
||||
QString GccToolChain::compilerPath() const
|
||||
|
@@ -435,7 +435,10 @@ QString MsvcToolChain::makeCommand() const
|
||||
|
||||
void MsvcToolChain::setDebuggerCommand(const QString &d)
|
||||
{
|
||||
if (m_debuggerCommand == d)
|
||||
return;
|
||||
m_debuggerCommand = d;
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
QString MsvcToolChain::debuggerCommand() const
|
||||
|
@@ -32,6 +32,9 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "toolchain.h"
|
||||
|
||||
#include "toolchainmanager.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
@@ -90,9 +93,13 @@ QString ToolChain::displayName() const
|
||||
return m_d->m_displayName;
|
||||
}
|
||||
|
||||
void ToolChain::setDisplayName(const QString &name) const
|
||||
void ToolChain::setDisplayName(const QString &name)
|
||||
{
|
||||
if (m_d->m_displayName == name)
|
||||
return;
|
||||
|
||||
m_d->m_displayName = name;
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
bool ToolChain::isAutoDetected() const
|
||||
@@ -143,12 +150,24 @@ QVariantMap ToolChain::toMap() const
|
||||
void ToolChain::setId(const QString &id)
|
||||
{
|
||||
Q_ASSERT(!id.isEmpty());
|
||||
if (m_d->m_id == id)
|
||||
return;
|
||||
|
||||
m_d->m_id = id;
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
void ToolChain::toolChainUpdated()
|
||||
{
|
||||
ToolChainManager::instance()->notifyAboutUpdate(this);
|
||||
}
|
||||
|
||||
void ToolChain::setAutoDetected(bool autodetect)
|
||||
{
|
||||
if (m_d->m_autodetect == autodetect)
|
||||
return;
|
||||
m_d->m_autodetect = autodetect;
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
bool ToolChain::fromMap(const QVariantMap &data)
|
||||
|
@@ -67,7 +67,7 @@ public:
|
||||
virtual ~ToolChain();
|
||||
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &name) const;
|
||||
void setDisplayName(const QString &name);
|
||||
|
||||
bool isAutoDetected() const;
|
||||
QString id() const;
|
||||
@@ -106,6 +106,8 @@ protected:
|
||||
|
||||
void setId(const QString &id);
|
||||
|
||||
void toolChainUpdated();
|
||||
|
||||
// Make sure to call this method when deriving!
|
||||
virtual bool fromMap(const QVariantMap &data);
|
||||
|
||||
|
@@ -207,6 +207,13 @@ ToolChain *ToolChainManager::findToolChain(const QString &id) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ToolChainManager::notifyAboutUpdate(ProjectExplorer::ToolChain *tc)
|
||||
{
|
||||
if (!tc || !m_d->m_toolChains.contains(tc))
|
||||
return;
|
||||
emit toolChainUpdated(tc);
|
||||
}
|
||||
|
||||
void ToolChainManager::registerToolChain(ToolChain *tc)
|
||||
{
|
||||
if (!tc || m_d->m_toolChains.contains(tc))
|
||||
|
@@ -78,6 +78,8 @@ signals:
|
||||
void toolChainAdded(ProjectExplorer::ToolChain *);
|
||||
// Tool chain is still valid when this call happens!
|
||||
void toolChainRemoved(ProjectExplorer::ToolChain *);
|
||||
// Tool chain was updated.
|
||||
void toolChainUpdated(ProjectExplorer::ToolChain *);
|
||||
|
||||
private:
|
||||
explicit ToolChainManager(QObject *parent = 0);
|
||||
@@ -87,12 +89,15 @@ private:
|
||||
void restoreToolChains();
|
||||
void restoreToolChains(const QString &fileName, bool autoDetected = false);
|
||||
|
||||
void notifyAboutUpdate(ProjectExplorer::ToolChain *);
|
||||
|
||||
|
||||
Internal::ToolChainManagerPrivate *const m_d;
|
||||
|
||||
static ToolChainManager *m_instance;
|
||||
|
||||
friend class ProjectExplorerPlugin;
|
||||
friend class ToolChain;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -171,7 +171,7 @@ void MaemoToolChain::setQtVersionId(int id)
|
||||
if (id < 0) {
|
||||
m_targetAbi = ProjectExplorer::Abi();
|
||||
m_qtVersionId = -1;
|
||||
updateId();
|
||||
updateId(); // Will trigger toolChainUpdated()!
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ void MaemoToolChain::setQtVersionId(int id)
|
||||
Q_ASSERT(version->qtAbis().count() == 1);
|
||||
m_targetAbi = version->qtAbis().at(0);
|
||||
|
||||
updateId();
|
||||
updateId(); // Will trigger toolChainUpdated()!
|
||||
setDisplayName(MaemoToolChainFactory::tr("Maemo GCC for %1").arg(version->displayName()));
|
||||
}
|
||||
|
||||
|
@@ -248,7 +248,10 @@ bool RvctToolChain::operator ==(const ToolChain &other) const
|
||||
|
||||
void RvctToolChain::setEnvironmentChanges(const QList<Utils::EnvironmentItem> &changes)
|
||||
{
|
||||
if (m_environmentChanges == changes)
|
||||
return;
|
||||
m_environmentChanges = changes;
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
QList<Utils::EnvironmentItem> RvctToolChain::environmentChanges() const
|
||||
@@ -263,7 +266,7 @@ void RvctToolChain::setCompilerPath(const QString &path)
|
||||
|
||||
m_compilerPath = path;
|
||||
m_version.reset();
|
||||
updateId();
|
||||
updateId(); // Will trigger toolChainUpdated()!
|
||||
}
|
||||
|
||||
QString RvctToolChain::compilerPath() const
|
||||
@@ -273,7 +276,10 @@ QString RvctToolChain::compilerPath() const
|
||||
|
||||
void RvctToolChain::setDebuggerCommand(const QString &d)
|
||||
{
|
||||
if (m_debuggerCommand == d)
|
||||
return;
|
||||
m_debuggerCommand = d;
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
QString RvctToolChain::debuggerCommand() const
|
||||
@@ -283,7 +289,10 @@ QString RvctToolChain::debuggerCommand() const
|
||||
|
||||
void RvctToolChain::setArmVersion(RvctToolChain::ArmVersion av)
|
||||
{
|
||||
if (m_armVersion == av)
|
||||
return;
|
||||
m_armVersion = av;
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
RvctToolChain::ArmVersion RvctToolChain::armVersion() const
|
||||
@@ -293,7 +302,10 @@ RvctToolChain::ArmVersion RvctToolChain::armVersion() const
|
||||
|
||||
void RvctToolChain::setVersion(const RvctVersion &v) const
|
||||
{
|
||||
if (m_version == v)
|
||||
return;
|
||||
m_version = v;
|
||||
// Internal use only! No need to call toolChainUpdated()!
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChainConfigWidget *RvctToolChain::configurationWidget()
|
||||
|
@@ -66,6 +66,13 @@ public:
|
||||
bool isNull() { return majorVersion == 0 && minorVersion == 0 && build == 0; }
|
||||
void reset() { majorVersion = 0; minorVersion = 0; build = 0; }
|
||||
|
||||
bool operator ==(const RvctVersion &other) const
|
||||
{
|
||||
return majorVersion == other.majorVersion
|
||||
&& minorVersion == other.minorVersion
|
||||
&& build == other.build;
|
||||
}
|
||||
|
||||
int majorVersion;
|
||||
int minorVersion;
|
||||
int build;
|
||||
@@ -101,8 +108,6 @@ public:
|
||||
void setArmVersion(ArmVersion);
|
||||
ArmVersion armVersion() const;
|
||||
|
||||
void setVersion(const RvctVersion &v) const;
|
||||
|
||||
ProjectExplorer::ToolChainConfigWidget *configurationWidget();
|
||||
ProjectExplorer::ToolChain *clone() const;
|
||||
|
||||
@@ -111,6 +116,7 @@ public:
|
||||
|
||||
private:
|
||||
void updateId();
|
||||
void setVersion(const RvctVersion &v) const;
|
||||
|
||||
explicit RvctToolChain(bool autodetected = false);
|
||||
RvctToolChain(const RvctToolChain &);
|
||||
|
@@ -250,7 +250,10 @@ bool WinscwToolChain::fromMap(const QVariantMap &data)
|
||||
|
||||
void WinscwToolChain::setSystemIncludePathes(const QStringList &pathes)
|
||||
{
|
||||
if (m_systemIncludePathes == pathes)
|
||||
return;
|
||||
m_systemIncludePathes = pathes;
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
QStringList WinscwToolChain::systemIncludePathes() const
|
||||
@@ -260,7 +263,10 @@ QStringList WinscwToolChain::systemIncludePathes() const
|
||||
|
||||
void WinscwToolChain::setSystemLibraryPathes(const QStringList &pathes)
|
||||
{
|
||||
if (m_systemLibraryPathes == pathes)
|
||||
return;
|
||||
m_systemLibraryPathes = pathes;
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
QStringList WinscwToolChain::systemLibraryPathes() const
|
||||
@@ -274,7 +280,7 @@ void WinscwToolChain::setCompilerPath(const QString &path)
|
||||
return;
|
||||
|
||||
m_compilerPath = path;
|
||||
updateId();
|
||||
updateId(); // Will trigger topolChainUpdated()!
|
||||
}
|
||||
|
||||
QString WinscwToolChain::compilerPath() const
|
||||
|
Reference in New Issue
Block a user