summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2010-11-19 15:02:42 -0300
committerRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2010-11-19 16:05:00 -0300
commitc9aef92cab51623aba0211c5805c88386c638e0a (patch)
tree61426bf65dee72162eb406bfbb649c016e881976
parent5e0550446c3546beb4a7076a80a7475b394567f4 (diff)
downloadpyside-c9aef92cab51623aba0211c5805c88386c638e0a.tar.gz
pyside-c9aef92cab51623aba0211c5805c88386c638e0a.tar.xz
pyside-c9aef92cab51623aba0211c5805c88386c638e0a.zip
Update to new Shiboken API (Renamed SbkObjectType)
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
-rw-r--r--PySide/QtCore/glue/qcoreapplication_init.cpp2
-rw-r--r--PySide/QtCore/qvariant_conversions.h12
-rw-r--r--PySide/QtCore/qvariant_type_conversions.h4
-rw-r--r--PySide/QtGui/glue/qapplication_init.cpp2
-rw-r--r--PySide/QtGui/glue/qlayout_help_functions.h4
-rw-r--r--PySide/QtGui/glue/qwidget_glue.h2
-rw-r--r--PySide/QtGui/qpixmap_conversion.h12
-rw-r--r--PySide/QtGui/typesystem_gui_common.xml4
-rw-r--r--libpyside/pysideconversions.h6
-rw-r--r--libpyside/pysidesignal.cpp9
-rw-r--r--libpyside/pysidesignal.h5
11 files changed, 30 insertions, 32 deletions
diff --git a/PySide/QtCore/glue/qcoreapplication_init.cpp b/PySide/QtCore/glue/qcoreapplication_init.cpp
index 274afb6..446074c 100644
--- a/PySide/QtCore/glue/qcoreapplication_init.cpp
+++ b/PySide/QtCore/glue/qcoreapplication_init.cpp
@@ -4,7 +4,7 @@ static char** QCoreApplicationArgValues;
int Sbk_QCoreApplication_Init(PyObject* self, PyObject* args, PyObject*)
{
- if (Shiboken::isUserType(self) && !Shiboken::canCallConstructor(self->ob_type, Shiboken::SbkType<QApplication >()))
+ if (Shiboken::Wrapper::isUserType(self) && !Shiboken::BaseType::canCallConstructor(self->ob_type, Shiboken::SbkType<QApplication >()))
return -1;
diff --git a/PySide/QtCore/qvariant_conversions.h b/PySide/QtCore/qvariant_conversions.h
index a2ac427..bfff565 100644
--- a/PySide/QtCore/qvariant_conversions.h
+++ b/PySide/QtCore/qvariant_conversions.h
@@ -16,13 +16,13 @@ struct Converter<QVariant>
static QByteArray resolveMetaType(PyTypeObject* type, int &typeId)
{
- if (PyObject_TypeCheck(type, &SbkObjectType_Type)) {
- SbkObjectType* sbkType = reinterpret_cast<SbkObjectType*>(type);
- QByteArray typeName(sbkType->original_name);
+ if (PyObject_TypeCheck(type, &SbkBaseType_Type)) {
+ SbkBaseType* sbkType = reinterpret_cast<SbkBaseType*>(type);
+ QByteArray typeName(Shiboken::BaseType::getOriginalName(sbkType));
bool valueType = !typeName.endsWith("*");
// Do not convert user type of value
- if (valueType && sbkType->is_user_type)
+ if (valueType && Shiboken::BaseType::isUserType(type))
return QByteArray();
int obTypeId = QMetaType::type(typeName);
@@ -86,8 +86,8 @@ struct Converter<QVariant>
return convertToVariantList(pyObj);
} else {
// a class supported by QVariant?
- if (Shiboken::isShibokenType(pyObj)) {
- SbkObjectType* objType = reinterpret_cast<SbkObjectType*>(pyObj->ob_type);
+ if (Shiboken::Wrapper::checkType(pyObj)) {
+ SbkBaseType* objType = reinterpret_cast<SbkBaseType*>(pyObj->ob_type);
int typeCode = 0;
QByteArray typeName = resolveMetaType(reinterpret_cast<PyTypeObject*>(objType), typeCode);
if (typeCode) {
diff --git a/PySide/QtCore/qvariant_type_conversions.h b/PySide/QtCore/qvariant_type_conversions.h
index 4ec4765..74b3289 100644
--- a/PySide/QtCore/qvariant_type_conversions.h
+++ b/PySide/QtCore/qvariant_type_conversions.h
@@ -26,8 +26,8 @@ struct Converter<QVariant::Type>
else if (pyObj == reinterpret_cast<PyObject*>(&PyLong_Type))
typeName = "int"; // long is a UserType in QVariant.
else if (PyType_Check(pyObj)) {
- if (pyObj->ob_type == &SbkObjectType_Type)
- typeName = reinterpret_cast<SbkObjectType*>(pyObj)->original_name;
+ if (pyObj->ob_type == &SbkBaseType_Type)
+ typeName = Shiboken::BaseType::getOriginalName(reinterpret_cast<SbkBaseType*>(pyObj));
else
typeName = reinterpret_cast<PyTypeObject*>(pyObj)->tp_name;
}
diff --git a/PySide/QtGui/glue/qapplication_init.cpp b/PySide/QtGui/glue/qapplication_init.cpp
index 51ed3ff..b4bf324 100644
--- a/PySide/QtGui/glue/qapplication_init.cpp
+++ b/PySide/QtGui/glue/qapplication_init.cpp
@@ -7,7 +7,7 @@ static const char QAPP_MACRO[] = "qApp";
int Sbk_QApplication_Init(PyObject* self, PyObject* args, PyObject*)
{
- if (Shiboken::isUserType(self) && !Shiboken::canCallConstructor(self->ob_type, Shiboken::SbkType<QApplication>()))
+ if (Shiboken::Wrapper::isUserType(self) && !Shiboken::BaseType::canCallConstructor(self->ob_type, Shiboken::SbkType<QApplication>()))
return -1;
if (QApplication::instance()) {
diff --git a/PySide/QtGui/glue/qlayout_help_functions.h b/PySide/QtGui/glue/qlayout_help_functions.h
index 8d899ea..3361e61 100644
--- a/PySide/QtGui/glue/qlayout_help_functions.h
+++ b/PySide/QtGui/glue/qlayout_help_functions.h
@@ -18,7 +18,7 @@ inline void addLayoutOwnership(QLayout* layout, QWidget* widget)
//keep the reference while the layout is orphan
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(layout));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget));
- Shiboken::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
+ Shiboken::Wrapper::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
} else {
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QWidget*>::toPython(parent));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QWidget*>::toPython(widget));
@@ -34,7 +34,7 @@ inline void addLayoutOwnership(QLayout* layout, QLayout* other)
//keep the reference while the layout is orphan
Shiboken::AutoDecRef pyParent(Shiboken::Converter<QLayout*>::toPython(layout));
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(other));
- Shiboken::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
+ Shiboken::Wrapper::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
return;
}
diff --git a/PySide/QtGui/glue/qwidget_glue.h b/PySide/QtGui/glue/qwidget_glue.h
index 33e8a7f..4698688 100644
--- a/PySide/QtGui/glue/qwidget_glue.h
+++ b/PySide/QtGui/glue/qwidget_glue.h
@@ -34,7 +34,7 @@ static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout)
Shiboken::AutoDecRef pyChild(Shiboken::Converter<QLayout*>::toPython(layout));
Shiboken::Wrapper::setParent(pyParent, pyChild);
//remove previous references
- Shiboken::keepReference(reinterpret_cast<SbkObject*>(pyChild.object()), qPrintable(retrieveObjectName(pyChild)), Py_None);
+ Shiboken::Wrapper::keepReference(reinterpret_cast<SbkObject*>(pyChild.object()), qPrintable(retrieveObjectName(pyChild)), Py_None);
}
static inline void qwidgetSetLayout(QWidget *self, QLayout *layout)
diff --git a/PySide/QtGui/qpixmap_conversion.h b/PySide/QtGui/qpixmap_conversion.h
index ba21e08..f6a2e58 100644
--- a/PySide/QtGui/qpixmap_conversion.h
+++ b/PySide/QtGui/qpixmap_conversion.h
@@ -8,15 +8,15 @@ inline bool Converter<QPixmap>::isConvertible(PyObject* pyobj)
{
if (ValueTypeConverter<QPixmap>::isConvertible(pyobj))
return true;
- SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType<QPixmap>());
+ SbkBaseType* shiboType = reinterpret_cast<SbkBaseType*>(SbkType<QPixmap>());
bool isVariant = Converter<QVariant>::checkType(pyobj);
if (isVariant) {
QVariant var(Converter<QVariant>::toCpp(pyobj));
return var.type() == QVariant::Pixmap;
} else if (Converter<QSize>::checkType(pyobj) || Converter<QString>::checkType(pyobj)) {
return true;
- } else if (shiboType->ext_isconvertible) {
- return shiboType->ext_isconvertible(pyobj);
+ } else {
+ return Shiboken::BaseType::isExternalConvertible(shiboType, pyobj);
}
return false;
@@ -24,7 +24,7 @@ inline bool Converter<QPixmap>::isConvertible(PyObject* pyobj)
inline QPixmap Converter<QPixmap>::toCpp(PyObject* pyobj)
{
- SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType<QPixmap>());
+ SbkBaseType* shiboType = reinterpret_cast<SbkBaseType*>(SbkType<QPixmap>());
bool isVariant = Converter<QVariant>::checkType(pyobj);
if (isVariant) {
QVariant var(Converter<QVariant>::toCpp(pyobj));
@@ -33,8 +33,8 @@ inline QPixmap Converter<QPixmap>::toCpp(PyObject* pyobj)
return QPixmap(Shiboken::Converter<QSize >::toCpp(pyobj));
} else if (Converter<QString>::checkType(pyobj)) {
return QPixmap(Shiboken::Converter<QString >::toCpp(pyobj));
- } else if (shiboType->ext_isconvertible && shiboType->ext_tocpp && shiboType->ext_isconvertible(pyobj)) {
- QPixmap* cptr = reinterpret_cast<QPixmap*>(shiboType->ext_tocpp(pyobj));
+ } else if (Shiboken::BaseType::isExternalConvertible(shiboType, pyobj) && Shiboken::BaseType::hasExternalCppConversions(shiboType)) {
+ QPixmap* cptr = reinterpret_cast<QPixmap*>(Shiboken::BaseType::callExternalCppConversion(shiboType, pyobj));
std::auto_ptr<QPixmap> cptr_auto_ptr(cptr);
return *cptr;
}
diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml
index ca7bc27..d9f7574 100644
--- a/PySide/QtGui/typesystem_gui_common.xml
+++ b/PySide/QtGui/typesystem_gui_common.xml
@@ -3317,7 +3317,7 @@
<modify-function signature="setStyle(QStyle*)">
<inject-code class="target" position="end">
- Shiboken::keepReference(reinterpret_cast&lt;SbkObject*&gt;(%PYSELF), "__style__", %PYARG_1);
+ Shiboken::Wrapper::keepReference(reinterpret_cast&lt;SbkObject*&gt;(%PYSELF), "__style__", %PYARG_1);
</inject-code>
</modify-function>
<modify-function signature="style()const">
@@ -3331,7 +3331,7 @@
Shiboken::Wrapper::setParent(pyApp, %PYARG_0);
Shiboken::Wrapper::releaseOwnership(%PYARG_0);
} else {
- Shiboken::keepReference(reinterpret_cast&lt;SbkObject*&gt;(%PYSELF), "__style__", %PYARG_0);
+ Shiboken::Wrapper::keepReference(reinterpret_cast&lt;SbkObject*&gt;(%PYSELF), "__style__", %PYARG_0);
}
}
</inject-code>
diff --git a/libpyside/pysideconversions.h b/libpyside/pysideconversions.h
index e8c70dc..dfc0646 100644
--- a/libpyside/pysideconversions.h
+++ b/libpyside/pysideconversions.h
@@ -40,7 +40,7 @@ struct QtDictConverter
if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<QtDict>()))
return true;
- if ((Shiboken::SbkType<QtDict>() && Shiboken::isShibokenType(pyObj)) || !PyDict_Check(pyObj))
+ if ((Shiboken::SbkType<QtDict>() && Shiboken::Wrapper::checkType(pyObj)) || !PyDict_Check(pyObj))
return false;
PyObject* key;
@@ -100,7 +100,7 @@ struct QtMultiMapConverter
if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<MultiMap>()))
return true;
- if ((Shiboken::SbkType<MultiMap>() && Shiboken::isShibokenType(pyObj)) || !PyDict_Check(pyObj))
+ if ((Shiboken::SbkType<MultiMap>() && Shiboken::Wrapper::checkType(pyObj)) || !PyDict_Check(pyObj))
return false;
PyObject* key;
@@ -176,7 +176,7 @@ struct QSequenceConverter
{
if (PyObject_TypeCheck(pyObj, Shiboken::SbkType<T>()))
return true;
- if ((Shiboken::SbkType<T>() && Shiboken::isShibokenType(pyObj)) || !PySequence_Check(pyObj))
+ if ((Shiboken::SbkType<T>() && Shiboken::Wrapper::checkType(pyObj)) || !PySequence_Check(pyObj))
return false;
for (int i = 0, max = PySequence_Length(pyObj); i < max; ++i) {
Shiboken::AutoDecRef item(PySequence_GetItem(pyObj, i));
diff --git a/libpyside/pysidesignal.cpp b/libpyside/pysidesignal.cpp
index 81d23dd..51e3bba 100644
--- a/libpyside/pysidesignal.cpp
+++ b/libpyside/pysidesignal.cpp
@@ -493,10 +493,9 @@ char* getTypeName(PyObject* type)
{
if (PyType_Check(type)) {
char *typeName = NULL;
- if (type->ob_type == &SbkObjectType_Type) {
- SbkObjectType* objType = reinterpret_cast<SbkObjectType*>(type);
- Q_ASSERT(objType->original_name);
- typeName = strdup(objType->original_name);
+ if (type->ob_type == &SbkBaseType_Type) {
+ SbkBaseType* objType = reinterpret_cast<SbkBaseType*>(type);
+ typeName = strdup(Shiboken::BaseType::getOriginalName(objType));
} else {
// Translate python types to Qt names
PyTypeObject *objType = reinterpret_cast<PyTypeObject*>(type);
@@ -670,7 +669,7 @@ PyObject* buildQtCompatible(const char* signature)
return ret;
}
-void addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal)
+void addSignalToWrapper(SbkBaseType* wrapperType, const char* signalName, PySideSignal* signal)
{
PyObject* typeDict = wrapperType->super.ht_type.tp_dict;
PyObject* homonymousMethod;
diff --git a/libpyside/pysidesignal.h b/libpyside/pysidesignal.h
index cc4a862..e578ae7 100644
--- a/libpyside/pysidesignal.h
+++ b/libpyside/pysidesignal.h
@@ -29,8 +29,7 @@
#include <pysidemacros.h>
#include <Python.h>
-
-struct SbkObjectType;
+#include <basewrapper.h>
extern "C"
{
@@ -108,7 +107,7 @@ PYSIDE_API void updateSourceObject(PyObject* source);
* @param self The Signal object
* @return Return the signal signature
**/
-PYSIDE_API void addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal);
+PYSIDE_API void addSignalToWrapper(SbkBaseType* wrapperType, const char* signalName, PySideSignal* signal);
/**
* This function verify if the signature is a QtSignal base on SIGNAL flag