forked from qt-creator/qt-creator
Observe the cration of extra compiler
We link into the extra compiler factory and notify the PchManager for every extra compiler creation. It enables to monitor if all extra compiler finished. Change-Id: If8da386c88909abd2e0e651e4336865c9dc5bf34 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -52,7 +52,7 @@ namespace ProjectExplorer {
|
||||
|
||||
Q_GLOBAL_STATIC(QThreadPool, s_extraCompilerThreadPool);
|
||||
Q_GLOBAL_STATIC(QList<ExtraCompilerFactory *>, factories);
|
||||
|
||||
Q_GLOBAL_STATIC(QVector<ExtraCompilerFactoryObserver *>, observers);
|
||||
class ExtraCompilerPrivate
|
||||
{
|
||||
public:
|
||||
@@ -310,7 +310,8 @@ void ExtraCompiler::setContent(const Utils::FileName &file, const QByteArray &co
|
||||
}
|
||||
}
|
||||
|
||||
ExtraCompilerFactory::ExtraCompilerFactory(QObject *parent) : QObject(parent)
|
||||
ExtraCompilerFactory::ExtraCompilerFactory(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
factories->append(this);
|
||||
}
|
||||
@@ -320,6 +321,14 @@ ExtraCompilerFactory::~ExtraCompilerFactory()
|
||||
factories->removeAll(this);
|
||||
}
|
||||
|
||||
void ExtraCompilerFactory::annouceCreation(const Project *project,
|
||||
const Utils::FileName &source,
|
||||
const Utils::FileNameList &targets)
|
||||
{
|
||||
for (ExtraCompilerFactoryObserver *observer : *observers)
|
||||
observer->newExtraCompiler(project, source, targets);
|
||||
}
|
||||
|
||||
QList<ExtraCompilerFactory *> ExtraCompilerFactory::extraCompilerFactories()
|
||||
{
|
||||
return *factories();
|
||||
@@ -455,4 +464,14 @@ void ProcessExtraCompiler::cleanUp()
|
||||
setCompileTime(QDateTime::currentDateTime());
|
||||
}
|
||||
|
||||
ExtraCompilerFactoryObserver::ExtraCompilerFactoryObserver()
|
||||
{
|
||||
observers->push_back(this);
|
||||
}
|
||||
|
||||
ExtraCompilerFactoryObserver::~ExtraCompilerFactoryObserver()
|
||||
{
|
||||
observers->removeOne(this);
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
Reference in New Issue
Block a user