summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-11-05 05:01:16 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-11-05 05:01:16 (GMT)
commit085dd75830357b359abf53b7d37c049cdd17977c (patch)
tree67795686c5afdeac7d1eebde5a66dfa330353283 /src/declarative/qml
parentaa6f6174374e0abfe94f37ccefce2d0e2b5fe13e (diff)
parente4e3b8f336b6c7d0dd52d4b8af96fee1dc628783 (diff)
downloadQt-085dd75830357b359abf53b7d37c049cdd17977c.zip
Qt-085dd75830357b359abf53b7d37c049cdd17977c.tar.gz
Qt-085dd75830357b359abf53b7d37c049cdd17977c.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qml.h22
-rw-r--r--src/declarative/qml/qmlcomponent.cpp2
-rw-r--r--src/declarative/qml/qmlcustomparser_p.h8
-rw-r--r--src/declarative/qml/qmlengine.cpp15
-rw-r--r--src/declarative/qml/qmlmetatype.cpp26
-rw-r--r--src/declarative/qml/qmlmetatype.h21
-rw-r--r--src/declarative/qml/qmlprivate.h2
7 files changed, 41 insertions, 55 deletions
diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h
index f6a6371..bb7ae24 100644
--- a/src/declarative/qml/qml.h
+++ b/src/declarative/qml/qml.h
@@ -91,11 +91,11 @@ QT_BEGIN_NAMESPACE
#define QML_DEFINE_INTERFACE(INTERFACE) \
static int defineInterface##INTERFACE = qmlRegisterInterface<INTERFACE>(#INTERFACE);
-#define QML_DEFINE_EXTENDED_TYPE(URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, NAME, TYPE, EXTENSION) \
- static int registerExtended##TYPE = qmlRegisterExtendedType<TYPE,EXTENSION>(#URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, #NAME, #TYPE);
+#define QML_DEFINE_EXTENDED_TYPE(URI, VERSION_MAJ, VERS, NAME, TYPE, EXTENSION) \
+ static int registerExtended##TYPE = qmlRegisterExtendedType<TYPE,EXTENSION>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE);
-#define QML_DEFINE_TYPE(URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, NAME, TYPE) \
- static int defineType##TYPE = qmlRegisterType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, #NAME, #TYPE);
+#define QML_DEFINE_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE) \
+ static int defineType##TYPE = qmlRegisterType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE);
#define QML_DEFINE_EXTENDED_NOCREATE_TYPE(TYPE, EXTENSION) \
static int registerExtendedNoCreate##TYPE = qmlRegisterExtendedType<TYPE,EXTENSION>(#TYPE);
@@ -106,19 +106,19 @@ QT_BEGIN_NAMESPACE
#else
#define QML_DEFINE_INTERFACE(INTERFACE) \
- template<> QmlPrivate::InstanceType QmlPrivate::Define<INTERFACE *,0,0,0>::instance(qmlRegisterInterface<INTERFACE>(#INTERFACE));
+ template<> QmlPrivate::InstanceType QmlPrivate::Define<INTERFACE *,0,0>::instance(qmlRegisterInterface<INTERFACE>(#INTERFACE));
-#define QML_DEFINE_EXTENDED_TYPE(URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, NAME, TYPE, EXTENSION) \
- template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,(VERSION_MAJ), (VERSION_MIN_FROM), (VERSION_MIN_TO)>::instance(qmlRegisterExtendedType<TYPE,EXTENSION>(#URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, #NAME, #TYPE));
+#define QML_DEFINE_EXTENDED_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, EXTENSION) \
+ template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,(VERSION_MAJ), (VERSION_MIN)>::instance(qmlRegisterExtendedType<TYPE,EXTENSION>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE));
-#define QML_DEFINE_TYPE(URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, NAME, TYPE) \
- template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,(VERSION_MAJ), (VERSION_MIN_FROM), (VERSION_MIN_TO)>::instance(qmlRegisterType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MIN_TO, #NAME, #TYPE));
+#define QML_DEFINE_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE) \
+ template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,(VERSION_MAJ), (VERSION_MIN)>::instance(qmlRegisterType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE));
#define QML_DEFINE_EXTENDED_NOCREATE_TYPE(TYPE, EXTENSION) \
- template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,0,0,0>::instance(qmlRegisterExtendedType<TYPE,EXTENSION>(#TYPE));
+ template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,0,0>::instance(qmlRegisterExtendedType<TYPE,EXTENSION>(#TYPE));
#define QML_DEFINE_NOCREATE_TYPE(TYPE) \
- template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,0,0,0>::instance(qmlRegisterType<TYPE>(#TYPE));
+ template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,0,0>::instance(qmlRegisterType<TYPE>(#TYPE));
#endif
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index 03f07b3..3c142a7 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -119,7 +119,7 @@ Item {
}
\endqml
*/
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Component,QmlComponent);
+QML_DEFINE_TYPE(Qt,4,6,Component,QmlComponent);
/*!
\enum QmlComponent::Status
diff --git a/src/declarative/qml/qmlcustomparser_p.h b/src/declarative/qml/qmlcustomparser_p.h
index 89d3be2..74bed25 100644
--- a/src/declarative/qml/qmlcustomparser_p.h
+++ b/src/declarative/qml/qmlcustomparser_p.h
@@ -128,11 +128,11 @@ private:
};
#if defined(Q_OS_SYMBIAN)
-# define QML_DEFINE_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MAJ_TO, NAME, TYPE, CUSTOMTYPE) \
- static int defineCustomType##NAME = qmlRegisterCustomType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MAJ_TO, #NAME, #TYPE, new CUSTOMTYPE);
+# define QML_DEFINE_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, CUSTOMTYPE) \
+ static int defineCustomType##NAME = qmlRegisterCustomType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE, new CUSTOMTYPE);
#else
-# define QML_DEFINE_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MAJ_TO, NAME, TYPE, CUSTOMTYPE) \
- template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,(VERSION_MAJ), (VERSION_MIN_FROM), (VERSION_MAJ_TO)>::instance(qmlRegisterCustomType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN_FROM, VERSION_MAJ_TO, #NAME, #TYPE, new CUSTOMTYPE));
+# define QML_DEFINE_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, CUSTOMTYPE) \
+ template<> QmlPrivate::InstanceType QmlPrivate::Define<TYPE *,(VERSION_MAJ), (VERSION_MIN)>::instance(qmlRegisterCustomType<TYPE>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE, new CUSTOMTYPE));
#endif
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index f81f2ed..e46205d 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -103,7 +103,7 @@ QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(qmlDebugger, QML_DEBUGGER)
DEFINE_BOOL_CONFIG_OPTION(qmlImportTrace, QML_IMPORT_TRACE)
-QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Object,QObject)
+QML_DEFINE_TYPE(Qt,4,6,Object,QObject)
struct StaticQtMetaObject : public QObject
{
@@ -998,17 +998,13 @@ struct QmlEnginePrivate::ImportedNamespace {
if (line.isEmpty() || line.at(0) == QLatin1Char('#'))
continue;
if (line.startsWith(typespace)) {
- // eg. 1.2-5
int space1 = line.indexOf(QLatin1Char(' '));
int space2 = space1 >=0 ? line.indexOf(QLatin1Char(' '),space1+1) : -1;
QString mapversions = line.mid(space1+1,space2<0?line.length()-space1-1:space2-space1-1);
int dot = mapversions.indexOf(QLatin1Char('.'));
- int dash = mapversions.indexOf(QLatin1Char('-'));
int mapvmaj = mapversions.left(dot).toInt();
- if (mapvmaj==vmaj) {
- int mapvmin_from = (dash <= 0 ? mapversions.mid(dot+1) : mapversions.mid(dot+1,dash-dot-1)).toInt();
- int mapvmin_to = dash <= 0 ? mapvmin_from : mapversions.mid(dash+1).toInt();
- if (vmin >= mapvmin_from && vmin <= mapvmin_to) {
+ if (mapvmaj<=vmaj) {
+ if (mapvmaj<vmaj || vmin >= mapversions.mid(dot+1).toInt()) {
QStringRef mapfile = space2<0 ? QStringRef() : line.midRef(space2+1,line.length()-space2-1);
if (url_return)
*url_return = url.resolved(mapfile.toString());
@@ -1177,9 +1173,8 @@ static QmlTypeNameCache *cacheForNamespace(QmlEngine *engine, const QmlEnginePri
foreach (QmlType *type, types) {
if (type->qmlTypeName().startsWith(base) &&
type->qmlTypeName().lastIndexOf('/') == (base.length() - 1) &&
- type->majorVersion() == major && type->minMinorVersion() <= minor &&
- type->maxMinorVersion() >= minor) {
-
+ type->availableInVersion(major,minor))
+ {
QString name = QString::fromUtf8(type->qmlTypeName().mid(base.length()));
cache->add(name, type);
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp
index 6ce51bd..6ecaa9f 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qmlmetatype.cpp
@@ -119,8 +119,7 @@ public:
const char *m_iid;
QByteArray m_name;
int m_version_maj;
- int m_version_min_from;
- int m_version_min_to;
+ int m_version_min;
int m_typeId; int m_listId; int m_qmlListId;
QmlPrivate::Func m_opFunc;
const QMetaObject *m_baseMetaObject;
@@ -160,13 +159,12 @@ QmlType::QmlType(int type, int listType, int qmlListType,
d->m_index = index;
d->m_isSetup = true;
d->m_version_maj = 0;
- d->m_version_min_from = 0;
- d->m_version_min_to = 0;
+ d->m_version_min = 0;
}
QmlType::QmlType(int type, int listType, int qmlListType,
QmlPrivate::Func opFunc, const char *qmlName,
- int version_maj, int version_min_from, int version_min_to,
+ int version_maj, int version_min,
const QMetaObject *metaObject,
QmlAttachedPropertiesFunc attachedPropertiesFunc,
const QMetaObject *attachedType,
@@ -178,8 +176,7 @@ QmlType::QmlType(int type, int listType, int qmlListType,
{
d->m_name = qmlName;
d->m_version_maj = version_maj;
- d->m_version_min_from = version_min_from;
- d->m_version_min_to = version_min_to;
+ d->m_version_min = version_min;
d->m_typeId = type;
d->m_listId = listType;
d->m_qmlListId = qmlListType;
@@ -209,19 +206,14 @@ int QmlType::majorVersion() const
return d->m_version_maj;
}
-int QmlType::minMinorVersion() const
+int QmlType::minorVersion() const
{
- return d->m_version_min_from;
-}
-
-int QmlType::maxMinorVersion() const
-{
- return d->m_version_min_to;
+ return d->m_version_min;
}
bool QmlType::availableInVersion(int vmajor, int vminor) const
{
- return vmajor == d->m_version_maj && vminor >= d->m_version_min_from && vminor <= d->m_version_min_to;
+ return vmajor > d->m_version_maj || (vmajor == d->m_version_maj && vminor >= d->m_version_min);
}
void QmlTypePrivate::init() const
@@ -473,7 +465,7 @@ int QmlMetaType::registerInterface(const QmlPrivate::MetaTypeIds &id,
}
int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Func func,
- const char *uri, int version_maj, int version_min_from, int version_min_to, const char *cname,
+ const char *uri, int version_maj, int version_min, const char *cname,
const QMetaObject *mo, QmlAttachedPropertiesFunc attach, const QMetaObject *attachMo,
int pStatus, int object, int valueSource, int valueInterceptor, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *parser)
{
@@ -499,7 +491,7 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Fun
name.replace('.','/');
QmlType *type = new QmlType(id.typeId, id.listId, id.qmlListId,
- func, name, version_maj, version_min_from, version_min_to, mo, attach, attachMo, pStatus,
+ func, name, version_maj, version_min, mo, attach, attachMo, pStatus,
valueSource, valueInterceptor, extFunc, extmo, index, parser);
data->types.append(type);
diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h
index eb5fd28..e90c367 100644
--- a/src/declarative/qml/qmlmetatype.h
+++ b/src/declarative/qml/qmlmetatype.h
@@ -61,7 +61,7 @@ class QmlCustomParser;
class Q_DECLARATIVE_EXPORT QmlMetaType
{
public:
- static int registerType(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *, int vmaj, int vmin_from, int vmin_to, const char *qmlName, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int pStatus, int object, int valueSource, int valueInterceptor, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *);
+ static int registerType(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *, int vmaj, int vmin, const char *qmlName, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int pStatus, int object, int valueSource, int valueInterceptor, QmlPrivate::CreateFunc extFunc, const QMetaObject *extmo, QmlCustomParser *);
static int registerInterface(const QmlPrivate::MetaTypeIds &, QmlPrivate::Func, const char *);
static bool copy(int type, void *data, const void *copy = 0);
@@ -118,8 +118,7 @@ public:
QByteArray qmlTypeName() const;
int majorVersion() const;
- int minMinorVersion() const;
- int maxMinorVersion() const;
+ int minorVersion() const;
bool availableInVersion(int vmajor, int vminor) const;
QByteArray hash() const;
@@ -156,7 +155,7 @@ private:
friend class QmlTypePrivate;
friend class QmlMetaTypeData;
QmlType(int, int, int, QmlPrivate::Func, const char *, int);
- QmlType(int, int, int, QmlPrivate::Func, const char *, int, int, int, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int, int, int, QmlPrivate::CreateFunc, const QMetaObject *, int, QmlCustomParser *);
+ QmlType(int, int, int, QmlPrivate::Func, const char *, int, int, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int, int, int, QmlPrivate::CreateFunc, const QMetaObject *, int, QmlCustomParser *);
~QmlType();
QmlTypePrivate *d;
@@ -172,7 +171,7 @@ int qmlRegisterType(const char *typeName)
qRegisterMetaType<T *>(QByteArray("QmlList<" + name + "*>*").constData())
};
- return QmlMetaType::registerType(ids, QmlPrivate::list_nocreate_op<T>, 0, 0, 0, 0, 0,
+ return QmlMetaType::registerType(ids, QmlPrivate::list_nocreate_op<T>, 0, 0, 0, 0,
&T::staticMetaObject,
QmlPrivate::attachedPropertiesFunc<T>(),
QmlPrivate::attachedPropertiesMetaObject<T>(),
@@ -184,7 +183,7 @@ int qmlRegisterType(const char *typeName)
}
template<typename T>
-int qmlRegisterType(const char *uri, int version_maj, int version_min_from, int version_min_to, const char *qmlName, const char *typeName)
+int qmlRegisterType(const char *uri, int version_maj, int version_min, const char *qmlName, const char *typeName)
{
QByteArray name(typeName);
QmlPrivate::MetaTypeIds ids = {
@@ -194,7 +193,7 @@ int qmlRegisterType(const char *uri, int version_maj, int version_min_from, int
};
return QmlMetaType::registerType(ids, QmlPrivate::list_op<T>,
- uri, version_maj, version_min_from, version_min_to, qmlName,
+ uri, version_maj, version_min, qmlName,
&T::staticMetaObject,
QmlPrivate::attachedPropertiesFunc<T>(),
QmlPrivate::attachedPropertiesMetaObject<T>(),
@@ -234,7 +233,7 @@ int qmlRegisterExtendedType(const char *typeName)
}
template<typename T, typename E>
-int qmlRegisterExtendedType(const char *uri, int version_maj, int version_min_from, int version_min_to, const char *qmlName, const char *typeName)
+int qmlRegisterExtendedType(const char *uri, int version_maj, int version_min, const char *qmlName, const char *typeName)
{
QByteArray name(typeName);
QmlPrivate::MetaTypeIds ids = {
@@ -253,7 +252,7 @@ int qmlRegisterExtendedType(const char *uri, int version_maj, int version_min_fr
}
return QmlMetaType::registerType(ids, QmlPrivate::list_op<T>,
- uri, version_maj, version_min_from, version_min_to, qmlName,
+ uri, version_maj, version_min, qmlName,
&T::staticMetaObject,
attached, attachedMo,
QmlPrivate::StaticCastSelector<T,QmlParserStatus>::cast(),
@@ -280,7 +279,7 @@ int qmlRegisterInterface(const char *typeName)
}
template<typename T>
-int qmlRegisterCustomType(const char *uri, int version_maj, int version_min_from, int version_min_to, const char *qmlName, const char *typeName, QmlCustomParser *parser)
+int qmlRegisterCustomType(const char *uri, int version_maj, int version_min, const char *qmlName, const char *typeName, QmlCustomParser *parser)
{
QByteArray name(typeName);
QmlPrivate::MetaTypeIds ids = {
@@ -290,7 +289,7 @@ int qmlRegisterCustomType(const char *uri, int version_maj, int version_min_from
};
return QmlMetaType::registerType(ids, QmlPrivate::list_op<T>,
- uri, version_maj, version_min_from, version_min_to, qmlName,
+ uri, version_maj, version_min, qmlName,
&T::staticMetaObject,
QmlPrivate::attachedPropertiesFunc<T>(),
QmlPrivate::attachedPropertiesMetaObject<T>(),
diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h
index 6ab36a2..e5b1060 100644
--- a/src/declarative/qml/qmlprivate.h
+++ b/src/declarative/qml/qmlprivate.h
@@ -223,7 +223,7 @@ namespace QmlPrivate
InstanceType(int);
};
- template<typename T, int VMAJ, int VMIN1, int VMIN2>
+ template<typename T, int VMAJ, int VMIN>
struct Define {
static InstanceType instance;
};