Deprecated functions marked as deprecated.

Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
          Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
Hugo Parente Lima 2011-08-10 18:00:58 -03:00
commit 01b90a3a58
9 changed files with 27 additions and 19 deletions

View file

@ -8,11 +8,12 @@
namespace PySide namespace PySide
{ {
class DestroyListenerPrivate; class DestroyListenerPrivate;
/// \deprecated This class is deprecated and isn't used by libpyside anymore.
class PYSIDE_API DestroyListener : public QObject class PYSIDE_API DestroyListener : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
static DestroyListener* instance(); PYSIDE_DEPRECATED(static DestroyListener* instance());
static void destroy(); static void destroy();
void listen(QObject* obj); void listen(QObject* obj);

View file

@ -34,7 +34,7 @@ namespace PySide
class DynamicQMetaObject : public QMetaObject class DynamicQMetaObject : public QMetaObject
{ {
public: public:
DynamicQMetaObject(const char* className, const QMetaObject* metaObject); //deprecated DynamicQMetaObject(const char* className, const QMetaObject* metaObject);
DynamicQMetaObject(PyTypeObject* type, const QMetaObject* metaobject); DynamicQMetaObject(PyTypeObject* type, const QMetaObject* metaobject);
~DynamicQMetaObject(); ~DynamicQMetaObject();

View file

@ -80,7 +80,7 @@ bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds
Shiboken::AutoDecRef retval(PyObject_CallObject(propSetter, args)); Shiboken::AutoDecRef retval(PyObject_CallObject(propSetter, args));
} else { } else {
PyObject* attr = PyObject_GenericGetAttr(qObj, key); PyObject* attr = PyObject_GenericGetAttr(qObj, key);
if (PySide::Property::isPropertyType(attr)) if (PySide::Property::checkType(attr))
PySide::Property::setValue(reinterpret_cast<PySideProperty*>(attr), qObj, value); PySide::Property::setValue(reinterpret_cast<PySideProperty*>(attr), qObj, value);
} }
} else { } else {
@ -216,7 +216,7 @@ PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* nam
if (!Shiboken::Object::isValid(reinterpret_cast<SbkObject*>(self), false)) if (!Shiboken::Object::isValid(reinterpret_cast<SbkObject*>(self), false))
return attr; return attr;
if (attr && Property::isPropertyType(attr)) { if (attr && Property::checkType(attr)) {
PyObject *value = Property::getValue(reinterpret_cast<PySideProperty*>(attr), self); PyObject *value = Property::getValue(reinterpret_cast<PySideProperty*>(attr), self);
Py_DECREF(attr); Py_DECREF(attr);
if (!value) if (!value)

View file

@ -77,8 +77,7 @@ template<typename T>
struct initQtMetaType<T, false> { struct initQtMetaType<T, false> {
}; };
/// \deprecated PYSIDE_DEPRECATED(PYSIDE_API void initDynamicMetaObject(SbkObjectType* type, const QMetaObject* base));
PYSIDE_API void initDynamicMetaObject(SbkObjectType* type, const QMetaObject* base);
PYSIDE_API void initDynamicMetaObject(SbkObjectType* type, const QMetaObject* base, const std::size_t& cppObjSize); PYSIDE_API void initDynamicMetaObject(SbkObjectType* type, const QMetaObject* base, const std::size_t& cppObjSize);
PYSIDE_API void initQObjectSubType(SbkObjectType* type, PyObject* args, PyObject* kwds); PYSIDE_API void initQObjectSubType(SbkObjectType* type, PyObject* args, PyObject* kwds);

View file

@ -33,11 +33,14 @@
#define PYSIDE_API __declspec(dllimport) #define PYSIDE_API __declspec(dllimport)
#endif #endif
#endif #endif
#define PYSIDE_DEPRECATED(func) __declspec(deprecated) func
#else #else
#if __GNUC__ >= 4 #if __GNUC__ >= 4
#define PYSIDE_API __attribute__ ((visibility("default"))) #define PYSIDE_API __attribute__ ((visibility("default")))
#define PYSIDE_DEPRECATED(func) func __attribute__ ((deprecated))
#else #else
#define PYSIDE_API #define PYSIDE_API
#define DEPRECATED(func) func
#endif #endif
#endif #endif

View file

@ -384,7 +384,7 @@ PySideProperty* getObject(PyObject* source, PyObject* name)
} }
attr = getFromType(source->ob_type, name); attr = getFromType(source->ob_type, name);
if (attr && isPropertyType(attr)) { if (attr && checkType(attr)) {
Py_INCREF(attr); Py_INCREF(attr);
return reinterpret_cast<PySideProperty*>(attr); return reinterpret_cast<PySideProperty*>(attr);
} }

View file

@ -45,8 +45,8 @@ typedef void (*MetaCallHandler)(PySideProperty*,PyObject*,QMetaObject::Call, voi
PYSIDE_API bool checkType(PyObject* pyObj); PYSIDE_API bool checkType(PyObject* pyObj);
//Deprecated (use checkType) /// @deprecated Use checkType
PYSIDE_API bool isPropertyType(PyObject* pyObj); PYSIDE_DEPRECATED(PYSIDE_API bool isPropertyType(PyObject* pyObj));
/** /**
* This function call set property function and pass value as arg * This function call set property function and pass value as arg

View file

@ -751,6 +751,17 @@ static typename T::value_type join(T t, const char* sep)
return res; return res;
} }
static void _addSignalToWrapper(SbkObjectType* 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);
signal->homonymousMethod = homonymousMethod;
}
PyDict_SetItemString(typeDict, signalName, reinterpret_cast<PyObject*>(signal));
}
void registerSignals(SbkObjectType* pyObj, const QMetaObject* metaObject) void registerSignals(SbkObjectType* pyObj, const QMetaObject* metaObject)
{ {
typedef QHash<QByteArray, QList<QByteArray> > SignalSigMap; typedef QHash<QByteArray, QList<QByteArray> > SignalSigMap;
@ -779,7 +790,7 @@ void registerSignals(SbkObjectType* pyObj, const QMetaObject* metaObject)
SignalSigMap::mapped_type::const_iterator endJ = it.value().end(); SignalSigMap::mapped_type::const_iterator endJ = it.value().end();
for (; j != endJ; ++j) for (; j != endJ; ++j)
appendSignature(self, strdup(j->constData())); appendSignature(self, strdup(j->constData()));
addSignalToWrapper(pyObj, it.key(), self); _addSignalToWrapper(pyObj, it.key(), self);
Py_DECREF((PyObject*) self); Py_DECREF((PyObject*) self);
} }
} }
@ -795,13 +806,7 @@ PyObject* buildQtCompatible(const char* signature)
void addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal) void addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal)
{ {
PyObject* typeDict = wrapperType->super.ht_type.tp_dict; _addSignalToWrapper(wrapperType, signalName, signal);
PyObject* homonymousMethod;
if ((homonymousMethod = PyDict_GetItemString(typeDict, signalName))) {
Py_INCREF(homonymousMethod);
signal->homonymousMethod = homonymousMethod;
}
PyDict_SetItemString(typeDict, signalName, reinterpret_cast<PyObject*>(signal));
} }
PyObject* getObject(PySideSignalInstance* signal) PyObject* getObject(PySideSignalInstance* signal)

View file

@ -59,7 +59,7 @@ PYSIDE_API bool checkType(PyObject* type);
* @return Return a new reference to PyObject* of type PySideSignal * @return Return a new reference to PyObject* of type PySideSignal
* @deprecated Use registerSignals * @deprecated Use registerSignals
**/ **/
PYSIDE_API PySideSignal* newObject(const char* name, ...); PYSIDE_DEPRECATED(PYSIDE_API PySideSignal* newObject(const char* name, ...));
/** /**
* Register all C++ signals of a QObject on Python type. * Register all C++ signals of a QObject on Python type.
@ -112,7 +112,7 @@ PYSIDE_API void updateSourceObject(PyObject* source);
/** /**
* @deprecated Use registerSignals * @deprecated Use registerSignals
**/ **/
PYSIDE_API void addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal); PYSIDE_DEPRECATED(PYSIDE_API void addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal));
/** /**
* This function verify if the signature is a QtSignal base on SIGNAL flag * This function verify if the signature is a QtSignal base on SIGNAL flag