示例#1
0
void CCLayerAnimationControllerImpl::animate(double frameBeginTimeSecs)
{
    startAnimationsWaitingForNextTick(frameBeginTimeSecs);
    startAnimationsWaitingForStartTime(frameBeginTimeSecs);
    startAnimationsWaitingForTargetAvailability(frameBeginTimeSecs);
    resolveConflicts(frameBeginTimeSecs);
    tickAnimations(frameBeginTimeSecs);
    purgeFinishedAnimations();
    startAnimationsWaitingForTargetAvailability(frameBeginTimeSecs);
}
void CCLayerAnimationController::animate(double monotonicTime, CCAnimationEventsVector* events)
{
    startAnimationsWaitingForNextTick(monotonicTime, events);
    startAnimationsWaitingForStartTime(monotonicTime, events);
    startAnimationsWaitingForTargetAvailability(monotonicTime, events);
    resolveConflicts(monotonicTime);
    tickAnimations(monotonicTime);
    purgeFinishedAnimations(monotonicTime, events);
    startAnimationsWaitingForTargetAvailability(monotonicTime, events);
}
示例#3
0
void CCLayerAnimationController::animateForReal(double monotonicTime, CCAnimationEventsVector* events)
{
    startAnimationsWaitingForExtraTick(monotonicTime, events);
    startAnimationsWaitingForNextTick(monotonicTime, events);
    startAnimationsWaitingForStartTime(monotonicTime, events);
    startAnimationsWaitingForTargetAvailability(monotonicTime, events);
    resolveConflicts(monotonicTime);
    tickAnimations(monotonicTime, m_client, true);
    markAnimationsForDeletion(monotonicTime);
    startAnimationsWaitingForTargetAvailability(monotonicTime, events);
}
void
GContactClient::networkRequestFinished ()
{
    FUNCTION_CALL_TRACE;

    // o Error - if network error, set the sync results with the code
    // o Call uninit
    // o Stop sync
    // o If success, invoke the mParser->parse () and connect
    // to the parse complete signal

    const QNetworkReply* reply = mTransport->reply ();
    if (reply)
    {
        QByteArray data = mTransport->replyBody ();
        LOG_DEBUG (data);
        if (data.isNull ())
        {
            LOG_DEBUG ("Nothing returned from server");
            return;
        }
        mParser->setParseData (data);

        mParser->parse ();

        // Get the atom object
        GAtom* atom = mParser->atom ();
        if (atom)
        {
            QList<GContactEntry*> remoteContacts = atom->entries ();
            if (remoteContacts.size () > 0)
            {
                QList<QContact> remoteQContacts = toQContacts (remoteContacts);
                if (mSlowSync == true)
                {
                    storeToLocal (remoteQContacts);
                } else
                {
                    // Filter added/modified/deleted entries from the list
                    remoteAddedModifiedDeletedContacts (remoteContacts);

                    // Resolve conflicts
                    resolveConflicts ();

                    // Store the rest of the contacts to device
                    storeToLocal ();
                }
            }
        }
    }
}
bool
GContactClient::storeToLocal (const QList<GContactEntry*> remoteContacts)
{
    FUNCTION_CALL_TRACE;

    bool syncSuccess = false;
    if (mSlowSync == true)
    {
        LOG_DEBUG ("@@@storeToLocal#SLOW SYNC");
        // Since we request for all the deleted contacts, if
        // slow sync is performed many times, even deleted contacts
        // will appear in *remoteContacts. Filter them out while
        // saving them to device
        LOG_DEBUG ("TOTAL REMOTE CONTACTS:" << remoteContacts.size ());
        if (remoteContacts.size () > 0)
        {
            QList<QContact> remoteQContacts = toQContacts (remoteContacts);
            QMap<int, GContactsStatus> statusMap;

            if (mContactBackend->addContacts (remoteQContacts, statusMap))
            {
                // TODO: Saving succeeded. Update sync results
                syncSuccess = true;
            } else
            {
                // TODO: Saving failed. Update sync results and probably stop sync
                syncSuccess = false;
            }
        }
    } else if (mSlowSync == false)
    {
        LOG_DEBUG ("@@@storeToLocal#FAST SYNC");
        QList<GContactEntry*> remoteAddedContacts, remoteModifiedContacts, remoteDeletedContacts;
        filterRemoteAddedModifiedDeletedContacts (remoteContacts,
                                                  remoteAddedContacts,
                                                  remoteModifiedContacts,
                                                  remoteDeletedContacts);

        resolveConflicts(remoteModifiedContacts, remoteDeletedContacts);

        LOG_DEBUG ("###REMOTED ADDED=" << remoteAddedContacts.size ());
        LOG_DEBUG ("###REMOTED MODIFIED=" << remoteModifiedContacts.size ());
        LOG_DEBUG ("###REMOTED DELETED=" << remoteDeletedContacts.size ());
        if (remoteAddedContacts.size () > 0)
        {
            LOG_DEBUG ("***Adding " << remoteAddedContacts.size () << " contacts");
            QList<QContact> addedContacts = toQContacts (remoteAddedContacts);
            QMap<int, GContactsStatus> addedStatusMap;
            if (mContactBackend->addContacts (addedContacts, addedStatusMap))
                syncSuccess = true;
            else
                syncSuccess = false;
        }

        if (remoteModifiedContacts.size () > 0)
        {
            LOG_DEBUG ("***Modifying " << remoteModifiedContacts.size () << " contacts");
            QList<QContact> modifiedContacts = toQContacts (remoteModifiedContacts);

            QStringList modifiedIdsList;
            for (int i=0; i<modifiedContacts.size (); i++) {
                QContact contact = mContactBackend->getContact(remoteModifiedContacts.at(i)->guid());
                LOG_DEBUG("Original contact - " << contact.id().toString());
                modifiedIdsList << contact.id().toString();
            }

            QMap<int, GContactsStatus> modifiedStatusMap =
            mContactBackend->modifyContacts (modifiedContacts, modifiedIdsList);

            if (modifiedStatusMap.size () > 0)
            {
                syncSuccess = true;
            } else
            {
                syncSuccess = false;
            }
        }

        if (remoteDeletedContacts.size () > 0)
        {
            LOG_DEBUG ("***Deleting " << remoteDeletedContacts.size () << " contacts");
            QStringList guidList;
            for (int i=0; i<remoteDeletedContacts.size(); i++)
                guidList << remoteDeletedContacts.at(i)->guid();

            QStringList localIdList = mContactBackend->localIds(guidList);
            QMap<int, GContactsStatus> deletedStatusMap =
                    mContactBackend->deleteContacts (localIdList);
            if (deletedStatusMap.size () > 0) {
                syncSuccess = true;
            } else {
                syncSuccess = false;
            }
        }
    }
    return syncSuccess;
}