Ejemplo n.º 1
0
void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePriv, ConstructionState *state)
{
    if (state->completePending) {

        for (int ii = 0; ii < state->bindValues.count(); ++ii) {
            QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bv =
                state->bindValues.at(ii);
            for (int jj = 0; jj < bv.count; ++jj) {
                if(bv.at(jj))
                    bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor |
                                          QDeclarativePropertyPrivate::DontRemoveBinding);
            }
            QDeclarativeEnginePrivate::clear(bv);
        }

        for (int ii = 0; ii < state->parserStatus.count(); ++ii) {
            QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> ps =
                state->parserStatus.at(ii);

            for (int jj = ps.count - 1; jj >= 0; --jj) {
                QDeclarativeParserStatus *status = ps.at(jj);
                if (status && status->d) {
                    status->d = 0;
                    status->componentComplete();
                }
            }
            QDeclarativeEnginePrivate::clear(ps);
        }

        while (state->componentAttached) {
            QDeclarativeComponentAttached *a = state->componentAttached;
            a->rem();
            QDeclarativeData *d = QDeclarativeData::get(a->parent());
            Q_ASSERT(d);
            Q_ASSERT(d->context);
            a->add(&d->context->componentAttached);
            emit a->completed();
        }

        state->bindValues.clear();
        state->parserStatus.clear();
        state->completePending = false;

        enginePriv->inProgressCreations--;
        if (0 == enginePriv->inProgressCreations) {
            while (enginePriv->erroredBindings) {
                enginePriv->warning(enginePriv->erroredBindings->error);
                enginePriv->erroredBindings->removeError();
            }
        }
    }
}
Ejemplo n.º 2
0
void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePriv, ConstructionState *state)
{
    if (state->completePending) {

        for (int ii = 0; ii < state->bindValues.count(); ++ii) {
            QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bv = 
                state->bindValues.at(ii);
            for (int jj = 0; jj < bv.count; ++jj) {
                if(bv.at(jj)) 
                    bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor | 
                                                QDeclarativePropertyPrivate::DontRemoveBinding);
            }
            QDeclarativeEnginePrivate::clear(bv);
        }

        for (int ii = 0; ii < state->parserStatus.count(); ++ii) {
            QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> ps = 
                state->parserStatus.at(ii);

            for (int jj = ps.count - 1; jj >= 0; --jj) {
                QDeclarativeParserStatus *status = ps.at(jj);
                if (status && status->d) {
                    status->d = 0;
                    status->componentComplete();
                }
            }
            QDeclarativeEnginePrivate::clear(ps);
        }

        while (state->componentAttacheds) {
            QDeclarativeComponentAttached *a = state->componentAttacheds;
            if (a->next) a->next->prev = &state->componentAttacheds;
            state->componentAttacheds = a->next;
            a->prev = 0; a->next = 0;
            emit a->completed();
        }

        state->bindValues.clear();
        state->parserStatus.clear();
        state->completePending = false;

        enginePriv->inProgressCreations--;
        if (0 == enginePriv->inProgressCreations) {
            while (enginePriv->erroredBindings) {
                qWarning().nospace() << qPrintable(enginePriv->erroredBindings->error.toString());
                enginePriv->erroredBindings->removeError();
            }
        }
    }
}
Ejemplo n.º 3
0
void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePriv, ConstructionState *state)
{
    if (state->completePending) {
        QT_TRY {
            for (int ii = 0; ii < state->bindValues.count(); ++ii) {
                QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bv =
                    state->bindValues.at(ii);
                for (int jj = 0; jj < bv.count; ++jj) {
                    if(bv.at(jj)) {
                        // XXX akennedy
                        bv.at(jj)->m_mePtr = 0;
                        bv.at(jj)->setEnabled(true, QDeclarativePropertyPrivate::BypassInterceptor |
                                                    QDeclarativePropertyPrivate::DontRemoveBinding);
                    }
                }
                QDeclarativeEnginePrivate::clear(bv);
            }

            for (int ii = 0; ii < state->parserStatus.count(); ++ii) {
                QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> ps =
                    state->parserStatus.at(ii);

                for (int jj = ps.count - 1; jj >= 0; --jj) {
                    QDeclarativeParserStatus *status = ps.at(jj);
                    if (status && status->d) {
                        status->d = 0;
                        status->componentComplete();
                    }
                }
                QDeclarativeEnginePrivate::clear(ps);
            }

            for (int ii = 0; ii < state->finalizedParserStatus.count(); ++ii) {
                QPair<QDeclarativeGuard<QObject>, int> status = state->finalizedParserStatus.at(ii);
                QObject *obj = status.first;
                if (obj) {
                    void *args[] = { 0 };
                    QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod,
                                          status.second, args);
                }
            }

            //componentComplete() can register additional finalization objects
            //that are then never handled. Handle them manually here.
            if (1 == enginePriv->inProgressCreations) {
                for (int ii = 0; ii < enginePriv->finalizedParserStatus.count(); ++ii) {
                    QPair<QDeclarativeGuard<QObject>, int> status = enginePriv->finalizedParserStatus.at(ii);
                    QObject *obj = status.first;
                    if (obj) {
                        void *args[] = { 0 };
                        QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod,
                                              status.second, args);
                    }
                }
                enginePriv->finalizedParserStatus.clear();
            }

            while (state->componentAttached) {
                QDeclarativeComponentAttached *a = state->componentAttached;
                a->rem();
                QDeclarativeData *d = QDeclarativeData::get(a->parent());
                Q_ASSERT(d);
                Q_ASSERT(d->context);
                a->add(&d->context->componentAttached);
                emit a->completed();
            }
        } QT_CATCH(const std::exception&) {
            state->bindValues.clear();
            state->parserStatus.clear();
            state->finalizedParserStatus.clear();
            state->completePending = false;
            enginePriv->inProgressCreations--;
            QT_RETHROW;
        }