aboutsummaryrefslogtreecommitdiffstats
path: root/PySide
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-11-10 17:22:32 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2010-11-10 17:22:32 -0200
commit92dcb7ae3a92416b4129d549625eba0512e02426 (patch)
tree37d070b8a62502ec8a055d70b7c9d5a7453e179e /PySide
parent66ff08586178ffb601fe874d48b9847fb577f513 (diff)
Changes needed to compile QtCore with libshiboken v1.0
Diffstat (limited to 'PySide')
-rw-r--r--PySide/QtCore/glue/qbytearray_bufferprotocol.cpp2
-rw-r--r--PySide/QtCore/glue/qcoreapplication_init.cpp21
-rw-r--r--PySide/QtCore/glue/qobject_connect.cpp4
-rw-r--r--PySide/QtCore/qvariant_conversions.h6
-rw-r--r--PySide/QtCore/qvariant_type_conversions.h4
-rw-r--r--PySide/QtCore/typesystem_core.xml10
6 files changed, 24 insertions, 23 deletions
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<QByteArray*>::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<QApplication >()))
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<SbkObject*>(self);
QCoreApplicationWrapper* cptr = new QCoreApplicationWrapper(QCoreApplicationArgCount, QCoreApplicationArgValues);
- Shiboken::setCppPointer(reinterpret_cast<SbkBaseWrapper*>(self),
- Shiboken::SbkType<QCoreApplication>(),
- cptr);
-
- SbkBaseWrapper_setValidCppObject(self, 1);
- SbkBaseWrapper *sbkSelf = reinterpret_cast<SbkBaseWrapper*>(self);
- sbkSelf->containsCppWrapper = 1;
- sbkSelf->hasOwnership = 0;
+ Shiboken::Wrapper::setCppPointer(sbkSelf,
+ Shiboken::SbkType<QCoreApplication>(),
+ 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<QVariant>
static QByteArray resolveMetaType(PyTypeObject* type, int &typeId)
{
- if (PyObject_TypeCheck(type, &Shiboken::SbkBaseWrapperType_Type)) {
- Shiboken::SbkBaseWrapperType *sbkType = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(type);
+ if (PyObject_TypeCheck(type, &SbkObjectType_Type)) {
+ SbkObjectType* sbkType = reinterpret_cast<SbkObjectType*>(type);
const char* typeName = sbkType->original_name;
int obTypeId = QMetaType::type(typeName);
@@ -82,7 +82,7 @@ struct Converter<QVariant>
} else {
// a class supported by QVariant?
if (Shiboken::isShibokenType(pyObj) && !Shiboken::isUserType(pyObj)) {
- Shiboken::SbkBaseWrapperType *objType = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(pyObj->ob_type);
+ SbkObjectType* objType = reinterpret_cast<SbkObjectType*>(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 e5384cd8b..4ec47653f 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 == &Shiboken::SbkBaseWrapperType_Type)
- typeName = reinterpret_cast<Shiboken::SbkBaseWrapperType*>(pyObj)->original_name;
+ if (pyObj->ob_type == &SbkObjectType_Type)
+ typeName = reinterpret_cast<SbkObjectType*>(pyObj)->original_name;
else
typeName = reinterpret_cast<PyTypeObject*>(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 @@
<add-function signature="__setitem__">
<inject-code class="target" position="beginning">
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 @@
<inject-code class="target" position="beginning">
%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);
</inject-code>
</add-function>
@@ -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, &amp;PySideSignalInstanceType))
- goto Sbk%TYPEFunc_%FUNCTION_NAME_TypeError;
+ goto Sbk_%TYPEFunc_%FUNCTION_NAME_TypeError;
PySideSignalInstance* signalInstance = reinterpret_cast&lt;PySideSignalInstance*&gt;(%1);
QObject* sender = %CONVERTTOCPP[QObject*](PySide::Signal::getObject(signalInstance));
%PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%CPPSELF->%FUNCTION_NAME(sender, PySide::Signal::getSignature(signalInstance), %2));