コード例 #1
0
// -----------------------------------------------------------------------------
// CTestSDKHierarchicalLists::TestHLSCLSetTextCIL
// -----------------------------------------------------------------------------
TInt CTestSDKHierarchicalLists::TestHLSCLSetTextCIL( CStifItemParser& /*aItem*/ )
    {
    CTestControl* control = CTestControl::NewL();
    CleanupStack::PushL( control );
    STIF_ASSERT_NOT_NULL( control );
    
    CAknSingleColumnStyleTreeList* treeList = CAknSingleColumnStyleTreeList::NewLC( *control );
    STIF_ASSERT_NOT_NULL( treeList );
    
    _LIT( KFirstColumn, "FirstColumn" );
    TBuf<KLength> firstColumn( KFirstColumn );
    _LIT( KSecondColumn, "SecondColumn" );
    TUint32 flags = CAknSingleColumnStyleTreeList::EPersistent;
    TAknTreeItemID id = treeList->AddCoreDataRowL( KAknTreeIIDRoot, firstColumn, KSecondColumn, flags, ETrue );
    STIF_ASSERT_NOT_EQUALS( 0, id );
    
    _LIT( KFirstColumnSet, "Change" );
    TBuf<KLength> textSet( KFirstColumnSet );
    treeList->SetTextL( id, textSet, 0, ETrue );
    
    TBuf<KLength> firstColumnGet = treeList->Text( id, 0 );
    STIF_ASSERT_EQUALS( 0, firstColumnGet.Compare( textSet ) );
    
    CleanupStack::PopAndDestroy( treeList );
    CleanupStack::PopAndDestroy( control );
    
    return KErrNone;
    
    }
コード例 #2
0
/**
* Queues a text job.
*/
uint SpeechData::setText( const QString &text, const QString &talker, const QCString &appId)
{
    // kdDebug() << "Running: SpeechData::setText" << endl;
    mlJob* job = new mlJob;
    ++jobCounter;
    if (jobCounter == 0) ++jobCounter;  // Overflow is OK, but don't want any 0 jobNums.
    uint jobNum = jobCounter;
    job->jobNum = jobNum;
    job->appId = appId;
    job->talker = talker;
    job->state = KSpeech::jsQueued;
    job->seq = 0;
    job->partCount = 1;
#if NO_FILTERS
    QStringList tempList = parseText(text, appId);
    job->sentences = tempList;
    job->partSeqNums.append(tempList.count());
    textJobs.append(job);
    emit textSet(appId, jobNum);
#else
    job->sentences = QStringList();
    job->partSeqNums = QValueList<int>();
    textJobs.append(job);
    startJobFiltering(job, text, false);
#endif
    return jobNum;
}
コード例 #3
0
ファイル: objectText.hpp プロジェクト: maniacs-games/DrCreep
	void partPlace() {
		textSet();
		cObject::partPlace();
	}
コード例 #4
0
/**
* Processes filters by looping across the pool of FilterMgrs.
* As each FilterMgr finishes, emits appropriate signals and flags it as no longer busy.
*/
void SpeechData::doFiltering()
{
    // kdDebug() << "SpeechData::doFiltering: Running. " << m_pooledFilterMgrs.count() << " filters in pool." <<  endl;
    bool again = true;
    while (again)
    {
        again = false;
        QPtrListIterator<PooledFilterMgr> it( m_pooledFilterMgrs );
        for( ; it.current(); ++it )
        {
            PooledFilterMgr* pooledFilterMgr = it.current();
            // If FilterMgr is busy, see if it is now finished.
            if (pooledFilterMgr->busy)
            {
                FilterMgr* filterMgr = pooledFilterMgr->filterMgr;
                if (filterMgr->getState() == FilterMgr::fsFinished)
                {
                    mlJob* job = pooledFilterMgr->job;
                    // kdDebug() << "SpeechData::doFiltering: filter finished, jobNum = " << job->jobNum << " partNum = " << pooledFilterMgr->partNum << endl;
                    // We have to retrieve parts in order, but parts may not be completed in order.
                    // See if this is the next part we need.
                    if ((int)job->partSeqNums.count() == (pooledFilterMgr->partNum - 1))
                    {
                        pooledFilterMgr->busy = false;
                        // Retrieve text from FilterMgr.
                        QString text = filterMgr->getOutput();
                        // kdDebug() << "SpeechData::doFiltering: text.left(500) = " << text.left(500) << endl;
                        filterMgr->ackFinished();
                        // Convert the TalkerCode back into string.
                        job->talker = pooledFilterMgr->talkerCode->getTalkerCode();
                        // TalkerCode object no longer needed.
                        delete pooledFilterMgr->talkerCode;
                        pooledFilterMgr->talkerCode = 0;
                        if (filterMgr->noSBD())
                            job->sentences = text;
                        else
                        {
                            // Split the text into sentences and store in the job.
                            // The SBD plugin does all the real sentence parsing, inserting tabs at each
                            // sentence boundary.
                            QStringList sentences = QStringList::split("\t", text, false);
                            int sentenceCount = job->sentences.count();
                            job->sentences += sentences;
                            job->partSeqNums.append(sentenceCount + sentences.count());
                        }
                        int partNum = job->partSeqNums.count();
                        // Clean up.
                        pooledFilterMgr->job = 0;
                        pooledFilterMgr->partNum = 0;
                        // Emit signal.
                        if (!filterMgr->noSBD())
                        {
                            if (partNum == 1)
                                emit textSet(job->appId, job->jobNum);
                            else
                                emit textAppended(job->appId, job->jobNum, partNum);
                        }
                    } else {
                        // A part is ready, but need to first process a finished preceeding part
                        // that follows this one in the pool of filter managers.
                        again = true;
                        // kdDebug() << "SpeechData::doFiltering: filter is finished, but must wait for earlier part to finish filter, job = " << pooledFilterMgr->job->jobNum << endl;
                    }
                }
                // else kdDebug() << "SpeechData::doFiltering: filter for job " << pooledFilterMgr->job->jobNum << " is busy." << endl;
            }
            // else kdDebug() << "SpeechData::doFiltering: filter is idle" << endl;
        }
    }
}