forked from qt-creator/qt-creator
Removed private header dependencies and introduced loading QML types from XML file.
This commit is contained in:
@@ -35,14 +35,18 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
#include <qmljs/qmljsinterpreter.h>
|
||||
#include <texteditor/itexteditor.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QtConcurrentRun>
|
||||
#include <qtconcurrent/runextensions.h>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
using namespace QmlJS;
|
||||
using namespace QmlJSEditor;
|
||||
using namespace QmlJSEditor::Internal;
|
||||
@@ -57,6 +61,22 @@ ModelManager::ModelManager(QObject *parent):
|
||||
|
||||
connect(this, SIGNAL(documentUpdated(QmlJS::Document::Ptr)),
|
||||
this, SLOT(onDocumentUpdated(QmlJS::Document::Ptr)));
|
||||
|
||||
loadQmlTypeDescriptions();
|
||||
}
|
||||
|
||||
void ModelManager::loadQmlTypeDescriptions()
|
||||
{
|
||||
const QString resourcePath = Core::ICore::instance()->resourcePath();
|
||||
const QDir typeFileDir(resourcePath + QLatin1String("/qml-type-descriptions"));
|
||||
const QStringList xmlExtensions = QStringList() << QLatin1String("*.xml");
|
||||
const QFileInfoList xmlFiles = typeFileDir.entryInfoList(xmlExtensions,
|
||||
QDir::Files,
|
||||
QDir::Name);
|
||||
|
||||
const QStringList errors = Interpreter::MetaTypeSystem::load(xmlFiles);
|
||||
foreach (const QString &error, errors)
|
||||
qWarning() << qPrintable(error);
|
||||
}
|
||||
|
||||
Snapshot ModelManager::snapshot() const
|
||||
|
||||
@@ -82,6 +82,8 @@ protected:
|
||||
QStringList files,
|
||||
ModelManager *modelManager);
|
||||
|
||||
void loadQmlTypeDescriptions();
|
||||
|
||||
private:
|
||||
static bool matchesMimeType(const Core::MimeType &fileMimeType, const Core::MimeType &knownMimeType);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user