From 92dcb7ae3a92416b4129d549625eba0512e02426 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 10 Nov 2010 17:22:32 -0200 Subject: Changes needed to compile QtCore with libshiboken v1.0 --- PySide/QtCore/glue/qbytearray_bufferprotocol.cpp | 2 +- PySide/QtCore/glue/qcoreapplication_init.cpp | 21 +++++++++++---------- PySide/QtCore/glue/qobject_connect.cpp | 4 ++-- PySide/QtCore/qvariant_conversions.h | 6 +++--- PySide/QtCore/qvariant_type_conversions.h | 4 ++-- PySide/QtCore/typesystem_core.xml | 10 +++++----- 6 files changed, 24 insertions(+), 23 deletions(-) (limited to 'PySide/QtCore') diff --git a/PySide/QtCore/glue/qbytearray_bufferprotocol.cpp b/PySide/QtCore/glue/qbytearray_bufferprotocol.cpp index 4fd158789..19ee4e7b6 100644 --- a/PySide/QtCore/glue/qbytearray_bufferprotocol.cpp +++ b/PySide/QtCore/glue/qbytearray_bufferprotocol.cpp @@ -15,7 +15,7 @@ static Py_ssize_t SbkQByteArray_segcountproc(PyObject* self, Py_ssize_t* lenp) static Py_ssize_t SbkQByteArray_readbufferproc(PyObject* self, Py_ssize_t segment, void** ptrptr) { - if (segment || Shiboken::cppObjectIsInvalid(self)) + if (segment || !Shiboken::Wrapper::isValid(self)) return -1; QByteArray* cppSelf = Converter::toCpp(self); diff --git a/PySide/QtCore/glue/qcoreapplication_init.cpp b/PySide/QtCore/glue/qcoreapplication_init.cpp index 8ae53f341..274afb6d3 100644 --- a/PySide/QtCore/glue/qcoreapplication_init.cpp +++ b/PySide/QtCore/glue/qcoreapplication_init.cpp @@ -2,7 +2,7 @@ static int QCoreApplicationArgCount; static char** QCoreApplicationArgValues; -int SbkQCoreApplication_Init(PyObject* self, PyObject* args, PyObject*) +int Sbk_QCoreApplication_Init(PyObject* self, PyObject* args, PyObject*) { if (Shiboken::isUserType(self) && !Shiboken::canCallConstructor(self->ob_type, Shiboken::SbkType())) return -1; @@ -19,20 +19,21 @@ int SbkQCoreApplication_Init(PyObject* self, PyObject* args, PyObject*) return -1; } - if (!PySequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QCoreApplicationArgCount, &QCoreApplicationArgValues, "PySideApp")) { + if (!Shiboken::sequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QCoreApplicationArgCount, &QCoreApplicationArgValues, "PySideApp")) { PyErr_BadArgument(); return -1; } + SbkObject* sbkSelf = reinterpret_cast(self); QCoreApplicationWrapper* cptr = new QCoreApplicationWrapper(QCoreApplicationArgCount, QCoreApplicationArgValues); - Shiboken::setCppPointer(reinterpret_cast(self), - Shiboken::SbkType(), - cptr); - - SbkBaseWrapper_setValidCppObject(self, 1); - SbkBaseWrapper *sbkSelf = reinterpret_cast(self); - sbkSelf->containsCppWrapper = 1; - sbkSelf->hasOwnership = 0; + Shiboken::Wrapper::setCppPointer(sbkSelf, + Shiboken::SbkType(), + cptr); + + Shiboken::Wrapper::setValidCpp(sbkSelf, true); + Shiboken::Wrapper::setHasCppWrapper(sbkSelf, true); + Shiboken::Wrapper::releaseOwnership(sbkSelf); + Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr); PySide::Signal::updateSourceObject(self); cptr->metaObject(); diff --git a/PySide/QtCore/glue/qobject_connect.cpp b/PySide/QtCore/glue/qobject_connect.cpp index 770265557..dea4440a5 100644 --- a/PySide/QtCore/glue/qobject_connect.cpp +++ b/PySide/QtCore/glue/qobject_connect.cpp @@ -1,4 +1,4 @@ -static bool getReceiver(PyObject *callback, QObject **receiver, PyObject **self) +static bool getReceiver(PyObject* callback, QObject** receiver, PyObject** self) { if (PyMethod_Check(callback)) { *self = PyMethod_GET_SELF(callback); @@ -66,7 +66,7 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject const char* slot = callbackSig.constData(); int slotIndex = metaObject->indexOfSlot(slot); if (slotIndex == -1) { - if (!usingGlobalReceiver && self && !((SbkBaseWrapper*)self)->containsCppWrapper) { + if (!usingGlobalReceiver && self && !Shiboken::Wrapper::hasCppWrapper((SbkObject*)self)) { qWarning() << "You can't add dynamic slots on an object originated from C++."; return false; } diff --git a/PySide/QtCore/qvariant_conversions.h b/PySide/QtCore/qvariant_conversions.h index b47e3892d..6c7ebd7f4 100644 --- a/PySide/QtCore/qvariant_conversions.h +++ b/PySide/QtCore/qvariant_conversions.h @@ -16,8 +16,8 @@ struct Converter static QByteArray resolveMetaType(PyTypeObject* type, int &typeId) { - if (PyObject_TypeCheck(type, &Shiboken::SbkBaseWrapperType_Type)) { - Shiboken::SbkBaseWrapperType *sbkType = reinterpret_cast(type); + if (PyObject_TypeCheck(type, &SbkObjectType_Type)) { + SbkObjectType* sbkType = reinterpret_cast(type); const char* typeName = sbkType->original_name; int obTypeId = QMetaType::type(typeName); @@ -82,7 +82,7 @@ struct Converter } else { // a class supported by QVariant? if (Shiboken::isShibokenType(pyObj) && !Shiboken::isUserType(pyObj)) { - Shiboken::SbkBaseWrapperType *objType = reinterpret_cast(pyObj->ob_type); + SbkObjectType* objType = reinterpret_cast(pyObj->ob_type); int typeCode = 0; QByteArray typeName = resolveMetaType(reinterpret_cast(objType), typeCode); if (typeCode) { diff --git a/PySide/QtCore/qvariant_type_conversions.h b/PySide/QtCore/qvariant_type_conversions.h index e5384cd8b..4ec47653f 100644 --- a/PySide/QtCore/qvariant_type_conversions.h +++ b/PySide/QtCore/qvariant_type_conversions.h @@ -26,8 +26,8 @@ struct Converter else if (pyObj == reinterpret_cast(&PyLong_Type)) typeName = "int"; // long is a UserType in QVariant. else if (PyType_Check(pyObj)) { - if (pyObj->ob_type == &Shiboken::SbkBaseWrapperType_Type) - typeName = reinterpret_cast(pyObj)->original_name; + if (pyObj->ob_type == &SbkObjectType_Type) + typeName = reinterpret_cast(pyObj)->original_name; else typeName = reinterpret_cast(pyObj)->tp_name; } diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 366fd9c4a..f5216073f 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1061,7 +1061,7 @@ PyObject* args = Py_BuildValue("(iiO)", _i, 1, _value); - PyObject* result = SbkQBitArrayFunc_setBit(self, args); + PyObject* result = Sbk_QBitArrayFunc_setBit(self, args); Py_DECREF(args); Py_XDECREF(result); return !result ? -1 : 0; @@ -1700,7 +1700,7 @@ %CPPSELF.remove(_i, 1); PyObject* args = Py_BuildValue("(nO)", _i, _value); - PyObject* result = SbkQByteArrayFunc_insert(self, args); + PyObject* result = Sbk_QByteArrayFunc_insert(self, args); Py_DECREF(args); Py_XDECREF(result); return !result ? -1 : 0; @@ -1940,7 +1940,7 @@ %3) ); // invalidate to avoid use of python object - Shiboken::BindingManager::instance().destroyWrapper((Shiboken::SbkBaseWrapper *)pyTimer); + Shiboken::BindingManager::instance().destroyWrapper((SbkObject*)pyTimer); timer->setSingleShot(true); timer->connect(timer, SIGNAL("timeout()"), timer, SLOT("deleteLater()")); timer->start(%1); @@ -1978,7 +1978,7 @@ pyargs[1]) ); } - Shiboken::BindingManager::instance().destroyWrapper((Shiboken::SbkBaseWrapper *)pyTimer); + Shiboken::BindingManager::instance().destroyWrapper((SbkObject*)pyTimer); timer->start(%1); @@ -2680,7 +2680,7 @@ // Check bug #362 for more information on this // http://bugs.openbossa.org/show_bug.cgi?id=362 if (!PyObject_TypeCheck(%1, &PySideSignalInstanceType)) - goto Sbk%TYPEFunc_%FUNCTION_NAME_TypeError; + goto Sbk_%TYPEFunc_%FUNCTION_NAME_TypeError; PySideSignalInstance* signalInstance = reinterpret_cast<PySideSignalInstance*>(%1); QObject* sender = %CONVERTTOCPP[QObject*](PySide::Signal::getObject(signalInstance)); %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%CPPSELF->%FUNCTION_NAME(sender, PySide::Signal::getSignature(signalInstance), %2)); -- cgit v1.2.3