~ubuntu-branches/ubuntu/oneiric/pyside/oneiric

« back to all changes in this revision

Viewing changes to PySide/QtCore/glue/qcoreapplication_init.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2011-02-18 18:01:00 UTC
  • mfrom: (1.2.3 upstream) (6.1.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20110218180100-vaczjij7g08fzfme
Tags: 1.0.0~rc1-1
* New 1.0.0~rc1 upstream release
  - Bump the B-D chain versions:
    + apiextractor to 0.10.0-2~
    + generatorrunner to 0.6.6
    + shiboken to 1.0.0~rc1
* Update patches to ~rc1.
* debian/watch: update to handle Release Candidates too.
* Bump XS-Python-Version to >= 2.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
static int QCoreApplicationArgCount;
3
3
static char** QCoreApplicationArgValues;
4
4
 
5
 
/**
6
 
 * Called at QtCore module exit
7
 
 */
8
 
void DeleteQCoreApplicationAtExit()
9
 
{
10
 
    QCoreApplication *cpp = QCoreApplication::instance();
11
 
    if (cpp) {
12
 
        Shiboken::BindingManager &bmngr = Shiboken::BindingManager::instance();
13
 
        cpp->flush();
14
 
        QCoreApplication::processEvents();
15
 
        bmngr.destroyWrapper(cpp);
16
 
        delete cpp;
17
 
    }
18
 
}
19
 
 
20
 
int SbkQCoreApplication_Init(PyObject* self, PyObject* args, PyObject*)
21
 
{
22
 
    if (Shiboken::isUserType(self) && !Shiboken::canCallConstructor(self->ob_type, Shiboken::SbkType<QApplication >()))
 
5
int Sbk_QCoreApplication_Init(PyObject* self, PyObject* args, PyObject*)
 
6
{
 
7
    if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType<QCoreApplication >()))
23
8
        return -1;
24
9
 
25
10
 
34
19
        return -1;
35
20
    }
36
21
 
37
 
    if (!PySequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QCoreApplicationArgCount, &QCoreApplicationArgValues, "PySideApp")) {
 
22
    if (!Shiboken::sequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QCoreApplicationArgCount, &QCoreApplicationArgValues, "PySideApp")) {
38
23
        PyErr_BadArgument();
39
24
        return -1;
40
25
    }
41
26
 
 
27
    SbkObject* sbkSelf = reinterpret_cast<SbkObject*>(self);
42
28
    QCoreApplicationWrapper* cptr = new QCoreApplicationWrapper(QCoreApplicationArgCount, QCoreApplicationArgValues);
43
 
    Shiboken::setCppPointer(reinterpret_cast<SbkBaseWrapper*>(self),
44
 
                            Shiboken::SbkType<QCoreApplication>(),
45
 
                            cptr);
46
 
 
47
 
    SbkBaseWrapper_setValidCppObject(self, 1);
48
 
    SbkBaseWrapper *sbkSelf = reinterpret_cast<SbkBaseWrapper*>(self);
49
 
    sbkSelf->containsCppWrapper = 1;
50
 
    sbkSelf->hasOwnership = 0;
 
29
    Shiboken::Object::setCppPointer(sbkSelf,
 
30
                                     Shiboken::SbkType<QCoreApplication>(),
 
31
                                     cptr);
 
32
 
 
33
    Shiboken::Object::setValidCpp(sbkSelf, true);
 
34
    Shiboken::Object::setHasCppWrapper(sbkSelf, true);
 
35
    Shiboken::Object::releaseOwnership(sbkSelf);
 
36
 
51
37
    Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr);
52
 
    PySide::signalUpdateSource(self);
 
38
    PySide::Signal::updateSourceObject(self);
53
39
    cptr->metaObject();
54
40
 
55
 
    PySide::registerCleanupFunction(DeleteQCoreApplicationAtExit);
 
41
    PySide::registerCleanupFunction(&PySide::destroyQCoreApplication);
56
42
    Py_INCREF(self);
57
43
    return 1;
58
44
}