summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeengine_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qdeclarativeengine_p.h')
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h108
1 files changed, 53 insertions, 55 deletions
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
index 743275e..531ac97 100644
--- a/src/declarative/qml/qdeclarativeengine_p.h
+++ b/src/declarative/qml/qdeclarativeengine_p.h
@@ -57,6 +57,7 @@
#include "private/qdeclarativeclassfactory_p.h"
#include "private/qdeclarativecompositetypemanager_p.h"
+#include "private/qdeclarativeimport_p.h"
#include "private/qpodvector_p.h"
#include "qdeclarative.h"
#include "private/qdeclarativevaluetype_p.h"
@@ -164,7 +165,6 @@ public:
bool outputWarningsToStdErr;
- struct ImportedNamespace;
QDeclarativeContextScriptClass *contextClass;
QDeclarativeContextData *sharedContext;
QObject *sharedScope;
@@ -217,8 +217,13 @@ public:
QList<SimpleList<QDeclarativeAbstractBinding> > bindValues;
QList<SimpleList<QDeclarativeParserStatus> > parserStatus;
+ QList<QPair<QDeclarativeGuard<QObject>,int> > finalizedParserStatus;
QDeclarativeComponentAttached *componentAttached;
+ void registerFinalizedParserStatusObject(QObject *obj, int index) {
+ finalizedParserStatus.append(qMakePair(QDeclarativeGuard<QObject>(obj), index));
+ }
+
bool inBeginCreate;
QNetworkAccessManager *createNetworkAccessManager(QObject *parent) const;
@@ -232,8 +237,8 @@ public:
mutable QMutex mutex;
QDeclarativeCompositeTypeManager typeManager;
- QStringList fileImportPath;
- QStringList filePluginPath;
+ QDeclarativeImportDatabase importDatabase;
+
QString offlineStoragePath;
mutable quint32 uniqueId;
@@ -244,58 +249,8 @@ public:
QDeclarativeValueTypeFactory valueTypes;
QHash<const QMetaObject *, QDeclarativePropertyCache *> propertyCache;
- QDeclarativePropertyCache *cache(QObject *obj) {
- Q_Q(QDeclarativeEngine);
- if (!obj || QObjectPrivate::get(obj)->metaObject ||
- QObjectPrivate::get(obj)->wasDeleted) return 0;
- const QMetaObject *mo = obj->metaObject();
- QDeclarativePropertyCache *rv = propertyCache.value(mo);
- if (!rv) {
- rv = QDeclarativePropertyCache::create(q, mo);
- propertyCache.insert(mo, rv);
- }
- return rv;
- }
-
- // ### This whole class is embarrassing
- struct Imports {
- Imports();
- ~Imports();
- Imports(const Imports &copy);
- Imports &operator =(const Imports &copy);
-
- void setBaseUrl(const QUrl& url);
- QUrl baseUrl() const;
-
- void cache(QDeclarativeTypeNameCache *cache, QDeclarativeEngine *) const;
-
- private:
- friend class QDeclarativeEnginePrivate;
- QDeclarativeImportsPrivate *d;
- };
-
-
- QSet<QString> initializedPlugins;
-
- QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, const QString &baseName,
- const QStringList &suffixes,
- const QString &prefix = QString());
- QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, const QString &baseName);
-
-
- bool addToImport(Imports*, const QDeclarativeDirComponents &qmldircomponentsnetwork,
- const QString& uri, const QString& prefix, int vmaj, int vmin,
- QDeclarativeScriptParser::Import::Type importType,
- QString *errorString) const;
- bool resolveType(const Imports&, const QByteArray& type,
- QDeclarativeType** type_return, QUrl* url_return,
- int *version_major, int *version_minor,
- ImportedNamespace** ns_return,
- QString *errorString = 0) const;
- void resolveTypeInNamespace(ImportedNamespace*, const QByteArray& type,
- QDeclarativeType** type_return, QUrl* url_return,
- int *version_major, int *version_minor ) const;
-
+ inline QDeclarativePropertyCache *cache(QObject *obj);
+ inline QDeclarativePropertyCache *cache(const QMetaObject *);
void registerCompositeType(QDeclarativeCompiledData *);
@@ -339,6 +294,7 @@ public:
static QScriptValue tint(QScriptContext*, QScriptEngine*);
static QScriptValue desktopOpenUrl(QScriptContext*, QScriptEngine*);
+ static QScriptValue fontFamilies(QScriptContext*, QScriptEngine*);
static QScriptValue md5(QScriptContext*, QScriptEngine*);
static QScriptValue btoa(QScriptContext*, QScriptEngine*);
static QScriptValue atob(QScriptContext*, QScriptEngine*);
@@ -361,6 +317,48 @@ public:
static void defineModule();
};
+/*!
+Returns a QDeclarativePropertyCache for \a obj if one is available.
+
+If \a obj is null, being deleted or contains a dynamic meta object 0
+is returned.
+*/
+QDeclarativePropertyCache *QDeclarativeEnginePrivate::cache(QObject *obj)
+{
+ Q_Q(QDeclarativeEngine);
+ if (!obj || QObjectPrivate::get(obj)->metaObject || QObjectPrivate::get(obj)->wasDeleted)
+ return 0;
+
+ const QMetaObject *mo = obj->metaObject();
+ QDeclarativePropertyCache *rv = propertyCache.value(mo);
+ if (!rv) {
+ rv = new QDeclarativePropertyCache(q, mo);
+ propertyCache.insert(mo, rv);
+ }
+ return rv;
+}
+
+/*!
+Returns a QDeclarativePropertyCache for \a metaObject.
+
+As the cache is persisted for the life of the engine, \a metaObject must be
+a static "compile time" meta-object, or a meta-object that is otherwise known to
+exist for the lifetime of the QDeclarativeEngine.
+*/
+QDeclarativePropertyCache *QDeclarativeEnginePrivate::cache(const QMetaObject *metaObject)
+{
+ Q_Q(QDeclarativeEngine);
+ Q_ASSERT(metaObject);
+
+ QDeclarativePropertyCache *rv = propertyCache.value(metaObject);
+ if (!rv) {
+ rv = new QDeclarativePropertyCache(q, metaObject);
+ propertyCache.insert(metaObject, rv);
+ }
+
+ return rv;
+}
+
QT_END_NAMESPACE
#endif // QDECLARATIVEENGINE_P_H