forked from qt-creator/qt-creator
QmakeAndroidSupport: Access parseInProgress and validParse
... via base project node functionality. Change-Id: Ifd9c5b149e11c1d104abed200881fdfe93749144 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -85,21 +85,27 @@ QVariant AndroidExtraLibraryListModel::data(const QModelIndex &index, int role)
|
|||||||
|
|
||||||
void AndroidExtraLibraryListModel::updateModel()
|
void AndroidExtraLibraryListModel::updateModel()
|
||||||
{
|
{
|
||||||
|
RunConfiguration *rc = m_target->activeRunConfiguration();
|
||||||
|
QTC_ASSERT(rc, return);
|
||||||
|
|
||||||
|
const ProjectNode *node = m_target->project()->findNodeForBuildKey(rc->buildKey());
|
||||||
|
QTC_ASSERT(node, return);
|
||||||
|
|
||||||
AndroidQtSupport *qtSupport = Android::AndroidManager::androidQtSupport(m_target);
|
AndroidQtSupport *qtSupport = Android::AndroidManager::androidQtSupport(m_target);
|
||||||
QTC_ASSERT(qtSupport, return);
|
QTC_ASSERT(qtSupport, return);
|
||||||
|
|
||||||
if (qtSupport->parseInProgress(m_target)) {
|
if (node->parseInProgress()) {
|
||||||
emit enabledChanged(false);
|
emit enabledChanged(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enabled;
|
bool enabled;
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
if (qtSupport->validParse(m_target)) {
|
if (node->validParse()) {
|
||||||
m_entries = qtSupport->targetData(Constants::AndroidExtraLibs, m_target).toStringList();
|
m_entries = qtSupport->targetData(Constants::AndroidExtraLibs, m_target).toStringList();
|
||||||
enabled = true;
|
enabled = true;
|
||||||
} else {
|
} else {
|
||||||
// parsing error or not a application template
|
// parsing error
|
||||||
m_entries.clear();
|
m_entries.clear();
|
||||||
enabled = false;
|
enabled = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ public:
|
|||||||
virtual bool setTargetData(Core::Id role, const QVariant &value,
|
virtual bool setTargetData(Core::Id role, const QVariant &value,
|
||||||
const ProjectExplorer::Target *target) const = 0;
|
const ProjectExplorer::Target *target) const = 0;
|
||||||
|
|
||||||
virtual bool parseInProgress(const ProjectExplorer::Target *target) const = 0;
|
|
||||||
virtual bool validParse(const ProjectExplorer::Target *target) const = 0;
|
|
||||||
virtual bool extraLibraryEnabled(const ProjectExplorer::Target *target) const = 0;
|
virtual bool extraLibraryEnabled(const ProjectExplorer::Target *target) const = 0;
|
||||||
|
|
||||||
virtual void addFiles(const ProjectExplorer::Target *target, const QString &buildKey,
|
virtual void addFiles(const ProjectExplorer::Target *target, const QString &buildKey,
|
||||||
|
|||||||
@@ -342,6 +342,8 @@ public:
|
|||||||
const ProjectNode *asProjectNode() const final { return this; }
|
const ProjectNode *asProjectNode() const final { return this; }
|
||||||
|
|
||||||
virtual QStringList targetApplications() const { return {}; }
|
virtual QStringList targetApplications() const { return {}; }
|
||||||
|
virtual bool parseInProgress() const { return false; }
|
||||||
|
virtual bool validParse() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit ProjectNode(const Utils::FileName &projectFilePath, const QByteArray &id = {});
|
explicit ProjectNode(const Utils::FileName &projectFilePath, const QByteArray &id = {});
|
||||||
|
|||||||
@@ -87,18 +87,6 @@ static QmakeProFile *applicationProFile(const Target *target)
|
|||||||
return project->rootProFile()->findProFile(FileName::fromString(rc->buildKey()));
|
return project->rootProFile()->findProFile(FileName::fromString(rc->buildKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmakeAndroidSupport::parseInProgress(const Target *target) const
|
|
||||||
{
|
|
||||||
QmakeProjectManager::QmakeProFile *pro = applicationProFile(target);
|
|
||||||
return !pro || pro->parseInProgress();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QmakeAndroidSupport::validParse(const Target *target) const
|
|
||||||
{
|
|
||||||
QmakeProjectManager::QmakeProFile *pro = applicationProFile(target);
|
|
||||||
return pro->validParse() && pro->projectType() == ProjectType::ApplicationTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QmakeAndroidSupport::extraLibraryEnabled(const Target *target) const
|
bool QmakeAndroidSupport::extraLibraryEnabled(const Target *target) const
|
||||||
{
|
{
|
||||||
QmakeProFile *pro = applicationProFile(target);
|
QmakeProFile *pro = applicationProFile(target);
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ public:
|
|||||||
bool setTargetData(Core::Id role, const QVariant &value,
|
bool setTargetData(Core::Id role, const QVariant &value,
|
||||||
const ProjectExplorer::Target *target) const override;
|
const ProjectExplorer::Target *target) const override;
|
||||||
|
|
||||||
bool parseInProgress(const ProjectExplorer::Target *target) const override;
|
|
||||||
bool validParse(const ProjectExplorer::Target *target) const override;
|
|
||||||
bool extraLibraryEnabled(const ProjectExplorer::Target *target) const override;
|
bool extraLibraryEnabled(const ProjectExplorer::Target *target) const override;
|
||||||
|
|
||||||
void addFiles(const ProjectExplorer::Target *target, const QString &buildKey,
|
void addFiles(const ProjectExplorer::Target *target, const QString &buildKey,
|
||||||
|
|||||||
@@ -216,6 +216,18 @@ QString QmakeProFileNode::buildKey() const
|
|||||||
return filePath().toString();
|
return filePath().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QmakeProFileNode::parseInProgress() const
|
||||||
|
{
|
||||||
|
QmakeProjectManager::QmakeProFile *pro = proFile();
|
||||||
|
return !pro || pro->parseInProgress();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QmakeProFileNode::validParse() const
|
||||||
|
{
|
||||||
|
QmakeProjectManager::QmakeProFile *pro = proFile();
|
||||||
|
return pro && pro->validParse();
|
||||||
|
}
|
||||||
|
|
||||||
QStringList QmakeProFileNode::targetApplications() const
|
QStringList QmakeProFileNode::targetApplications() const
|
||||||
{
|
{
|
||||||
QStringList apps;
|
QStringList apps;
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ public:
|
|||||||
bool showInSimpleTree() const override;
|
bool showInSimpleTree() const override;
|
||||||
|
|
||||||
QString buildKey() const override;
|
QString buildKey() const override;
|
||||||
|
bool parseInProgress() const override;
|
||||||
|
bool validParse() const override;
|
||||||
|
|
||||||
QStringList targetApplications() const override;
|
QStringList targetApplications() const override;
|
||||||
AddNewInformation addNewInformation(const QStringList &files, Node *context) const override;
|
AddNewInformation addNewInformation(const QStringList &files, Node *context) const override;
|
||||||
|
|||||||
Reference in New Issue
Block a user