Improve Qml code model import handling.

* Fill the snapshot with files that could be imported.
* Implement package imports.

* The qmldir file is not parsed yet.

Reviewed-by: Erik Verbruggen
This commit is contained in:
Christian Kamm
2010-03-16 16:34:33 +01:00
parent 62c41defb4
commit 9ea01cf5fb
17 changed files with 251 additions and 175 deletions

View File

@@ -95,6 +95,8 @@ void QmlProject::parseProject(RefreshOptions options)
&& qobject_cast<QmlProjectItem*>(component->create())) {
m_projectItem = qobject_cast<QmlProjectItem*>(component->create());
connect(m_projectItem.data(), SIGNAL(qmlFilesChanged()), this, SLOT(refreshFiles()));
connect(m_projectItem.data(), SIGNAL(libraryPathsChanged()), this, SLOT(refreshImportPaths()));
refreshImportPaths();
} else {
Core::MessageManager *messageManager = Core::ICore::instance()->messageManager();
messageManager->printToOutputPane(tr("Error while loading project file!"));
@@ -104,7 +106,13 @@ void QmlProject::parseProject(RefreshOptions options)
}
if (m_projectItem) {
m_projectItem.data()->setSourceDirectory(projectDir().path());
m_modelManager->updateSourceFiles(m_projectItem.data()->files());
QSet<QString> sourceDirectories;
foreach (const QString &file, m_projectItem.data()->files()) {
sourceDirectories.insert(QFileInfo(file).path());
}
m_modelManager->updateSourceDirectories(sourceDirectories.toList());
}
m_rootNode->refresh();
}
@@ -185,6 +193,11 @@ void QmlProject::refreshFiles()
refresh(Files);
}
void QmlProject::refreshImportPaths()
{
m_modelManager->setProjectImportPaths(libraryPaths());
}
QString QmlProject::displayName() const
{
return m_projectName;