Exemple #1
0
/*!
  Ends all calls, whether dialing, active, incoming, or on hold.
*/
void DialerControl::endAllCalls()
{
    QList<QPhoneCall> calls = allCalls();
    QList<QPhoneCall>::Iterator iter;
    for ( iter = calls.begin(); iter != calls.end(); ++iter ) {
        (*iter).hangup();
    }
}
Exemple #2
0
/*!
  Returns true if there are any calls on hold.
*/
bool DialerControl::hasCallsOnHold() const
{
    //optimized operation
    QList<QPhoneCall> calls = allCalls();
    for( QList<QPhoneCall>::ConstIterator it = calls.begin() ; it != calls.end() ;
                                                                                ++it )
        if( (*it).state() == QPhoneCall::Hold )
            return true;
    return false;
}
Exemple #3
0
/*!
  Returns the list of calls in the active state (i.e. not on hold).
*/
QList<QPhoneCall> DialerControl::activeCalls() const
{
    QList<QPhoneCall> ac;
    QList<QPhoneCall> calls = allCalls();
    QList<QPhoneCall>::ConstIterator iter;
    for ( iter = calls.begin(); iter != calls.end(); ++iter ) {
        if ( (*iter).state() == QPhoneCall::Connected) {
            ac += (*iter);
        }
    }
    return ac;
}
Exemple #4
0
QList<QPhoneCall> DialerControl::findCalls( QPhoneCall::State st ) const
{
    QList<QPhoneCall> results;
    QList<QPhoneCall> calls = allCalls();
    QList<QPhoneCall>::ConstIterator iter;
    for ( iter = calls.begin(); iter != calls.end(); ++iter ) {
        if ( (*iter).state() == st ) {
            results += (*iter);
        }
    }
    return results;
}
Exemple #5
0
QPhoneCall DialerControl::active() const
{
    QList<QPhoneCall> localCalls = allCalls();
    QList<QPhoneCall>::ConstIterator iter;
    for ( iter = localCalls.begin(); iter != localCalls.end(); ++iter ) {
        if ( (*iter).state() == QPhoneCall::Connected ||
             (*iter).state() == QPhoneCall::Dialing ||
             (*iter).state() == QPhoneCall::Alerting ) {
            return *iter;
        }
    }
    return QPhoneCall();
}
Exemple #6
0
QVector<ApiTraceCall*>
TraceLoader::fetchFrameContents(ApiTraceFrame *currentFrame)
{
    Q_ASSERT(currentFrame);

    if (currentFrame->isLoaded()) {
        return currentFrame->calls();
    }

    if (m_parser.supportsOffsets()) {
        unsigned frameIdx = currentFrame->number;
        int numOfCalls = numberOfCallsInFrame(frameIdx);

        if (numOfCalls) {
            quint64 binaryDataSize = 0;
            QStack<ApiTraceCall*> groups;
            QVector<ApiTraceCall*> topLevelItems;
            QVector<ApiTraceCall*> allCalls(numOfCalls);
            const FrameBookmark &frameBookmark = m_frameBookmarks[frameIdx];

            m_parser.setBookmark(frameBookmark.start);

            trace::Call *call;
            int parsedCalls = 0;
            while ((call = m_parser.parse_call())) {
                ApiTraceCall *apiCall =
                    apiCallFromTraceCall(call, m_helpHash,
                                         currentFrame, groups.isEmpty() ? 0 : groups.top(), this);
                Q_ASSERT(apiCall);
                Q_ASSERT(parsedCalls < allCalls.size());
                allCalls[parsedCalls++] = apiCall;
                if (groups.count() == 0) {
                    topLevelItems.append(apiCall);
                } else {
                    groups.top()->addChild(apiCall);
                }
                if (call->flags & trace::CALL_FLAG_MARKER_PUSH) {
                    groups.push(apiCall);
                } else if (call->flags & trace::CALL_FLAG_MARKER_POP) {
                    if (groups.count()) {
                        groups.top()->finishedAddingChildren();
                        groups.pop();
                    }
                }
                if (apiCall->hasBinaryData()) {
                    QByteArray data =
                        apiCall->arguments()[
                            apiCall->binaryDataIndex()].toByteArray();
                    binaryDataSize += data.size();
                }

                delete call;

                if (apiCall->flags() & trace::CALL_FLAG_END_FRAME) {
                    break;
                }

            }
            // There can be fewer parsed calls when call in different
            // threads cross the frame boundary
            Q_ASSERT(parsedCalls <= numOfCalls);
            Q_ASSERT(parsedCalls <= allCalls.size());
            allCalls.resize(parsedCalls);
            allCalls.squeeze();

            Q_ASSERT(parsedCalls <= currentFrame->numChildrenToLoad());
            if (topLevelItems.count() == allCalls.count()) {
                emit frameContentsLoaded(currentFrame, allCalls,
                                         allCalls, binaryDataSize);
            } else {
                emit frameContentsLoaded(currentFrame, topLevelItems,
                                         allCalls, binaryDataSize);
            }
            return allCalls;
        }
    }
    return QVector<ApiTraceCall*>();
}