forked from qt-creator/qt-creator
QbsProjectManager: Make project structure available faster.
So that users can navigate the project already while rule execution is going on. Change-Id: I88a6f0cf80bf208c418671e3b862e1defe8d86ab Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
@@ -431,6 +431,33 @@ bool QbsProject::needsSpecialDeployment() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QbsProject::handleProjectStructureAvailable()
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_qbsProjectParser, return);
|
||||||
|
|
||||||
|
bool dataChanged = false;
|
||||||
|
m_qbsProject = m_qbsProjectParser->qbsProject();
|
||||||
|
const qbs::ProjectData &projectData = m_qbsProject.projectData();
|
||||||
|
QTC_CHECK(m_qbsProject.isValid());
|
||||||
|
|
||||||
|
if (projectData != m_projectData) {
|
||||||
|
m_projectData = projectData;
|
||||||
|
rootProjectNode()->update();
|
||||||
|
updateDocuments(m_qbsProject.isValid()
|
||||||
|
? m_qbsProject.buildSystemFiles() : QSet<QString>() << projectFilePath().toString());
|
||||||
|
dataChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataChanged) {
|
||||||
|
auto * const futureInterface = m_qbsUpdateFutureInterface;
|
||||||
|
m_qbsUpdateFutureInterface = nullptr; // So that isParsing() returns false;
|
||||||
|
updateCppCodeModel();
|
||||||
|
updateQmlJsCodeModel();
|
||||||
|
emit fileListChanged();
|
||||||
|
m_qbsUpdateFutureInterface = futureInterface;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QbsProject::handleQbsParsingDone(bool success)
|
void QbsProject::handleQbsParsingDone(bool success)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_qbsProjectParser, return);
|
QTC_ASSERT(m_qbsProjectParser, return);
|
||||||
@@ -448,20 +475,9 @@ void QbsProject::handleQbsParsingDone(bool success)
|
|||||||
|
|
||||||
generateErrors(m_qbsProjectParser->error());
|
generateErrors(m_qbsProjectParser->error());
|
||||||
|
|
||||||
bool dataChanged = false;
|
|
||||||
if (success) {
|
if (success) {
|
||||||
m_qbsProject = m_qbsProjectParser->qbsProject();
|
QTC_ASSERT(m_qbsProject.isValid(), return);
|
||||||
const qbs::ProjectData &projectData = m_qbsProject.projectData();
|
m_projectData = m_qbsProject.projectData();
|
||||||
QTC_CHECK(m_qbsProject.isValid());
|
|
||||||
|
|
||||||
if (projectData != m_projectData) {
|
|
||||||
m_projectData = projectData;
|
|
||||||
rootProjectNode()->update();
|
|
||||||
|
|
||||||
updateDocuments(m_qbsProject.isValid()
|
|
||||||
? m_qbsProject.buildSystemFiles() : QSet<QString>() << projectFilePath().toString());
|
|
||||||
dataChanged = true;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
m_qbsUpdateFutureInterface->reportCanceled();
|
m_qbsUpdateFutureInterface->reportCanceled();
|
||||||
}
|
}
|
||||||
@@ -475,13 +491,8 @@ void QbsProject::handleQbsParsingDone(bool success)
|
|||||||
m_qbsUpdateFutureInterface = 0;
|
m_qbsUpdateFutureInterface = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataChanged) { // Do this now when isParsing() is false!
|
if (success)
|
||||||
updateCppCodeModel();
|
|
||||||
updateQmlJsCodeModel();
|
|
||||||
updateBuildTargetData();
|
updateBuildTargetData();
|
||||||
|
|
||||||
emit fileListChanged();
|
|
||||||
}
|
|
||||||
emit projectParsingDone(success);
|
emit projectParsingDone(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,8 +604,11 @@ void QbsProject::registerQbsProjectParser(QbsProjectParser *p)
|
|||||||
|
|
||||||
m_qbsProjectParser = p;
|
m_qbsProjectParser = p;
|
||||||
|
|
||||||
if (p)
|
if (p) {
|
||||||
|
connect(m_qbsProjectParser, &QbsProjectParser::projectStructureAvailable,
|
||||||
|
this, &QbsProject::handleProjectStructureAvailable);
|
||||||
connect(m_qbsProjectParser, SIGNAL(done(bool)), this, SLOT(handleQbsParsingDone(bool)));
|
connect(m_qbsProjectParser, SIGNAL(done(bool)), this, SLOT(handleQbsParsingDone(bool)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Project::RestoreResult QbsProject::fromMap(const QVariantMap &map, QString *errorMessage)
|
Project::RestoreResult QbsProject::fromMap(const QVariantMap &map, QString *errorMessage)
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ private:
|
|||||||
void updateApplicationTargets();
|
void updateApplicationTargets();
|
||||||
void updateDeploymentInfo();
|
void updateDeploymentInfo();
|
||||||
void updateBuildTargetData();
|
void updateBuildTargetData();
|
||||||
|
void handleProjectStructureAvailable();
|
||||||
void projectLoaded() override;
|
void projectLoaded() override;
|
||||||
|
|
||||||
static bool ensureWriteableQbsFile(const QString &file);
|
static bool ensureWriteableQbsFile(const QString &file);
|
||||||
|
|||||||
@@ -143,10 +143,12 @@ void QbsProjectParser::handleQbsParsingDone(bool success)
|
|||||||
// Do not report the operation as canceled here, as we might want to make overlapping
|
// Do not report the operation as canceled here, as we might want to make overlapping
|
||||||
// parses appear atomic to the user.
|
// parses appear atomic to the user.
|
||||||
|
|
||||||
if (!success)
|
if (!success) {
|
||||||
emit done(false);
|
emit done(false);
|
||||||
else
|
} else {
|
||||||
|
emit projectStructureAvailable();
|
||||||
startRuleExecution();
|
startRuleExecution();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QbsProjectParser::startRuleExecution()
|
void QbsProjectParser::startRuleExecution()
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void done(bool success);
|
void done(bool success);
|
||||||
|
void projectStructureAvailable();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleQbsParsingDone(bool success);
|
void handleQbsParsingDone(bool success);
|
||||||
|
|||||||
Reference in New Issue
Block a user