Remove qDBusNameToTypeId function.
The function is redundant and can be replaced by QMetaType::type(). Change-Id: I131a7fd285a60d8bd0f3b958668a43bd5da2d6c4 Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
bd5881b460
commit
259388157c
@ -336,7 +336,6 @@ public:
|
|||||||
|
|
||||||
// in qdbusmisc.cpp
|
// in qdbusmisc.cpp
|
||||||
extern int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes);
|
extern int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes);
|
||||||
extern int qDBusNameToTypeId(const char *name);
|
|
||||||
extern bool qDBusCheckAsyncTag(const char *tag);
|
extern bool qDBusCheckAsyncTag(const char *tag);
|
||||||
extern bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name);
|
extern bool qDBusInterfaceInObject(QObject *obj, const QString &interface_name);
|
||||||
extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo);
|
extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo);
|
||||||
|
@ -645,7 +645,7 @@ static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags,
|
|||||||
if (paren != name.length() || !slotname.startsWith(name))
|
if (paren != name.length() || !slotname.startsWith(name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int returnType = qDBusNameToTypeId(mm.typeName());
|
int returnType = QMetaType::type(mm.typeName());
|
||||||
bool isAsync = qDBusCheckAsyncTag(mm.tag());
|
bool isAsync = qDBusCheckAsyncTag(mm.tag());
|
||||||
bool isScriptable = mm.attributes() & QMetaMethod::Scriptable;
|
bool isScriptable = mm.attributes() & QMetaMethod::Scriptable;
|
||||||
|
|
||||||
|
@ -324,19 +324,15 @@ static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant
|
|||||||
|
|
||||||
// we found our property
|
// we found our property
|
||||||
// do we have the right type?
|
// do we have the right type?
|
||||||
int id = mp.type();
|
int id = mp.userType();
|
||||||
if (id == QVariant::UserType) {
|
if (!id){
|
||||||
// dynamic type
|
// type not registered or invalid / void?
|
||||||
id = qDBusNameToTypeId(mp.typeName());
|
qWarning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'",
|
||||||
if (id == -1) {
|
mp.typeName(), mo->className(), property_name.constData());
|
||||||
// type not registered?
|
return PropertyWriteFailed;
|
||||||
qWarning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'",
|
|
||||||
mp.typeName(), mo->className(), property_name.constData());
|
|
||||||
return PropertyWriteFailed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id != 0xff && value.userType() == QDBusMetaTypeId::argument) {
|
if (id != QMetaType::QVariant && value.userType() == QDBusMetaTypeId::argument) {
|
||||||
// we have to demarshall before writing
|
// we have to demarshall before writing
|
||||||
void *null = 0;
|
void *null = 0;
|
||||||
QVariant other(id, null);
|
QVariant other(id, null);
|
||||||
@ -434,7 +430,7 @@ static QVariantMap readAllProperties(QObject *object, int flags)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// is it a registered property?
|
// is it a registered property?
|
||||||
int typeId = qDBusNameToTypeId(mp.typeName());
|
int typeId = mp.userType();
|
||||||
if (!typeId)
|
if (!typeId)
|
||||||
continue;
|
continue;
|
||||||
const char *signature = QDBusMetaType::typeToSignature(typeId);
|
const char *signature = QDBusMetaType::typeToSignature(typeId);
|
||||||
|
@ -69,14 +69,6 @@ bool qDBusCheckAsyncTag(const char *tag)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int qDBusNameToTypeId(const char *name)
|
|
||||||
{
|
|
||||||
int id = static_cast<int>( QVariant::nameToType(name) );
|
|
||||||
if (id == QVariant::UserType)
|
|
||||||
id = QMetaType::type(name);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString qDBusInterfaceFromMetaObject(const QMetaObject *mo)
|
QString qDBusInterfaceFromMetaObject(const QMetaObject *mo)
|
||||||
{
|
{
|
||||||
QString interface;
|
QString interface;
|
||||||
@ -158,7 +150,7 @@ int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes)
|
|||||||
QByteArray basictype = type;
|
QByteArray basictype = type;
|
||||||
basictype.truncate(type.length() - 1);
|
basictype.truncate(type.length() - 1);
|
||||||
|
|
||||||
int id = qDBusNameToTypeId(basictype);
|
int id = QMetaType::type(basictype);
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
//qWarning("Could not parse the method '%s'", mm.signature());
|
//qWarning("Could not parse the method '%s'", mm.signature());
|
||||||
// invalid type in method parameter list
|
// invalid type in method parameter list
|
||||||
@ -177,7 +169,7 @@ int qDBusParametersForMethod(const QMetaMethod &mm, QList<int>& metaTypes)
|
|||||||
return -1; // not allowed
|
return -1; // not allowed
|
||||||
}
|
}
|
||||||
|
|
||||||
int id = qDBusNameToTypeId(type);
|
int id = QMetaType::type(type);
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
//qWarning("Could not parse the method '%s'", mm.signature());
|
//qWarning("Could not parse the method '%s'", mm.signature());
|
||||||
// invalid type in method parameter list
|
// invalid type in method parameter list
|
||||||
|
@ -101,7 +101,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
|||||||
if (mp.isWritable())
|
if (mp.isWritable())
|
||||||
access |= 2;
|
access |= 2;
|
||||||
|
|
||||||
int typeId = qDBusNameToTypeId(mp.typeName());
|
int typeId = mp.userType();
|
||||||
if (!typeId)
|
if (!typeId)
|
||||||
continue;
|
continue;
|
||||||
const char *signature = QDBusMetaType::typeToSignature(typeId);
|
const char *signature = QDBusMetaType::typeToSignature(typeId);
|
||||||
@ -150,7 +150,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
|||||||
.arg(QLatin1String(signature.left(paren)));
|
.arg(QLatin1String(signature.left(paren)));
|
||||||
|
|
||||||
// check the return type first
|
// check the return type first
|
||||||
int typeId = qDBusNameToTypeId(mm.typeName());
|
int typeId = QMetaType::type(mm.typeName());
|
||||||
if (typeId) {
|
if (typeId) {
|
||||||
const char *typeName = QDBusMetaType::typeToSignature(typeId);
|
const char *typeName = QDBusMetaType::typeToSignature(typeId);
|
||||||
if (typeName) {
|
if (typeName) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user