/** * Remove a text job from the queue. * (thread safe) * @param jobNum Job number of the text job. * * The job is deleted from the queue and the textRemoved signal is emitted. */ void SpeechData::removeText(const uint jobNum) { // kdDebug() << "Running: SpeechData::removeText" << endl; uint removeJobNum = 0; QCString removeAppId; // The appId of the removed (and stopped) job. mlJob* removeJob = findJobByJobNum(jobNum); if (removeJob) { removeAppId = removeJob->appId; removeJobNum = removeJob->jobNum; // If filtering on the job, cancel it. QPtrListIterator<PooledFilterMgr> it( m_pooledFilterMgrs ); for ( ; it.current(); ++it ) { PooledFilterMgr* pooledFilterMgr = it.current(); if (pooledFilterMgr->job && (pooledFilterMgr->job->jobNum == removeJobNum)) { pooledFilterMgr->busy = false; pooledFilterMgr->job = 0; pooledFilterMgr->partNum = 0; delete pooledFilterMgr->talkerCode; pooledFilterMgr->talkerCode = 0; pooledFilterMgr->filterMgr->stopFiltering(); } } // Delete the job. textJobs.removeRef(removeJob); } if (removeJobNum) emit textRemoved(removeAppId, removeJobNum); }
/** * Delete expired jobs. At most, one finished job is kept on the queue. * @param finishedJobNum Job number of a job that just finished. * The just finished job is not deleted, but any other finished jobs are. * Does not change the textJobs.current() pointer. */ void SpeechData::deleteExpiredJobs(const uint finishedJobNum) { // Save current pointer. typedef QPair<QCString, uint> removedJob; typedef QValueList<removedJob> removedJobsList; removedJobsList removedJobs; // Walk through jobs and delete any other finished jobs. for (mlJob* job = textJobs.first(); (job); job = textJobs.next()) { if (job->jobNum != finishedJobNum && job->state == KSpeech::jsFinished) { removedJobs.append(removedJob(job->appId, job->jobNum)); textJobs.removeRef(job); } } // Emit signals for removed jobs. removedJobsList::const_iterator it; removedJobsList::const_iterator endRemovedJobsList(removedJobs.constEnd()); for (it = removedJobs.constBegin(); it != endRemovedJobsList ; ++it) { QCString appId = (*it).first; uint jobNum = (*it).second; textRemoved(appId, jobNum); } }
KateLayoutCache::KateLayoutCache(KateRenderer* renderer, QObject* parent) : QObject(parent) , m_renderer(renderer) , m_startPos(-1,-1) , m_viewWidth(0) , m_wrap(false) , m_acceptDirtyLayouts (false) { Q_ASSERT(m_renderer); /** * connect to all possible editing primitives */ connect(&m_renderer->doc()->buffer(), SIGNAL(lineWrapped(KTextEditor::Cursor)), this, SLOT(wrapLine(KTextEditor::Cursor))); connect(&m_renderer->doc()->buffer(), SIGNAL(lineUnwrapped(int)), this, SLOT(unwrapLine(int))); connect(&m_renderer->doc()->buffer(), SIGNAL(textInserted(KTextEditor::Cursor,QString)), this, SLOT(insertText(KTextEditor::Cursor,QString))); connect(&m_renderer->doc()->buffer(), SIGNAL(textRemoved(KTextEditor::Range,QString)), this, SLOT(removeText(KTextEditor::Range))); }
/** * Destructor */ SpeechData::~SpeechData(){ // kdDebug() << "Running: SpeechData::~SpeechData()" << endl; // Walk through jobs and emit a textRemoved signal for each job. for (mlJob* job = textJobs.first(); (job); job = textJobs.next()) { emit textRemoved(job->appId, job->jobNum); } QPtrListIterator<PooledFilterMgr> it( m_pooledFilterMgrs ); for( ; it.current(); ++it ) { PooledFilterMgr* pooledFilterMgr = it.current(); delete pooledFilterMgr->filterMgr; delete pooledFilterMgr->talkerCode; delete pooledFilterMgr; } delete config; }
void TextBuffer::removeText (const KTextEditor::Range &range) { // only allowed if editing transaction running Q_ASSERT (m_editingTransactions > 0); // only ranges on one line are supported Q_ASSERT (range.start().line() == range.end().line()); // start colum <= end column and >= 0 Q_ASSERT (range.start().column() <= range.end().column()); Q_ASSERT (range.start().column() >= 0); // skip work, if no text to remove if (range.isEmpty()) return; // get block, this will assert on invalid line int blockIndex = blockForLine (range.start().line()); // let the block handle the removeText, retrieve removed text QString text; m_blocks.at(blockIndex)->removeText (range, text); // remember changes ++m_revision; // update changed line interval if (range.start().line() < m_editingMinimalLineChanged || m_editingMinimalLineChanged == -1) m_editingMinimalLineChanged = range.start().line(); if (range.start().line() > m_editingMaximalLineChanged) m_editingMaximalLineChanged = range.start().line(); // emit signal about done change emit textRemoved (range, text); }