Maemo: Don't create a deployment widget per sub project.

This makes use of a Maemo target perform acceptably for big projects.

Task-number: QTCREATORBUG-2703
Reviewed-by: kh1
This commit is contained in:
Christian Kandeler
2010-10-14 14:03:55 +02:00
parent b576f50228
commit af8b262ece
11 changed files with 171 additions and 418 deletions

View File

@@ -79,18 +79,19 @@ void MaemoDeployables::createModels()
|| qt4BuildConfiguration()->qt4Target()->project()->activeTarget()->id()
!= QLatin1String(Qt4ProjectManager::Constants::MAEMO_DEVICE_TARGET_ID))
return;
disconnect(qt4BuildConfiguration()->qt4Target()->qt4Project(),
SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)),
m_updateTimer, SLOT(start()));
const Qt4ProFileNode *const rootNode
= qt4BuildConfiguration()->qt4Target()->qt4Project()->rootProjectNode();
if (!rootNode) // Happens on project creation by wizard.
return;
m_updateTimer->stop();
m_proFileOption = QSharedPointer<ProFileOption>(new ProFileOption);
m_proFileOption->properties
= qt4BuildConfiguration()->qtVersion()->versionInfo();
m_proFileOption->target_mode = ProFileOption::TARG_UNIX_MODE;
const Qt4ProFileNode *const rootNode
= qt4BuildConfiguration()->qt4Target()->qt4Project()->rootProjectNode();
if (!rootNode) // Happens on project creation by wizard.
return;
disconnect(qt4BuildConfiguration()->qt4Target()->qt4Project(),
SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)),
m_updateTimer, SLOT(start()));
beginResetModel();
qDeleteAll(m_listModels);
m_listModels.clear();
createModels(rootNode);
@@ -118,7 +119,7 @@ void MaemoDeployables::createModels()
}
}
emit modelsCreated();
endResetModel();
connect(qt4BuildConfiguration()->qt4Target()->qt4Project(),
SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)),
m_updateTimer, SLOT(start()));
@@ -209,5 +210,26 @@ const Qt4BuildConfiguration *MaemoDeployables::qt4BuildConfiguration() const
return bc;
}
int MaemoDeployables::rowCount(const QModelIndex &parent) const
{
return parent.isValid() ? 0 : modelCount();
}
QVariant MaemoDeployables::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.row() < 0 || index.row() >= modelCount()
|| index.column() != 0)
return QVariant();
const MaemoDeployableListModel *const model = m_listModels.at(index.row());
if (role == Qt::ForegroundRole && !model->hasTargetPath()) {
QBrush brush;
brush.setColor(Qt::red);
return brush;
}
if (role == Qt::DisplayRole)
return QFileInfo(model->proFilePath()).fileName();
return QVariant();
}
} // namespace Qt4ProjectManager
} // namespace Internal