diff options
-rw-r--r-- | libpyside/pyside.cpp | 15 | ||||
-rw-r--r-- | libpyside/qslot.cpp | 41 | ||||
-rw-r--r-- | libpyside/qslot_p.h | 32 |
3 files changed, 61 insertions, 27 deletions
diff --git a/libpyside/pyside.cpp b/libpyside/pyside.cpp index 3cc1fd4c7..30a5e2663 100644 --- a/libpyside/pyside.cpp +++ b/libpyside/pyside.cpp @@ -22,18 +22,17 @@ #include "pyside.h" -#include "signalmanager.h" -#include "qproperty_p.h" -#include "qproperty.h" -#include "qsignal.h" -#include "qsignal_p.h" #include <basewrapper.h> #include <conversions.h> #include <algorithm> #include <cctype> #include <QStack> - -extern "C" void init_slot(PyObject* module); +#include "signalmanager.h" +#include "qproperty_p.h" +#include "qproperty.h" +#include "qsignal.h" +#include "qsignal_p.h" +#include "qslot_p.h" static QStack<PySide::CleanupFunction> cleanupFunctionList; @@ -43,7 +42,7 @@ namespace PySide void init(PyObject *module) { initSignalSupport(module); - init_slot(module); + initSlotSupport(module); initQProperty(module); // Init signal manager, so it will register some meta types used by QVariant. SignalManager::instance(); diff --git a/libpyside/qslot.cpp b/libpyside/qslot.cpp index 762f85f28..5aab65490 100644 --- a/libpyside/qslot.cpp +++ b/libpyside/qslot.cpp @@ -38,11 +38,11 @@ typedef struct extern "C" { -static int slot_init(PyObject*, PyObject*, PyObject*); -static PyObject* slot_call(PyObject*, PyObject*, PyObject*); +static int slotTpInit(PyObject*, PyObject*, PyObject*); +static PyObject* slotCall(PyObject*, PyObject*, PyObject*); // Class Definition ----------------------------------------------- -static PyTypeObject Slot_Type = { +static PyTypeObject PySideSlotType = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "PySide.QtCore."SLOT_DEC_NAME, /*tp_name*/ @@ -58,7 +58,7 @@ static PyTypeObject Slot_Type = { 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash */ - slot_call, /*tp_call*/ + slotCall, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ @@ -79,7 +79,7 @@ static PyTypeObject Slot_Type = { 0, /*tp_descr_get */ 0, /*tp_descr_set */ 0, /*tp_dictoffset */ - (initproc)slot_init, /*tp_init */ + slotTpInit, /*tp_init */ 0, /*tp_alloc */ PyType_GenericNew, /*tp_new */ 0, /*tp_free */ @@ -92,19 +92,7 @@ static PyTypeObject Slot_Type = { 0, /*tp_del */ }; -void init_slot(PyObject *module) -{ - if (PyType_Ready(&Slot_Type) < 0) - return; - - Py_INCREF(&Slot_Type); - PyModule_AddObject(module, SLOT_DEC_NAME, ((PyObject*)&Slot_Type)); -} - - -} // extern "C" - -int slot_init(PyObject *self, PyObject *args, PyObject *kw) +int slotTpInit(PyObject *self, PyObject *args, PyObject *kw) { static PyObject *emptyTuple = 0; static const char *kwlist[] = {"name", "result", 0}; @@ -144,7 +132,7 @@ int slot_init(PyObject *self, PyObject *args, PyObject *kw) return 1; } -PyObject* slot_call(PyObject* self, PyObject* args, PyObject* kw) +PyObject* slotCall(PyObject* self, PyObject* args, PyObject* kw) { static PyObject* pySlotName = 0; PyObject* callback; @@ -190,3 +178,18 @@ PyObject* slot_call(PyObject* self, PyObject* args, PyObject* kw) return callback; } +} // extern "C" + +namespace PySide +{ + +void initSlotSupport(PyObject* module) +{ + if (PyType_Ready(&PySideSlotType) < 0) + return; + + Py_INCREF(&PySideSlotType); + PyModule_AddObject(module, SLOT_DEC_NAME, ((PyObject*)&PySideSlotType)); +} + +} // namespace PySide diff --git a/libpyside/qslot_p.h b/libpyside/qslot_p.h new file mode 100644 index 000000000..56152a1b8 --- /dev/null +++ b/libpyside/qslot_p.h @@ -0,0 +1,32 @@ +/* + * This file is part of the PySide project. + * + * Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team <contact@pyside.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef PYSIDE_SLOT_P_H +#define PYSIDE_SLOT_P_H + +#include <Python.h> + +namespace PySide +{ + void initSlotSupport(PyObject* module); +} + +#endif |