Commit cac5663a authored by Erik Verbruggen's avatar Erik Verbruggen

Modified the QML project to notify the DUI model manager when a file is added to the project.

parent a5220933
......@@ -57,6 +57,8 @@ DuiModelManager::DuiModelManager(QObject *parent):
Snapshot DuiModelManager::snapshot() const
{
QMutexLocker locker(&m_mutex);
return _snapshot;
}
......@@ -118,6 +120,8 @@ void DuiModelManager::emitDocumentUpdated(DuiDocument::Ptr doc)
void DuiModelManager::onDocumentUpdated(DuiDocument::Ptr doc)
{
QMutexLocker locker(&m_mutex);
_snapshot.insert(doc);
}
......
......@@ -32,6 +32,7 @@
#include <QFuture>
#include <QFutureSynchronizer>
#include <QMutex>
#include "duidocument.h"
#include "duimodelmanagerinterface.h"
......@@ -75,6 +76,7 @@ protected:
DuiModelManager *modelManager);
private:
mutable QMutex m_mutex;
Core::ICore *m_core;
Snapshot _snapshot;
......
......@@ -176,3 +176,4 @@ plugin_qmlprojectmanager.subdir = qmlprojectmanager
plugin_qmlprojectmanager.depends = plugin_texteditor
plugin_qmlprojectmanager.depends += plugin_projectexplorer
plugin_qmlprojectmanager.depends += plugin_help
plugin_qmlprojectmanager.depends += plugin_duieditor
......@@ -39,6 +39,8 @@
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
#include <duieditor/duimodelmanagerinterface.h>
#include <utils/synchronousprocess.h>
#include <utils/pathchooser.h>
......@@ -62,7 +64,8 @@ using namespace QmlProjectManager::Internal;
QmlProject::QmlProject(Manager *manager, const QString &fileName)
: m_manager(manager),
m_fileName(fileName)
m_fileName(fileName),
m_modelManager(ExtensionSystem::PluginManager::instance()->getObject<DuiEditor::DuiModelManagerInterface>())
{
QFileInfo fileInfo(m_fileName);
m_projectName = fileInfo.completeBaseName();
......@@ -118,6 +121,7 @@ void QmlProject::parseProject(RefreshOptions options)
if (options & Files) {
m_files = convertToAbsoluteFiles(readLines(filesFileName()));
m_files.removeDuplicates();
m_modelManager->updateSourceFiles(m_files);
}
if (options & Configuration) {
......
......@@ -41,6 +41,10 @@
#include <QtCore/QDir>
namespace DuiEditor {
class DuiModelManagerInterface;
}
namespace QmlProjectManager {
namespace Internal {
......@@ -104,6 +108,7 @@ private:
QString m_filesFileName;
QmlProjectFile *m_file;
QString m_projectName;
DuiEditor::DuiModelManagerInterface *m_modelManager;
QStringList m_files;
......
include(../../plugins/projectexplorer/projectexplorer.pri)
include(../../plugins/texteditor/texteditor.pri)
include(../../plugins/duieditor/duieditor.pri)
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