aboutsummaryrefslogtreecommitdiffstats
path: root/libpyside
diff options
context:
space:
mode:
authorrenatofilho <renato.filho@openbossa.org>2010-10-29 16:21:50 -0300
committerrenatofilho <renato.filho@openbossa.org>2010-11-03 10:28:15 -0300
commitc7945787c556d2e3e40a1b9ef93147c640ee8ff6 (patch)
tree96ac95001401d2c300f4833b3dfd2b9855578260 /libpyside
parent62fd909705a4bf99590346712b040f7b40c9bb74 (diff)
Created Singal/Slot/Property namespace for pure C structures.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Lauro Neto <lauro.neto@openbossa.org>
Diffstat (limited to 'libpyside')
-rw-r--r--libpyside/dynamicqmetaobject.cpp32
-rw-r--r--libpyside/dynamicqmetaobject_p.h6
-rw-r--r--libpyside/pyside.cpp12
-rw-r--r--libpyside/qproperty.cpp64
-rw-r--r--libpyside/qproperty.h24
-rw-r--r--libpyside/qproperty_p.h30
-rw-r--r--libpyside/qsignal.cpp172
-rw-r--r--libpyside/qsignal.h79
-rw-r--r--libpyside/qsignal_p.h21
-rw-r--r--libpyside/qslot.cpp18
-rw-r--r--libpyside/qslot_p.h7
-rw-r--r--libpyside/signalmanager.cpp10
12 files changed, 263 insertions, 212 deletions
diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp
index a16a35469..03153b320 100644
--- a/libpyside/dynamicqmetaobject.cpp
+++ b/libpyside/dynamicqmetaobject.cpp
@@ -161,39 +161,39 @@ uint PropertyData::flags() const
else if (!isQRealType(typeName))
flags |= qvariant_nameToType(typeName) << 24;
- if (qpropertyIsReadable(m_data))
+ if (PySide::Property::isReadable(m_data))
flags |= Readable;
- if (qpropertyIsWritable(m_data))
+ if (PySide::Property::isWritable(m_data))
flags |= Writable;
- if (qpropertyHasReset(m_data))
+ if (PySide::Property::hasReset(m_data))
flags |= Resettable;
- if (!qpropertyIsDesignable(m_data))
+ if (!PySide::Property::isDesignable(m_data))
flags |= ResolveDesignable;
else
flags |= Designable;
- if (!qpropertyIsScriptable(m_data))
+ if (!PySide::Property::isScriptable(m_data))
flags |= ResolveScriptable;
else
flags |= Scriptable;
- if (!qpropertyIsStored(m_data))
+ if (!PySide::Property::isStored(m_data))
flags |= ResolveStored;
else
flags |= Stored;
- if (!qpropertyIsUser(m_data))
+ if (!PySide::Property::isUser(m_data))
flags |= ResolveUser;
else
flags |= User;
- if (qpropertyIsConstant(m_data))
+ if (PySide::Property::isConstant(m_data))
flags |= Constant;
- if (qpropertyIsFinal(m_data))
+ if (PySide::Property::isFinal(m_data))
flags |= Final;
if (m_notifyId)
@@ -253,14 +253,14 @@ PropertyData::PropertyData()
{
}
-PropertyData::PropertyData(const char* name, uint notifyId, PySideQProperty* data)
+PropertyData::PropertyData(const char* name, uint notifyId, PySideProperty* data)
: m_name(name), m_notifyId(notifyId), m_data(data)
{
}
QByteArray PropertyData::type() const
{
- return QByteArray(qpropertyGetType(m_data));
+ return QByteArray(PySide::Property::getTypeName(m_data));
}
@@ -374,8 +374,8 @@ void DynamicQMetaObject::addProperty(const char* propertyName, PyObject* data)
return;
// retrieve notifyId
- PySideQProperty* property = reinterpret_cast<PySideQProperty*>(data);
- const char* signalNotify = qpropertyGetNotify(property);
+ PySideProperty* property = reinterpret_cast<PySideProperty*>(data);
+ const char* signalNotify = PySide::Property::getNotifyName(property);
uint notifyId = 0;
if (signalNotify) {
QByteArray signalSignature(signalNotify);
@@ -409,18 +409,18 @@ DynamicQMetaObject* DynamicQMetaObject::createBasedOn(PyObject* pyObj, PyTypeObj
while (PyDict_Next(type->tp_dict, &pos, &key, &value)) {
//Leave the properties to be register after signals because of notify object
- if (value->ob_type == &PySideQPropertyType)
+ if (value->ob_type == &PySidePropertyType)
properties.append(key);
//Register signals
if (value->ob_type == &PySideSignalType) {
PyObject *attr = PyObject_GetAttr(pyObj, key);
- PySideSignalInstanceData *data = reinterpret_cast<PySideSignalInstanceData*>(attr);
+ PySideSignalInstance *data = reinterpret_cast<PySideSignalInstance*>(attr);
while(data) {
int index = base->indexOfSignal(data->d->signature);
if (index == -1)
mo->addSignal(data->d->signature);
- data = reinterpret_cast<PySideSignalInstanceData*>(data->d->next);
+ data = reinterpret_cast<PySideSignalInstance*>(data->d->next);
}
}
diff --git a/libpyside/dynamicqmetaobject_p.h b/libpyside/dynamicqmetaobject_p.h
index 195209d24..d2717524e 100644
--- a/libpyside/dynamicqmetaobject_p.h
+++ b/libpyside/dynamicqmetaobject_p.h
@@ -29,7 +29,7 @@
#define PYSIDE_SLOT_LIST_ATTR "_slots"
-struct PySideQProperty;
+struct PySideProperty;
namespace PySide
{
class MethodData
@@ -54,7 +54,7 @@ namespace PySide
{
public:
PropertyData();
- PropertyData(const char* name, uint notifyId=0, PySideQProperty* data = 0);
+ PropertyData(const char* name, uint notifyId=0, PySideProperty* data = 0);
QByteArray name() const;
QByteArray type() const;
uint flags() const;
@@ -66,7 +66,7 @@ namespace PySide
private:
QByteArray m_name;
uint m_notifyId;
- PySideQProperty* m_data;
+ PySideProperty* m_data;
};
}
diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp
index c2e14350b..086bdad2c 100644
--- a/libpyside/pyside.cpp
+++ b/libpyside/pyside.cpp
@@ -43,9 +43,9 @@ namespace PySide
void init(PyObject *module)
{
- initSignalSupport(module);
- initSlotSupport(module);
- initQProperty(module);
+ Signal::init(module);
+ Slot::init(module);
+ Property::init(module);
// Init signal manager, so it will register some meta types used by QVariant.
SignalManager::instance();
}
@@ -69,14 +69,14 @@ bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds
Shiboken::AutoDecRef retval(PyObject_CallObject(propSetter, args));
} else {
PyObject* attr = PyObject_GenericGetAttr(qObj, key);
- if (isQPropertyType(attr))
- PySide::qpropertySet(reinterpret_cast<PySideQProperty*>(attr), qObj, value);
+ if (PySide::Property::isPropertyType(attr))
+ PySide::Property::setValue(reinterpret_cast<PySideProperty*>(attr), qObj, value);
}
} else {
propName.append("()");
if (metaObj->indexOfSignal(propName) != -1) {
propName.prepend('2');
- PySide::signalConnect(qObj, propName, value);
+ PySide::Signal::connect(qObj, propName, value);
} else {
PyErr_Format(PyExc_AttributeError, "'%s' is not a Qt property or a signal", propName.constData());
return false;
diff --git a/libpyside/qproperty.cpp b/libpyside/qproperty.cpp
index 4c9eb93c6..098080833 100644
--- a/libpyside/qproperty.cpp
+++ b/libpyside/qproperty.cpp
@@ -35,7 +35,7 @@
extern "C"
{
-struct PySideQPropertyPrivate {
+struct PySidePropertyPrivate {
char* typeName;
PyObject* type;
PyObject* fget;
@@ -56,11 +56,11 @@ struct PySideQPropertyPrivate {
static int qpropertyTpInit(PyObject*, PyObject*, PyObject*);
static void qpropertyFree(void*);
-PyTypeObject PySideQPropertyType = {
+PyTypeObject PySidePropertyType = {
PyObject_HEAD_INIT(0)
0, /*ob_size*/
QPROPERTY_CLASS_NAME, /*tp_name*/
- sizeof(PySideQProperty), /*tp_basicsize*/
+ sizeof(PySideProperty), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
0, /*tp_print*/
@@ -109,8 +109,8 @@ PyTypeObject PySideQPropertyType = {
int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
{
PyObject* type = 0;
- PySideQProperty* data = reinterpret_cast<PySideQProperty*>(self);
- PySideQPropertyPrivate* pData = (PySideQPropertyPrivate*) malloc(sizeof(PySideQPropertyPrivate));
+ PySideProperty* data = reinterpret_cast<PySideProperty*>(self);
+ PySidePropertyPrivate* pData = (PySidePropertyPrivate*) malloc(sizeof(PySidePropertyPrivate));
data->d = pData;
pData->fset = 0;
pData->fget = 0;
@@ -139,14 +139,14 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
if (!pData->fset && pData->fget)
pData->constant = true;
- pData->typeName = PySide::getTypeName(type);
+ pData->typeName = PySide::Signal::getTypeName(type);
return 1;
}
void qpropertyFree(void *self)
{
PyObject *pySelf = reinterpret_cast<PyObject*>(self);
- PySideQProperty *data = reinterpret_cast<PySideQProperty*>(self);
+ PySideProperty *data = reinterpret_cast<PySideProperty*>(self);
free(data->d->typeName);
free(data->d->doc);
@@ -159,27 +159,26 @@ void qpropertyFree(void *self)
} // extern "C"
-namespace PySide
-{
+namespace PySide { namespace Property {
-void initQProperty(PyObject* module)
+void init(PyObject* module)
{
- if (PyType_Ready(&PySideQPropertyType) < 0)
+ if (PyType_Ready(&PySidePropertyType) < 0)
return;
- Py_INCREF(&PySideQPropertyType);
- PyModule_AddObject(module, QPROPERTY_CLASS_NAME, ((PyObject*)&PySideQPropertyType));
+ Py_INCREF(&PySidePropertyType);
+ PyModule_AddObject(module, QPROPERTY_CLASS_NAME, ((PyObject*)&PySidePropertyType));
}
-bool isQPropertyType(PyObject* pyObj)
+bool isPropertyType(PyObject* pyObj)
{
if (pyObj) {
- return pyObj->ob_type == &PySideQPropertyType;
+ return pyObj->ob_type == &PySidePropertyType;
}
return false;
}
-int qpropertySet(PySideQProperty* self, PyObject* source, PyObject* value)
+int setValue(PySideProperty* self, PyObject* source, PyObject* value)
{
PyObject* fset = self->d->fset;
if (fset) {
@@ -196,7 +195,7 @@ int qpropertySet(PySideQProperty* self, PyObject* source, PyObject* value)
return -1;
}
-PyObject* qpropertyGet(PySideQProperty* self, PyObject* source)
+PyObject* getValue(PySideProperty* self, PyObject* source)
{
PyObject* fget = self->d->fget;
if (fget) {
@@ -208,7 +207,7 @@ PyObject* qpropertyGet(PySideQProperty* self, PyObject* source)
return 0;
}
-int qpropertyReset(PySideQProperty* self, PyObject* source)
+int reset(PySideProperty* self, PyObject* source)
{
PyObject* freset = self->d->freset;
if (freset) {
@@ -222,16 +221,16 @@ int qpropertyReset(PySideQProperty* self, PyObject* source)
}
-const char* qpropertyGetType(PySideQProperty* self)
+const char* getTypeName(const PySideProperty* self)
{
return self->d->typeName;
}
-PySideQProperty* qpropertyGetObject(PyObject* source, PyObject* name)
+PySideProperty* getObject(PyObject* source, PyObject* name)
{
PyObject* attr = PyObject_GenericGetAttr(source, name);
- if (attr && isQPropertyType(attr))
- return reinterpret_cast<PySideQProperty*>(attr);
+ if (attr && isPropertyType(attr))
+ return reinterpret_cast<PySideProperty*>(attr);
if (!attr)
PyErr_Clear(); //Clear possible error caused by PyObject_GenericGetAttr
@@ -240,52 +239,52 @@ PySideQProperty* qpropertyGetObject(PyObject* source, PyObject* name)
return 0;
}
-bool qpropertyIsReadable(PySideQProperty* self)
+bool isReadable(const PySideProperty* self)
{
return (self->d->fget != 0);
}
-bool qpropertyIsWritable(PySideQProperty* self)
+bool isWritable(const PySideProperty* self)
{
return (self->d->fset != 0);
}
-bool qpropertyHasReset(PySideQProperty* self)
+bool hasReset(const PySideProperty* self)
{
return (self->d->freset != 0);
}
-bool qpropertyIsDesignable(PySideQProperty* self)
+bool isDesignable(const PySideProperty* self)
{
return self->d->designable;
}
-bool qpropertyIsScriptable(PySideQProperty* self)
+bool isScriptable(const PySideProperty* self)
{
return self->d->scriptable;
}
-bool qpropertyIsStored(PySideQProperty* self)
+bool isStored(const PySideProperty* self)
{
return self->d->stored;
}
-bool qpropertyIsUser(PySideQProperty* self)
+bool isUser(const PySideProperty* self)
{
return self->d->user;
}
-bool qpropertyIsConstant(PySideQProperty* self)
+bool isConstant(const PySideProperty* self)
{
return self->d->constant;
}
-bool qpropertyIsFinal(PySideQProperty* self)
+bool isFinal(const PySideProperty* self)
{
return self->d->final;
}
-const char* qpropertyGetNotify(PySideQProperty* self)
+const char* getNotifyName(PySideProperty* self)
{
if (!self->d->notifySignature) {
PyObject* str = PyObject_Str(self->d->notify);
@@ -296,4 +295,5 @@ const char* qpropertyGetNotify(PySideQProperty* self)
return self->d->notifySignature;
}
+} //namespace Property
} //namespace PySide
diff --git a/libpyside/qproperty.h b/libpyside/qproperty.h
index ebe4ee762..f137e8076 100644
--- a/libpyside/qproperty.h
+++ b/libpyside/qproperty.h
@@ -29,22 +29,19 @@
extern "C"
{
- extern PYSIDE_API PyTypeObject PySideQPropertyType;
+ extern PYSIDE_API PyTypeObject PySidePropertyType;
- struct PySideQPropertyPrivate;
- struct PYSIDE_API PySideQProperty
+ struct PySidePropertyPrivate;
+ struct PYSIDE_API PySideProperty
{
PyObject_HEAD
- PySideQPropertyPrivate* d;
+ PySidePropertyPrivate* d;
};
-
- struct PySideSignalInstanceData;
};
-namespace PySide
-{
+namespace PySide { namespace Property {
-PYSIDE_API bool isQPropertyType(PyObject* pyObj);
+PYSIDE_API bool isPropertyType(PyObject* pyObj);
/**
* This function call set property function and pass value as arg
@@ -55,7 +52,7 @@ PYSIDE_API bool isQPropertyType(PyObject* pyObj);
* @param value The value to set in property
* @return Return 0 if ok or -1 if this function fail
**/
-PYSIDE_API int qpropertySet(PySideQProperty* self, PyObject* source, PyObject* value);
+PYSIDE_API int setValue(PySideProperty* self, PyObject* source, PyObject* value);
/**
* This function call get property function
@@ -65,7 +62,7 @@ PYSIDE_API int qpropertySet(PySideQProperty* self, PyObject* source, PyObject* v
* @param source The QObject witch has the property
* @return Return the result of property get function or 0 if this fail
**/
-PYSIDE_API PyObject* qpropertyGet(PySideQProperty* self, PyObject* source);
+PYSIDE_API PyObject* getValue(PySideProperty* self, PyObject* source);
/**
* This function return the notify name used on this property
@@ -73,7 +70,7 @@ PYSIDE_API PyObject* qpropertyGet(PySideQProperty* self, PyObject* source);
* @param self The property object
* @return Return a const char with the notify name used
**/
-PYSIDE_API const char* qpropertyGetNotify(PySideQProperty* self);
+PYSIDE_API const char* getNotifyName(PySideProperty* self);
/**
@@ -83,8 +80,9 @@ PYSIDE_API const char* qpropertyGetNotify(PySideQProperty* self);
* @param name The property name
* @return Return a new reference to property object
**/
-PYSIDE_API PySideQProperty* qpropertyGetObject(PyObject* source, PyObject* name);
+PYSIDE_API PySideProperty* getObject(PyObject* source, PyObject* name);
+} //namespace Property
} //namespace PySide
#endif
diff --git a/libpyside/qproperty_p.h b/libpyside/qproperty_p.h
index d23a02c37..1ba9cb2be 100644
--- a/libpyside/qproperty_p.h
+++ b/libpyside/qproperty_p.h
@@ -25,15 +25,14 @@
#include <Python.h>
-struct PySideQProperty;
+struct PySideProperty;
-namespace PySide
-{
+namespace PySide { namespace Property {
/**
* Init PySide QProperty support system
*/
-void initQProperty(PyObject* module);
+void init(PyObject* module);
/**
* This function call reset property function
@@ -43,7 +42,7 @@ void initQProperty(PyObject* module);
* @param source The QObject witch has the property
* @return Return 0 if ok or -1 if this function fail
**/
-int qpropertyReset(PySideQProperty* self, PyObject* source);
+int reset(PySideProperty* self, PyObject* source);
/**
@@ -53,7 +52,7 @@ int qpropertyReset(PySideQProperty* self, PyObject* source);
* @param self The property object
* @return Return the property type name
**/
-const char* qpropertyGetType(PySideQProperty* self);
+const char* getTypeName(const PySideProperty* self);
/**
* This function check if property has read function
@@ -62,7 +61,7 @@ const char* qpropertyGetType(PySideQProperty* self);
* @param self The property object
* @return Return a boolean value
**/
-bool qpropertyIsReadable(PySideQProperty* self);
+bool isReadable(const PySideProperty* self);
/**
* This function check if property has write function
@@ -71,7 +70,7 @@ bool qpropertyIsReadable(PySideQProperty* self);
* @param self The property object
* @return Return a boolean value
**/
-bool qpropertyIsWritable(PySideQProperty* self);
+bool isWritable(const PySideProperty* self);
/**
* This function check if property has reset function
@@ -80,7 +79,7 @@ bool qpropertyIsWritable(PySideQProperty* self);
* @param self The property object
* @return Return a boolean value
**/
-bool qpropertyHasReset(PySideQProperty* self);
+bool hasReset(const PySideProperty* self);
/**
* This function check if property has the flag DESIGNABLE setted
@@ -89,7 +88,7 @@ bool qpropertyHasReset(PySideQProperty* self);
* @param self The property object
* @return Return a boolean value
**/
-bool qpropertyIsDesignable(PySideQProperty* self);
+bool isDesignable(const PySideProperty* self);
/**
* This function check if property has the flag SCRIPTABLE setted
@@ -98,7 +97,7 @@ bool qpropertyIsDesignable(PySideQProperty* self);
* @param self The property object
* @return Return a boolean value
**/
-bool qpropertyIsScriptable(PySideQProperty* self);
+bool isScriptable(const PySideProperty* self);
/**
* This function check if property has the flag STORED setted
@@ -107,7 +106,7 @@ bool qpropertyIsScriptable(PySideQProperty* self);
* @param self The property object
* @return Return a boolean value
**/
-bool qpropertyIsStored(PySideQProperty* self);
+bool isStored(const PySideProperty* self);
/**
* This function check if property has the flag USER setted
@@ -116,7 +115,7 @@ bool qpropertyIsStored(PySideQProperty* self);
* @param self The property object
* @return Return a boolean value
**/
-bool qpropertyIsUser(PySideQProperty* self);
+bool isUser(const PySideProperty* self);
/**
* This function check if property has the flag CONSTANT setted
@@ -125,7 +124,7 @@ bool qpropertyIsUser(PySideQProperty* self);
* @param self The property object
* @return Return a boolean value
**/
-bool qpropertyIsConstant(PySideQProperty* self);
+bool isConstant(const PySideProperty* self);
/**
* This function check if property has the flag FINAL setted
@@ -134,8 +133,9 @@ bool qpropertyIsConstant(PySideQProperty* self);
* @param self The property object
* @return Return a boolean value
**/
-bool qpropertyIsFinal(PySideQProperty* self);
+bool isFinal(const PySideProperty* self);
+} // namespace Property
} // namespace PySide
#endif
diff --git a/libpyside/qsignal.cpp b/libpyside/qsignal.cpp
index 9195e4a5c..332cc8224 100644
--- a/libpyside/qsignal.cpp
+++ b/libpyside/qsignal.cpp
@@ -31,16 +31,15 @@
#define SIGNAL_CLASS_NAME "Signal"
#define QT_SIGNAL_SENTINEL "2"
-struct SignalData;
-namespace PySide
-{
+namespace PySide { namespace Signal {
//aux
- static char* signalBuildSignature(const char*, const char*);
- static void signalAppendSignature(SignalData*, char*);
- static void signalInstanceInitialize(PySideSignalInstanceData*, PyObject*, SignalData*, PyObject *, int);
- static char* signalParseSignature(PyObject*);
- static PyObject* signalBuildQtCompatible(const char*);
+ static char* buildSignature(const char*, const char*);
+ static void appendSignature(PySideSignal*, char*);
+ static void instanceInitialize(PySideSignalInstance*, PyObject*, PySideSignal*, PyObject *, int);
+ static char* parseSignature(PyObject*);
+ static PyObject* buildQtCompatible(const char*);
+}
}
extern "C"
@@ -73,7 +72,7 @@ PyTypeObject PySideSignalType = {
PyObject_HEAD_INIT(0)
/*ob_size*/ 0,
/*tp_name*/ "PySide.QtCore."SIGNAL_CLASS_NAME,
- /*tp_basicsize*/ sizeof(SignalData),
+ /*tp_basicsize*/ sizeof(PySideSignal),
/*tp_itemsize*/ 0,
/*tp_dealloc*/ 0,
/*tp_print*/ 0,
@@ -136,7 +135,7 @@ PyTypeObject PySideSignalInstanceType = {
PyObject_HEAD_INIT(0)
/*ob_size*/ 0,
/*tp_name*/ "PySide.QtCore."SIGNAL_CLASS_NAME,
- /*tp_basicsize*/ sizeof(PySideSignalInstanceData),
+ /*tp_basicsize*/ sizeof(PySideSignalInstance),
/*tp_itemsize*/ 0,
/*tp_dealloc*/ 0,
/*tp_print*/ 0,
@@ -196,7 +195,7 @@ int signalTpInit(PyObject* self, PyObject* args, PyObject* kwds)
return 0;
bool tupledArgs = false;
- SignalData *data = reinterpret_cast<SignalData*>(self);
+ PySideSignal *data = reinterpret_cast<PySideSignal*>(self);
if (argName) {
data->signalName = strdup(argName);
}
@@ -205,12 +204,12 @@ int signalTpInit(PyObject* self, PyObject* args, PyObject* kwds)
PyObject *arg = PyTuple_GET_ITEM(args, i);
if (PySequence_Check(arg) && !PyString_Check(arg)) {
tupledArgs = true;
- PySide::signalAppendSignature(data, PySide::signalParseSignature(arg));
+ PySide::Signal::appendSignature(data, PySide::Signal::parseSignature(arg));
}
}
if (!tupledArgs)
- PySide::signalAppendSignature(data, PySide::signalParseSignature(args));
+ PySide::Signal::appendSignature(data, PySide::Signal::parseSignature(args));
return 1;
}
@@ -218,7 +217,7 @@ int signalTpInit(PyObject* self, PyObject* args, PyObject* kwds)
void signalFree(void *self)
{
PyObject *pySelf = reinterpret_cast<PyObject*>(self);
- SignalData *data = reinterpret_cast<SignalData*>(self);
+ PySideSignal *data = reinterpret_cast<PySideSignal*>(self);
for(int i = 0, i_max = data->signaturesSize; i < i_max; i++) {
if (data->signatures[i])
@@ -237,17 +236,17 @@ void signalFree(void *self)
PyObject* signalGetItem(PyObject* self, PyObject* key)
{
- SignalData* data = reinterpret_cast<SignalData*>(self);
+ PySideSignal* data = reinterpret_cast<PySideSignal*>(self);
char* sigKey;
if (key) {
- sigKey = PySide::signalParseSignature(key);
+ sigKey = PySide::Signal::parseSignature(key);
} else {
if (data->signatures[0])
sigKey = strdup(data->signatures[0]);
else
sigKey = strdup("void");
}
- char* sig = PySide::signalBuildSignature(data->signalName, sigKey);
+ char* sig = PySide::Signal::buildSignature(data->signalName, sigKey);
free(sigKey);
PyObject* pySignature = PyString_FromString(sig);
free(sig);
@@ -263,9 +262,9 @@ PyObject* signalToString(PyObject* self)
void signalInstanceFree(void* self)
{
PyObject* pySelf = reinterpret_cast<PyObject*>(self);
- PySideSignalInstanceData* data = reinterpret_cast<PySideSignalInstanceData*>(self);
+ PySideSignalInstance* data = reinterpret_cast<PySideSignalInstance*>(self);
- PySideSignalInstanceDataPrivate* dataPvt = data->d;
+ PySideSignalInstancePrivate* dataPvt = data->d;
free(dataPvt->signalName);
free(dataPvt->signature);
@@ -290,37 +289,37 @@ PyObject* signalInstanceConnect(PyObject* self, PyObject* args, PyObject* kwds)
"O|O:"SIGNAL_CLASS_NAME, (char**) kwlist, &slot, &type))
return 0;
- PySideSignalInstanceData *source = reinterpret_cast<PySideSignalInstanceData*>(self);
+ PySideSignalInstance *source = reinterpret_cast<PySideSignalInstance*>(self);
Shiboken::AutoDecRef pyArgs(PyList_New(0));
bool match = false;
if (slot->ob_type == &PySideSignalInstanceType) {
- PySideSignalInstanceData *sourceWalk = source;
- PySideSignalInstanceData *targetWalk;
+ PySideSignalInstance *sourceWalk = source;
+ PySideSignalInstance *targetWalk;
//find best match
while(sourceWalk && !match) {
- targetWalk = reinterpret_cast<PySideSignalInstanceData*>(slot);
+ targetWalk = reinterpret_cast<PySideSignalInstance*>(slot);
while(targetWalk && !match) {
if (QMetaObject::checkConnectArgs(sourceWalk->d->signature, targetWalk->d->signature)) {
PyList_Append(pyArgs, sourceWalk->d->source);
- Shiboken::AutoDecRef sourceSignature(PySide::signalBuildQtCompatible(sourceWalk->d->signature));
+ Shiboken::AutoDecRef sourceSignature(PySide::Signal::buildQtCompatible(sourceWalk->d->signature));
PyList_Append(pyArgs, sourceSignature);
PyList_Append(pyArgs, targetWalk->d->source);
- Shiboken::AutoDecRef targetSignature(PySide::signalBuildQtCompatible(targetWalk->d->signature));
+ Shiboken::AutoDecRef targetSignature(PySide::Signal::buildQtCompatible(targetWalk->d->signature));
PyList_Append(pyArgs, targetSignature);
match = true;
}
- targetWalk = reinterpret_cast<PySideSignalInstanceData*>(targetWalk->d->next);
+ targetWalk = reinterpret_cast<PySideSignalInstance*>(targetWalk->d->next);
}
- sourceWalk = reinterpret_cast<PySideSignalInstanceData*>(sourceWalk->d->next);
+ sourceWalk = reinterpret_cast<PySideSignalInstance*>(sourceWalk->d->next);
}
} else {
//try the first signature
PyList_Append(pyArgs, source->d->source);
- Shiboken::AutoDecRef signature(PySide::signalBuildQtCompatible(source->d->signature));
+ Shiboken::AutoDecRef signature(PySide::Signal::buildQtCompatible(source->d->signature));
PyList_Append(pyArgs, signature);
PyList_Append(pyArgs, slot);
@@ -341,10 +340,10 @@ PyObject* signalInstanceConnect(PyObject* self, PyObject* args, PyObject* kwds)
PyObject* signalInstanceEmit(PyObject* self, PyObject* args)
{
- PySideSignalInstanceData *source = reinterpret_cast<PySideSignalInstanceData*>(self);
+ PySideSignalInstance *source = reinterpret_cast<PySideSignalInstance*>(self);
Shiboken::AutoDecRef pyArgs(PyList_New(0));
- Shiboken::AutoDecRef sourceSignature(PySide::signalBuildQtCompatible(source->d->signature));
+ Shiboken::AutoDecRef sourceSignature(PySide::Signal::buildQtCompatible(source->d->signature));
PyList_Append(pyArgs, sourceSignature);
for(Py_ssize_t i = 0, max = PyTuple_Size(args); i < max; i++)
@@ -358,9 +357,9 @@ PyObject* signalInstanceEmit(PyObject* self, PyObject* args)
PyObject* signalInstanceGetItem(PyObject* self, PyObject* key)
{
- PySideSignalInstanceData* data = reinterpret_cast<PySideSignalInstanceData*>(self);
- char* sigKey = PySide::signalParseSignature(key);
- char* sig = PySide::signalBuildSignature(data->d->signalName, sigKey);
+ PySideSignalInstance* data = reinterpret_cast<PySideSignalInstance*>(self);
+ char* sigKey = PySide::Signal::parseSignature(key);
+ char* sig = PySide::Signal::buildSignature(data->d->signalName, sigKey);
free(sigKey);
const char* sigName = data->d->signalName;
@@ -371,7 +370,7 @@ PyObject* signalInstanceGetItem(PyObject* self, PyObject* key)
Py_INCREF(result);
return result;
}
- data = reinterpret_cast<PySideSignalInstanceData*>(data->d->next);
+ data = reinterpret_cast<PySideSignalInstance*>(data->d->next);
}
PyErr_Format(PyExc_IndexError, "Signature %s not found for signal: %s", sig, sigName);
free(sig);
@@ -381,7 +380,7 @@ PyObject* signalInstanceGetItem(PyObject* self, PyObject* key)
PyObject* signalInstanceDisconnect(PyObject* self, PyObject* args)
{
- PySideSignalInstanceData *source = reinterpret_cast<PySideSignalInstanceData*>(self);
+ PySideSignalInstance *source = reinterpret_cast<PySideSignalInstance*>(self);
Shiboken::AutoDecRef pyArgs(PyList_New(0));
PyObject *slot;
@@ -392,21 +391,21 @@ PyObject* signalInstanceDisconnect(PyObject* self, PyObject* args)
bool match = false;
if (slot->ob_type == &PySideSignalInstanceType) {
- PySideSignalInstanceData *target = reinterpret_cast<PySideSignalInstanceData*>(slot);
+ PySideSignalInstance *target = reinterpret_cast<PySideSignalInstance*>(slot);
if (QMetaObject::checkConnectArgs(source->d->signature, target->d->signature)) {
PyList_Append(pyArgs, source->d->source);
- Shiboken::AutoDecRef source_signature(PySide::signalBuildQtCompatible(source->d->signature));
+ Shiboken::AutoDecRef source_signature(PySide::Signal::buildQtCompatible(source->d->signature));
PyList_Append(pyArgs, source_signature);
PyList_Append(pyArgs, target->d->source);
- Shiboken::AutoDecRef target_signature(PySide::signalBuildQtCompatible(target->d->signature));
+ Shiboken::AutoDecRef target_signature(PySide::Signal::buildQtCompatible(target->d->signature));
PyList_Append(pyArgs, target_signature);
match = true;
}
} else {
//try the first signature
PyList_Append(pyArgs, source->d->source);
- Shiboken::AutoDecRef signature(PySide::signalBuildQtCompatible(source->d->signature));
+ Shiboken::AutoDecRef signature(PySide::Signal::buildQtCompatible(source->d->signature));
PyList_Append(pyArgs, signature);
PyList_Append(pyArgs, slot);
@@ -424,42 +423,41 @@ PyObject* signalInstanceDisconnect(PyObject* self, PyObject* args)
PyObject* signalCall(PyObject* self, PyObject* args, PyObject* kw)
{
- SignalData* signalData = reinterpret_cast<SignalData*>(self);
+ PySideSignal* signal = reinterpret_cast<PySideSignal*>(self);
- if (!signalData->homonymousMethod) {
+ if (!signal->homonymousMethod) {
PyErr_SetString(PyExc_TypeError, "native Qt signal is not callable");
return 0;
}
- descrgetfunc getDescriptor = signalData->homonymousMethod->ob_type->tp_descr_get;
- Shiboken::AutoDecRef homonymousMethod(getDescriptor(signalData->homonymousMethod, 0, 0));
+ descrgetfunc getDescriptor = signal->homonymousMethod->ob_type->tp_descr_get;
+ Shiboken::AutoDecRef homonymousMethod(getDescriptor(signal->homonymousMethod, 0, 0));
if (PyCFunction_GET_FLAGS(homonymousMethod.object()) & METH_STATIC)
return PyCFunction_Call(homonymousMethod, args, kw);
- ternaryfunc callFunc = signalData->homonymousMethod->ob_type->tp_call;
+ ternaryfunc callFunc = signal->homonymousMethod->ob_type->tp_call;
return callFunc(homonymousMethod, args, kw);
}
PyObject* signalInstanceCall(PyObject* self, PyObject* args, PyObject* kw)
{
- PySideSignalInstanceData* signalData = reinterpret_cast<PySideSignalInstanceData*>(self);
- if (!signalData->d->homonymousMethod) {
+ PySideSignalInstance* PySideSignal = reinterpret_cast<PySideSignalInstance*>(self);
+ if (!PySideSignal->d->homonymousMethod) {
PyErr_SetString(PyExc_TypeError, "native Qt signal is not callable");
return 0;
}
- descrgetfunc getDescriptor = signalData->d->homonymousMethod->ob_type->tp_descr_get;
- Shiboken::AutoDecRef homonymousMethod(getDescriptor(signalData->d->homonymousMethod, signalData->d->source, 0));
+ descrgetfunc getDescriptor = PySideSignal->d->homonymousMethod->ob_type->tp_descr_get;
+ Shiboken::AutoDecRef homonymousMethod(getDescriptor(PySideSignal->d->homonymousMethod, PySideSignal->d->source, 0));
return PyCFunction_Call(homonymousMethod, args, kw);
}
} // extern "C"
-namespace PySide
-{
+namespace PySide { namespace Signal {
-void initSignalSupport(PyObject* module)
+void init(PyObject* module)
{
if (PyType_Ready(&PySideSignalType) < 0)
return;
@@ -473,7 +471,7 @@ void initSignalSupport(PyObject* module)
Py_INCREF(&PySideSignalInstanceType);
}
-void signalUpdateSource(PyObject* source)
+void updateSourceObject(PyObject* source)
{
PyTypeObject * objType = reinterpret_cast<PyTypeObject *>(PyObject_Type(source));
@@ -483,8 +481,8 @@ void signalUpdateSource(PyObject* source)
while (PyDict_Next(objType->tp_dict, &pos, &key, &value)) {
if (PyObject_TypeCheck(value, &PySideSignalType)) {
- Shiboken::AutoDecRef signalInstance((PyObject*)PyObject_New(PySideSignalInstanceData, &PySideSignalInstanceType));
- signalInstanceInitialize(signalInstance.cast<PySideSignalInstanceData*>(), key, reinterpret_cast<SignalData*>(value), source, 0);
+ Shiboken::AutoDecRef signalInstance((PyObject*)PyObject_New(PySideSignalInstance, &PySideSignalInstanceType));
+ instanceInitialize(signalInstance.cast<PySideSignalInstance*>(), key, reinterpret_cast<PySideSignal*>(value), source, 0);
PyObject_SetAttr(source, key, signalInstance);
}
}
@@ -525,14 +523,14 @@ char* getTypeName(PyObject* type)
return 0;
}
-char* signalBuildSignature(const char *name, const char *signature)
+char* buildSignature(const char *name, const char *signature)
{
QString signal;
signal.sprintf("%s(%s)", name, signature);
return strdup(QMetaObject::normalizedSignature(signal.toAscii()));
}
-char* signalParseSignature(PyObject *args)
+char* parseSignature(PyObject *args)
{
char *signature = 0;
if (args && (PyString_Check(args) || !PySequence_Check(args)))
@@ -555,7 +553,7 @@ char* signalParseSignature(PyObject *args)
return signature;
}
-void signalAppendSignature(SignalData* self, char* signature)
+void appendSignature(PySideSignal* self, char* signature)
{
self->signaturesSize++;
@@ -567,17 +565,17 @@ void signalAppendSignature(SignalData* self, char* signature)
self->signatures[self->signaturesSize-1] = signature;
}
-PySideSignalInstanceData* signalInitialize(PyObject* self, PyObject* name, PyObject *object)
+PySideSignalInstance* initialize(PySideSignal* self, PyObject* name, PyObject *object)
{
- PySideSignalInstanceData* instance = PyObject_New(PySideSignalInstanceData, &PySideSignalInstanceType);
- signalInstanceInitialize(instance, name, reinterpret_cast<SignalData*>(self), object, 0);
+ PySideSignalInstance* instance = PyObject_New(PySideSignalInstance, &PySideSignalInstanceType);
+ instanceInitialize(instance, name, self, object, 0);
return instance;
}
-void signalInstanceInitialize(PySideSignalInstanceData* self, PyObject* name, SignalData* data, PyObject* source, int index)
+void instanceInitialize(PySideSignalInstance* self, PyObject* name, PySideSignal* data, PyObject* source, int index)
{
- self->d = new PySideSignalInstanceDataPrivate;
- PySideSignalInstanceDataPrivate* selfPvt = self->d;
+ self->d = new PySideSignalInstancePrivate;
+ PySideSignalInstancePrivate* selfPvt = self->d;
selfPvt->next = 0;
if (data->signalName)
selfPvt->signalName = strdup(data->signalName);
@@ -587,7 +585,7 @@ void signalInstanceInitialize(PySideSignalInstanceData* self, PyObject* name, Si
}
selfPvt->source = source;
- selfPvt->signature = signalBuildSignature(self->d->signalName, data->signatures[index]);
+ selfPvt->signature = buildSignature(self->d->signalName, data->signatures[index]);
selfPvt->homonymousMethod = 0;
if (data->homonymousMethod) {
selfPvt->homonymousMethod = data->homonymousMethod;
@@ -596,12 +594,12 @@ void signalInstanceInitialize(PySideSignalInstanceData* self, PyObject* name, Si
index++;
if (index < data->signaturesSize) {
- selfPvt->next = PyObject_New(PySideSignalInstanceData, &PySideSignalInstanceType);
- signalInstanceInitialize(selfPvt->next, name, data, source, index);
+ selfPvt->next = PyObject_New(PySideSignalInstance, &PySideSignalInstanceType);
+ instanceInitialize(selfPvt->next, name, data, source, index);
}
}
-bool signalConnect(PyObject* source, const char* signal, PyObject* callback)
+bool connect(PyObject* source, const char* signal, PyObject* callback)
{
Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source, "connect"));
if (pyMethod.isNull())
@@ -612,20 +610,20 @@ bool signalConnect(PyObject* source, const char* signal, PyObject* callback)
return PyObject_CallObject(pyMethod, pyArgs);
}
-PyObject* signalNewFromMethod(PyObject* source, const QList<QMetaMethod>& methodList)
+PySideSignalInstance* newObjectFromMethod(PyObject* source, const QList<QMetaMethod>& methodList)
{
- PySideSignalInstanceData *root = 0;
- PySideSignalInstanceData *previous = 0;
+ PySideSignalInstance *root = 0;
+ PySideSignalInstance *previous = 0;
foreach(QMetaMethod m, methodList) {
- PySideSignalInstanceData *item = PyObject_New(PySideSignalInstanceData, &PySideSignalInstanceType);
+ PySideSignalInstance *item = PyObject_New(PySideSignalInstance, &PySideSignalInstanceType);
if (!root)
root = item;
if (previous)
previous->d->next = item;
- item->d = new PySideSignalInstanceDataPrivate;
- PySideSignalInstanceDataPrivate* selfPvt = item->d;
+ item->d = new PySideSignalInstancePrivate;
+ PySideSignalInstancePrivate* selfPvt = item->d;
selfPvt->source = source;
QByteArray cppName(m.signature());
cppName = cppName.mid(0, cppName.indexOf('('));
@@ -635,14 +633,14 @@ PyObject* signalNewFromMethod(PyObject* source, const QList<QMetaMethod>& method
selfPvt->homonymousMethod = 0;
selfPvt->next = 0;
}
- return reinterpret_cast<PyObject*>(root);
+ return root;
}
-PyObject* signalNew(const char* name, ...)
+PySideSignal* newObject(const char* name, ...)
{
va_list listSignatures;
char* sig = 0;
- SignalData* self = PyObject_New(SignalData, &PySideSignalType);
+ PySideSignal* self = PyObject_New(PySideSignal, &PySideSignalType);
self->signalName = strdup(name);
self->signaturesSize = 0;
self->signatures = 0;
@@ -653,17 +651,17 @@ PyObject* signalNew(const char* name, ...)
sig = va_arg(listSignatures, char*);
while(sig != NULL) {
- signalAppendSignature(self, strdup(sig));
+ appendSignature(self, strdup(sig));
sig = va_arg(listSignatures, char*);
}
va_end(listSignatures);
- return reinterpret_cast<PyObject*>(self);
+ return self;
}
-PyObject* signalBuildQtCompatible(const char* signature)
+PyObject* buildQtCompatible(const char* signature)
{
char* qtSignature;
qtSignature = reinterpret_cast<char*>(malloc(strlen(signature)+2));
@@ -673,33 +671,35 @@ PyObject* signalBuildQtCompatible(const char* signature)
return ret;
}
-void addSignalToWrapper(Shiboken::SbkBaseWrapperType* wrapperType, const char* signalName, PyObject* signal)
+void addSignalToWrapper(Shiboken::SbkBaseWrapperType* wrapperType, const char* signalName, PySideSignal* signal)
{
PyObject* typeDict = wrapperType->super.ht_type.tp_dict;
PyObject* homonymousMethod;
if ((homonymousMethod = PyDict_GetItemString(typeDict, signalName))) {
Py_INCREF(homonymousMethod);
- reinterpret_cast<SignalData*>(signal)->homonymousMethod = homonymousMethod;
+ signal->homonymousMethod = homonymousMethod;
}
- PyDict_SetItemString(typeDict, signalName, signal);
+ PyDict_SetItemString(typeDict, signalName, reinterpret_cast<PyObject*>(signal));
}
-PyObject* getSignalSource(PySideSignalInstanceData* signal)
+PyObject* getObject(PySideSignalInstance* signal)
{
return signal->d->source;
}
-const char* getSignalSignature(PySideSignalInstanceData* signal)
+const char* getSignature(PySideSignalInstance* signal)
{
return signal->d->signature;
}
-const char** getSignalSignatures(PyObject* signal, int *size)
+const char** getSignatures(PyObject* signal, int *size)
{
- SignalData *self = reinterpret_cast<SignalData*>(signal);
+ PySideSignal *self = reinterpret_cast<PySideSignal*>(signal);
*size = self->signaturesSize;
return (const char**) self->signatures;
}
+} //namespace Signal
} //namespace PySide
+
diff --git a/libpyside/qsignal.h b/libpyside/qsignal.h
index 3f8dafdc3..e32e0642b 100644
--- a/libpyside/qsignal.h
+++ b/libpyside/qsignal.h
@@ -37,25 +37,80 @@ extern "C"
extern PYSIDE_API PyTypeObject PySideSignalType;
extern PYSIDE_API PyTypeObject PySideSignalInstanceType;
- struct PySideSignalInstanceDataPrivate;
- struct PYSIDE_API PySideSignalInstanceData
+ //Internal object
+ struct PYSIDE_API PySideSignal;
+
+ struct PySideSignalInstancePrivate;
+ struct PYSIDE_API PySideSignalInstance
{
PyObject_HEAD
- PySideSignalInstanceDataPrivate* d;
+ PySideSignalInstancePrivate* d;
};
}; //extern "C"
-namespace PySide
-{
+namespace PySide { namespace Signal {
+
+/**
+ * This function creates a Signal object which stay attached to QObject class
+ *
+ * @param name of the Signal to be registered on meta object
+ * @param signatures a list of signatures supported by this signal, ended with a NULL pointer
+ * @return Return a new reference to PyObject* of type PySideSignal
+ **/
+PYSIDE_API PySideSignal* newObject(const char* name, ...);
+
+/**
+ * This function creates a Signal object which stay attached to QObject class based on a list of QMetaMethod
+ *
+ * @param source of the Signal to be registered on meta object
+ * @param methods a list of QMetaMethod wich contains the supported signature
+ * @return Return a new reference to PyObject* of type PySideSignal
+ **/
+PYSIDE_API PySideSignalInstance* newObjectFromMethod(PyObject* source, const QList<QMetaMethod>& methods);
+
+/**
+ * This function initializes the Signal object creating a PySideSignalInstance
+ *
+ * @param self a Signal object used as base to PySideSignalInstance
+ * @param name the name to be used on PySideSignalInstance
+ * @param object the PyObject where the signal will be attached
+ * @return Return a new reference to PySideSignalInstance
+ **/
+PYSIDE_API PySideSignalInstance* initialize(PySideSignal* signal, PyObject* name, PyObject *object);
-PYSIDE_API PyObject* signalNew(const char* name, ...);
-PYSIDE_API PyObject* signalNewFromMethod(PyObject* source, const QList<QMetaMethod>& method);
-PYSIDE_API PySideSignalInstanceData* signalInitialize(PyObject* self, PyObject* name, PyObject *object);
+/**
+ * This function is used to retrieve the object in which the sigal is attached
+ *
+ * @param self The Signal object
+ * @return Return the internal reference to parent object of the signal
+ **/
+PYSIDE_API PyObject* getObject(PySideSignalInstance* signal);
+
+/**
+ * This function is used to retrieve the signal signature
+ *
+ * @param self The Signal object
+ * @return Return the signal signature
+ **/
+PYSIDE_API const char* getSignature(PySideSignalInstance* signal);
+
+/**
+ * This function is used to retrieve the signal signature
+ *
+ * @param self The Signal object
+ * @return Return the signal signature
+ **/
+PYSIDE_API void updateSourceObject(PyObject* source);
+
+/**
+ * This function is used to retrieve the signal signature
+ *
+ * @param self The Signal object
+ * @return Return the signal signature
+ **/
+PYSIDE_API void addSignalToWrapper(Shiboken::SbkBaseWrapperType* wrapperType, const char* signalName, PySideSignal* signal);
-PYSIDE_API void signalUpdateSource(PyObject* source);
-PYSIDE_API void addSignalToWrapper(Shiboken::SbkBaseWrapperType* wrapperType, const char* signalName, PyObject* signal);
-PYSIDE_API PyObject* getSignalSource(PySideSignalInstanceData* signal);
-PYSIDE_API const char* getSignalSignature(PySideSignalInstanceData* signal);
+} //namespace Signal
} //namespace PySide
#endif
diff --git a/libpyside/qsignal_p.h b/libpyside/qsignal_p.h
index 467acb56a..7f614694b 100644
--- a/libpyside/qsignal_p.h
+++ b/libpyside/qsignal_p.h
@@ -29,7 +29,7 @@ extern "C"
{
extern PyTypeObject PySideSignalType;
- struct SignalData {
+ struct PySideSignal {
PyObject_HEAD
bool initialized;
char* signalName;
@@ -38,25 +38,24 @@ extern "C"
PyObject* homonymousMethod;
};
- struct PySideSignalInstanceData;
- struct PySideSignalInstanceDataPrivate {
+ struct PySideSignalInstance;
+ struct PySideSignalInstancePrivate {
char* signalName;
char* signature;
PyObject* source;
PyObject* homonymousMethod;
- PySideSignalInstanceData* next;
+ PySideSignalInstance* next;
};
}; //extern "C"
-namespace PySide
-{
- bool signalConnect(PyObject* source, const char* signal, PyObject* callback);
- char* getTypeName(PyObject*);
- void initSignalSupport(PyObject* module);
- const char** getSignalSignatures(PyObject* self, int *size);
+namespace PySide { namespace Signal {
+ void init(PyObject* module);
+ bool connect(PyObject* source, const char* signal, PyObject* callback);
+ char* getTypeName(PyObject*);
+ const char** getSignatures(PyObject* self, int *size);
-} //namespace PySide
+}} //namespace PySide
#endif
diff --git a/libpyside/qslot.cpp b/libpyside/qslot.cpp
index 5aab65490..ff63a6ca3 100644
--- a/libpyside/qslot.cpp
+++ b/libpyside/qslot.cpp
@@ -33,7 +33,7 @@ typedef struct
char* slotName;
char* args;
char* resultType;
-} SlotData;
+} PySideSlot;
extern "C"
{
@@ -46,7 +46,7 @@ static PyTypeObject PySideSlotType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
"PySide.QtCore."SLOT_DEC_NAME, /*tp_name*/
- sizeof(SlotData), /*tp_basicsize*/
+ sizeof(PySideSlot), /*tp_basicsize*/
0, /*tp_itemsize*/
0, /*tp_dealloc*/
0, /*tp_print*/
@@ -105,10 +105,10 @@ int slotTpInit(PyObject *self, PyObject *args, PyObject *kw)
if (!PyArg_ParseTupleAndKeywords(emptyTuple, kw, "|sO:QtCore."SLOT_DEC_NAME, (char**) kwlist, &argName, &argResult))
return 0;
- SlotData *data = reinterpret_cast<SlotData*>(self);
+ PySideSlot *data = reinterpret_cast<PySideSlot*>(self);
for(Py_ssize_t i = 0, i_max = PyTuple_Size(args); i < i_max; i++) {
PyObject *argType = PyTuple_GET_ITEM(args, i);
- char *typeName = PySide::getTypeName(argType);
+ char *typeName = PySide::Signal::getTypeName(argType);
if (typeName) {
if (data->args) {
data->args = reinterpret_cast<char*>(realloc(data->args, (strlen(data->args) + 1 + strlen(typeName)) * sizeof(char*)));
@@ -125,7 +125,7 @@ int slotTpInit(PyObject *self, PyObject *args, PyObject *kw)
data->slotName = strdup(argName);
if (argResult)
- data->resultType = PySide::getTypeName(argResult);
+ data->resultType = PySide::Signal::getTypeName(argResult);
else
data->resultType = strdup("void");
@@ -140,7 +140,7 @@ PyObject* slotCall(PyObject* self, PyObject* args, PyObject* kw)
Py_INCREF(callback);
if (PyFunction_Check(callback)) {
- SlotData *data = reinterpret_cast<SlotData*>(self);
+ PySideSlot *data = reinterpret_cast<PySideSlot*>(self);
if (!data->slotName) {
PyObject *funcName = reinterpret_cast<PyFunctionObject*>(callback)->func_name;
@@ -180,10 +180,9 @@ PyObject* slotCall(PyObject* self, PyObject* args, PyObject* kw)
} // extern "C"
-namespace PySide
-{
+namespace PySide { namespace Slot {
-void initSlotSupport(PyObject* module)
+void init(PyObject* module)
{
if (PyType_Ready(&PySideSlotType) < 0)
return;
@@ -192,4 +191,5 @@ void initSlotSupport(PyObject* module)
PyModule_AddObject(module, SLOT_DEC_NAME, ((PyObject*)&PySideSlotType));
}
+} // namespace Slot
} // namespace PySide
diff --git a/libpyside/qslot_p.h b/libpyside/qslot_p.h
index 56152a1b8..b02c36acf 100644
--- a/libpyside/qslot_p.h
+++ b/libpyside/qslot_p.h
@@ -24,9 +24,8 @@
#include <Python.h>
-namespace PySide
-{
- void initSlotSupport(PyObject* module);
-}
+namespace PySide { namespace Slot {
+ void init(PyObject* module);
+}}
#endif
diff --git a/libpyside/signalmanager.cpp b/libpyside/signalmanager.cpp
index 53f6a4510..1e5824e88 100644
--- a/libpyside/signalmanager.cpp
+++ b/libpyside/signalmanager.cpp
@@ -355,7 +355,7 @@ bool SignalManager::emitSignal(QObject* source, const char* signal, PyObject* ar
int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id, void** args)
{
const QMetaObject* metaObject = object->metaObject();
- PySideQProperty* pp = 0;
+ PySideProperty* pp = 0;
PyObject* pp_name = 0;
QMetaProperty mp;
Shiboken::TypeResolver* typeResolver = 0;
@@ -368,7 +368,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
return id - metaObject->methodCount();
pp_name = PyString_FromString(mp.name());
- pp = qpropertyGetObject(pySelf, pp_name);
+ pp = Property::getObject(pySelf, pp_name);
if (!pp) {
qWarning("Invalid property.");
Py_XDECREF(pp_name);
@@ -382,7 +382,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
#ifndef QT_NO_PROPERTIES
case QMetaObject::ReadProperty:
{
- PyObject* value = qpropertyGet(pp, pySelf);
+ PyObject* value = Property::getValue(pp, pySelf);
if (value) {
typeResolver->toCpp(value, &args[0]);
Py_DECREF(value);
@@ -395,12 +395,12 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
case QMetaObject::WriteProperty:
{
Shiboken::AutoDecRef value(typeResolver->toPython(args[0]));
- qpropertySet(pp, pySelf, value);
+ Property::setValue(pp, pySelf, value);
break;
}
case QMetaObject::ResetProperty:
- qpropertyReset(pp, pp_name);
+ Property::reset(pp, pp_name);
break;
case QMetaObject::QueryPropertyDesignable: