Commit 3d8000a9 authored by Daniel Teske's avatar Daniel Teske

Android: Add Libraries: Disable library model while parse is in progress

Change-Id: I314e7db6178d6d6863b3f99a0bf1f0eec0956303
Reviewed-by: default avatarEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
parent c5779068
......@@ -154,8 +154,10 @@ AndroidDeployQtWidget::AndroidDeployQtWidget(AndroidDeployQtStep *step)
connect(m_ui->addAndroidExtraLibButton, SIGNAL(clicked()), this, SLOT(addAndroidExtraLib()));
connect(m_ui->removeAndroidExtraLibButton, SIGNAL(clicked()), this, SLOT(removeAndroidExtraLib()));
connect(m_step->project(), SIGNAL(proFilesEvaluated()), this, SLOT(checkProjectTemplate()));
checkProjectTemplate();
connect(m_extraLibraryListModel, SIGNAL(enabledChanged(bool)),
m_ui->additionalLibrariesGroupBox, SLOT(setEnabled(bool)));
m_ui->additionalLibrariesGroupBox->setEnabled(m_extraLibraryListModel->isEnabled());
}
AndroidDeployQtWidget::~AndroidDeployQtWidget()
......@@ -163,15 +165,6 @@ AndroidDeployQtWidget::~AndroidDeployQtWidget()
delete m_ui;
}
void AndroidDeployQtWidget::checkProjectTemplate()
{
QmakeProjectManager::QmakeProject *project = static_cast<QmakeProjectManager::QmakeProject *>(m_step->project());
if (project->rootQmakeProjectNode()->projectType() == QmakeProjectManager::ApplicationTemplate)
m_ui->additionalLibrariesGroupBox->setEnabled(true);
else
m_ui->additionalLibrariesGroupBox->setEnabled(false);
}
void AndroidDeployQtWidget::createManifestButton()
{
CreateAndroidManifestWizard wizard(m_step->target());
......
......@@ -75,7 +75,6 @@ private slots:
void addAndroidExtraLib();
void removeAndroidExtraLib();
void checkEnableRemoveButton();
void checkProjectTemplate();
private:
virtual QString summaryText() const;
......
......@@ -40,9 +40,11 @@ AndroidExtraLibraryListModel::AndroidExtraLibraryListModel(QmakeProjectManager::
: QAbstractItemModel(parent)
, m_project(project)
{
reset();
QmakeProjectManager::QmakeProFileNode *node = m_project->rootQmakeProjectNode();
proFileUpdated(node, node->validParse(), node->parseInProgress());
connect(m_project, SIGNAL(proFilesEvaluated()), this, SLOT(reset()));
connect(m_project, SIGNAL(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)),
this, SLOT(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)));
}
QModelIndex AndroidExtraLibraryListModel::index(int row, int column, const QModelIndex &) const
......@@ -75,15 +77,40 @@ QVariant AndroidExtraLibraryListModel::data(const QModelIndex &index, int role)
};
}
void AndroidExtraLibraryListModel::reset()
void AndroidExtraLibraryListModel::proFileUpdated(QmakeProjectManager::QmakeProFileNode *node, bool success, bool parseInProgress)
{
if (m_project->rootQmakeProjectNode()->projectType() != QmakeProjectManager::ApplicationTemplate)
QmakeProjectManager::QmakeProFileNode *root = m_project->rootQmakeProjectNode();
if (node != root)
return;
if (parseInProgress) {
emit enabledChanged(false);
return;
}
bool enabled;
beginResetModel();
QmakeProjectManager::QmakeProFileNode *node = m_project->rootQmakeProjectNode();
m_entries = node->variableValue(QmakeProjectManager::AndroidExtraLibs);
if (success && root->projectType() == QmakeProjectManager::ApplicationTemplate) {
m_entries = node->variableValue(QmakeProjectManager::AndroidExtraLibs);
enabled = true;
} else {
// parsing error or not a application template
m_entries.clear();
enabled = false;
}
endResetModel();
emit enabledChanged(enabled);
}
bool AndroidExtraLibraryListModel::isEnabled() const
{
QmakeProjectManager::QmakeProFileNode *root = m_project->rootQmakeProjectNode();
if (root->parseInProgress())
return false;
if (root->projectType() != QmakeProjectManager::ApplicationTemplate)
return false;
return true;
}
void AndroidExtraLibraryListModel::addEntries(const QStringList &list)
......
......@@ -34,7 +34,10 @@
#include <QAbstractItemModel>
#include <QStringList>
namespace QmakeProjectManager { class QmakeProject; }
namespace QmakeProjectManager {
class QmakeProject;
class QmakeProFileNode;
}
namespace Android {
namespace Internal {
......@@ -54,8 +57,13 @@ public:
void removeEntries(QModelIndexList list);
void addEntries(const QStringList &list);
bool isEnabled() const;
signals:
void enabledChanged(bool);
private slots:
void reset();
void proFileUpdated(QmakeProjectManager::QmakeProFileNode *node, bool success, bool parseInProgress);
private:
QmakeProjectManager::QmakeProject *m_project;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment