[Pkg-kde-commits] rev 2471 -
trunk/packages/kdeaccessibility/debian/patches
Christopher Martin
chrsmrtn at costa.debian.org
Wed Nov 30 23:51:43 UTC 2005
Author: chrsmrtn
Date: 2005-11-30 23:51:38 +0000 (Wed, 30 Nov 2005)
New Revision: 2471
Added:
trunk/packages/kdeaccessibility/debian/patches/01_kdeaccessibility_branch_r484482.diff
Log:
kdeaccessibility branch update.
Added: trunk/packages/kdeaccessibility/debian/patches/01_kdeaccessibility_branch_r484482.diff
===================================================================
--- trunk/packages/kdeaccessibility/debian/patches/01_kdeaccessibility_branch_r484482.diff 2005-11-30 22:14:21 UTC (rev 2470)
+++ trunk/packages/kdeaccessibility/debian/patches/01_kdeaccessibility_branch_r484482.diff 2005-11-30 23:51:38 UTC (rev 2471)
@@ -0,0 +1,414 @@
+#DPATCHLEVEL=0
+--- kttsd/compat/interfaces/kspeech/kspeech.h (.../tags/KDE/3.5.0/kdeaccessibility) (revision 484482)
++++ kttsd/compat/interfaces/kspeech/kspeech.h (.../branches/KDE/3.5/kdeaccessibility) (revision 484482)
+@@ -1170,6 +1170,12 @@
+ * Re-start %KTTSD.
+ */
+ virtual void reinit() = 0;
++
++ /**
++ * Return the KTTSD deamon version number.
++ * @since KDE 3.5
++ */
++ virtual QString version() = 0;
+ //@}
+
+ k_dcop_signals:
+--- kttsd/kttsd/kttsd.h (.../tags/KDE/3.5.0/kdeaccessibility) (revision 484482)
++++ kttsd/kttsd/kttsd.h (.../branches/KDE/3.5/kdeaccessibility) (revision 484482)
+@@ -527,6 +527,12 @@
+ */
+ virtual void reinit();
+
++ /**
++ * Return the KTTSD deamon version number.
++ * @since KDE 3.5
++ */
++ virtual QString version();
++
+ protected:
+
+ k_dcop:
+@@ -671,6 +677,7 @@
+ virtual void showDialog();
+ virtual void kttsdExit();
+ virtual void reinit();
++ virtual QString version();
+
+ private:
+ KTTSD m_kttsd;
+--- kttsd/kttsd/speechdata.cpp (.../tags/KDE/3.5.0/kdeaccessibility) (revision 484482)
++++ kttsd/kttsd/speechdata.cpp (.../branches/KDE/3.5/kdeaccessibility) (revision 484482)
+@@ -105,11 +105,12 @@
+ autoExitManager = config->readBoolEntry("AutoExitManager", false);
+
+ // Clear the pool of filter managers so that filters re-init themselves.
+- QIntDictIterator<PooledFilterMgr> it( m_pooledFilterMgrs );
++ QPtrListIterator<PooledFilterMgr> it( m_pooledFilterMgrs );
+ for( ; it.current(); ++it )
+ {
+ PooledFilterMgr* pooledFilterMgr = it.current();
+ delete pooledFilterMgr->filterMgr;
++ delete pooledFilterMgr->talkerCode;
+ delete pooledFilterMgr;
+ }
+ m_pooledFilterMgrs.clear();
+@@ -122,10 +123,11 @@
+ pooledFilterMgr->filterMgr = filterMgr;
+ pooledFilterMgr->busy = false;
+ pooledFilterMgr->job = 0;
++ pooledFilterMgr->partNum = 0;
+ // Connect signals from FilterMgr.
+ connect (filterMgr, SIGNAL(filteringFinished()), this, SLOT(slotFilterMgrFinished()));
+ connect (filterMgr, SIGNAL(filteringStopped()), this, SLOT(slotFilterMgrStopped()));
+- m_pooledFilterMgrs.insert(0, pooledFilterMgr);
++ m_pooledFilterMgrs.append(pooledFilterMgr);
+
+ return true;
+ }
+@@ -211,11 +213,12 @@
+ emit textRemoved(job->appId, job->jobNum);
+ }
+
+- QIntDictIterator<PooledFilterMgr> it( m_pooledFilterMgrs );
++ QPtrListIterator<PooledFilterMgr> it( m_pooledFilterMgrs );
+ for( ; it.current(); ++it )
+ {
+ PooledFilterMgr* pooledFilterMgr = it.current();
+ delete pooledFilterMgr->filterMgr;
++ delete pooledFilterMgr->talkerCode;
+ delete pooledFilterMgr;
+ }
+
+@@ -280,6 +283,7 @@
+ job->talker = talker;
+ job->appId = appId;
+ job->seq = 1;
++ job->partCount = 1;
+ warnings.enqueue( job );
+ job->sentences = QStringList();
+ // Do not apply Sentence Boundary Detection filters to warnings.
+@@ -337,6 +341,7 @@
+ job->talker = talker;
+ job->appId = appId;
+ job->seq = 1;
++ job->partCount = 1;
+ messages.enqueue( job );
+ job->sentences = QStringList();
+ // Do not apply Sentence Boundary Detection filters to messages.
+@@ -460,6 +465,7 @@
+ job->talker = talker;
+ job->state = KSpeech::jsQueued;
+ job->seq = 0;
++ job->partCount = 1;
+ #if NO_FILTERS
+ QStringList tempList = parseText(text, appId);
+ job->sentences = tempList;
+@@ -498,6 +504,7 @@
+ mlJob* job = findJobByJobNum(jobNum);
+ if (job)
+ {
++ job->partCount++;
+ #if NO_FILTERS
+ QStringList tempList = parseText(text, appId);
+ int sentenceCount = job->sentences.count();
+@@ -630,12 +637,18 @@
+ removeAppId = removeJob->appId;
+ removeJobNum = removeJob->jobNum;
+ // If filtering on the job, cancel it.
+- if (m_pooledFilterMgrs[removeJobNum])
+- {
+- PooledFilterMgr* pooledFilterMgr = m_pooledFilterMgrs[removeJobNum];
+- pooledFilterMgr->busy = false;
+- pooledFilterMgr->job = 0;
+- pooledFilterMgr->filterMgr->stopFiltering();
++ 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);
+@@ -782,7 +795,7 @@
+ temp->talker = job->talker;
+ temp->jobNum = job->jobNum;
+ temp->seq = seq;
+- // kdDebug() << "SpeechData::getNextSentenceText: return job number " << temp->jobNum << " seq " << temp->seq << endl;
++ // kdDebug() << "SpeechData::getNextSentenceText: return job number " << temp->jobNum << " seq " << temp->seq << " sentence count = " << job->sentences.count() << endl;
+ } // else kdDebug() << "SpeechData::getNextSentenceText: no more sentences in queue" << endl;
+ return temp;
+ }
+@@ -880,7 +893,7 @@
+ }
+ return jobs;
+ }
+-
++
+ /**
+ * Get the state of a text job.
+ * (thread safe)
+@@ -1099,26 +1112,25 @@
+ */
+ void SpeechData::startJobFiltering(mlJob* job, const QString& text, bool noSBD)
+ {
+- // If filtering is already in progress for this job, do nothing.
+ uint jobNum = job->jobNum;
+- PooledFilterMgr* pooledFilterMgr = m_pooledFilterMgrs[jobNum];
+- if (pooledFilterMgr) return;
++ int partNum = job->partCount;
++ // kdDebug() << "SpeechData::startJobFiltering: jobNum = " << jobNum << " partNum = " << partNum << " text.left(500) = " << text.left(500) << endl;
+ // Find an idle FilterMgr, if any.
+- QIntDictIterator<PooledFilterMgr> it( m_pooledFilterMgrs );
++ // If filtering is already in progress for this job and part, do nothing.
++ PooledFilterMgr* pooledFilterMgr = 0;
++ QPtrListIterator<PooledFilterMgr> it( m_pooledFilterMgrs );
+ for( ; it.current(); ++it )
+ {
+- if (!it.current()->busy)
+- {
+- // Reindex the pooled FilterMgr on the new job number.
+- int oldJobNum = it.currentKey();
+- pooledFilterMgr = m_pooledFilterMgrs.take(oldJobNum);
+- m_pooledFilterMgrs.insert(jobNum, pooledFilterMgr);
+- break;
++ if (it.current()->busy) {
++ if ((it.current()->job->jobNum == jobNum) && (it.current()->partNum == partNum)) return;
++ } else {
++ if (!it.current()->job && !pooledFilterMgr) pooledFilterMgr = it.current();
+ }
+ }
+ // Create a new FilterMgr if needed and add to pool.
+ if (!pooledFilterMgr)
+ {
++ // kdDebug() << "SpeechData::startJobFiltering: adding new pooledFilterMgr for job " << jobNum << " part " << partNum << endl;
+ pooledFilterMgr = new PooledFilterMgr();
+ FilterMgr* filterMgr = new FilterMgr();
+ filterMgr->init(config, "General");
+@@ -1126,11 +1138,13 @@
+ // Connect signals from FilterMgr.
+ connect (filterMgr, SIGNAL(filteringFinished()), this, SLOT(slotFilterMgrFinished()));
+ connect (filterMgr, SIGNAL(filteringStopped()), this, SLOT(slotFilterMgrStopped()));
+- m_pooledFilterMgrs.insert(jobNum, pooledFilterMgr);
++ m_pooledFilterMgrs.append(pooledFilterMgr);
+ }
++ // else kdDebug() << "SpeechData::startJobFiltering: re-using idle pooledFilterMgr for job " << jobNum << " part " << partNum << endl;
+ // Flag the FilterMgr as busy and set it going.
+ pooledFilterMgr->busy = true;
+ pooledFilterMgr->job = job;
++ pooledFilterMgr->partNum = partNum;
+ pooledFilterMgr->filterMgr->setNoSBD( noSBD );
+ // Get TalkerCode structure of closest matching Talker.
+ pooledFilterMgr->talkerCode = m_talkerMgr->talkerToTalkerCode(job->talker);
+@@ -1150,16 +1164,27 @@
+ #if NO_FILTERS
+ return;
+ #endif
+- PooledFilterMgr* pooledFilterMgr = m_pooledFilterMgrs[job->jobNum];
+- if (!pooledFilterMgr) return;
+- if (pooledFilterMgr->busy)
++ uint jobNum = job->jobNum;
++ bool waited = false;
++ QPtrListIterator<PooledFilterMgr> it(m_pooledFilterMgrs);
++ for ( ; it.current(); ++it )
+ {
+- if (!pooledFilterMgr->filterMgr->noSBD())
+- kdDebug() << "SpeechData::waitJobFiltering: Waiting for filter to finish. Not optimium. " <<
+- "Try waiting for textSet signal before querying for job information." << endl;
+- pooledFilterMgr->filterMgr->waitForFinished();
++ PooledFilterMgr* pooledFilterMgr = it.current();
++ if (pooledFilterMgr->busy)
++ {
++ if (pooledFilterMgr->job->jobNum == jobNum)
++ {
++ if (!pooledFilterMgr->filterMgr->noSBD())
++ kdDebug() << "SpeechData::waitJobFiltering: Waiting for filter to finish. Not optimium. " <<
++ "Try waiting for textSet signal before querying for job information." << endl;
++ pooledFilterMgr->filterMgr->waitForFinished();
++ // kdDebug() << "SpeechData::waitJobFiltering: waiting for job " << jobNum << endl;
++ waited = true;
++ }
++ }
++ }
++ if (waited)
+ doFiltering();
+- }
+ }
+
+ /**
+@@ -1168,12 +1193,12 @@
+ */
+ void SpeechData::doFiltering()
+ {
+- // kdDebug() << "SpeechData::doFiltering: Running." << endl;
++ // kdDebug() << "SpeechData::doFiltering: Running. " << m_pooledFilterMgrs.count() << " filters in pool." << endl;
+ bool again = true;
+ while (again)
+ {
+ again = false;
+- QIntDictIterator<PooledFilterMgr> it( m_pooledFilterMgrs );
++ QPtrListIterator<PooledFilterMgr> it( m_pooledFilterMgrs );
+ for( ; it.current(); ++it )
+ {
+ PooledFilterMgr* pooledFilterMgr = it.current();
+@@ -1183,43 +1208,56 @@
+ FilterMgr* filterMgr = pooledFilterMgr->filterMgr;
+ if (filterMgr->getState() == FilterMgr::fsFinished)
+ {
+- pooledFilterMgr->busy = false;
+ mlJob* job = pooledFilterMgr->job;
+- // Retrieve text from FilterMgr.
+- QString text = filterMgr->getOutput();
+- // kdDebug() << "SpeechData::doFiltering: text.left(500) = " << text.left(500) << endl;
+- // kdDebug() << "SpeechData::doFiltering: filtered text: " << text << 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
++ // 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))
+ {
+- // 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;
+- // Emit signal.
+- if (!filterMgr->noSBD())
+- {
+- if (partNum == 1)
+- emit textSet(job->appId, job->jobNum);
++ 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
+- emit textAppended(job->appId, job->jobNum, partNum);
++ {
++ // 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;
+ }
+ }
+ }
+--- kttsd/kttsd/speechdata.h (.../tags/KDE/3.5.0/kdeaccessibility) (revision 484482)
++++ kttsd/kttsd/speechdata.h (.../branches/KDE/3.5/kdeaccessibility) (revision 484482)
+@@ -28,7 +28,6 @@
+ // Qt includes.
+ #include <qptrqueue.h>
+ #include <qptrlist.h>
+-#include <qintdict.h>
+ #include <qstring.h>
+ #include <qstringlist.h>
+ #include <qmap.h>
+@@ -67,6 +66,7 @@
+ int seq; /* Current sentence being spoken. */
+ QValueList<int> partSeqNums; /* List containing last sequence number for each part of a job. */
+ QStringList sentences; /* List of sentences in the job. */
++ int partCount; /* Number of parts in the job. */
+ };
+
+ /**
+@@ -76,6 +76,7 @@
+ FilterMgr* filterMgr; /* The FilterMgr object. */
+ bool busy; /* True if the FilterMgr is busy. */
+ mlJob* job; /* The job the FilterMgr is filtering. */
++ int partNum; /* The part number of the job that is filtering. */
+ TalkerCode* talkerCode; /* TalkerCode object passed to FilterMgr. */
+ };
+
+@@ -628,7 +629,7 @@
+ /**
+ * Pool of FilterMgrs.
+ */
+- QIntDict<PooledFilterMgr> m_pooledFilterMgrs;
++ QPtrList<PooledFilterMgr> m_pooledFilterMgrs;
+
+ /**
+ * Job counter. Each new job increments this counter.
+--- kttsd/kttsd/kttsd.cpp (.../tags/KDE/3.5.0/kdeaccessibility) (revision 484482)
++++ kttsd/kttsd/kttsd.cpp (.../branches/KDE/3.5/kdeaccessibility) (revision 484482)
+@@ -34,6 +34,7 @@
+ #include <dcopclient.h>
+ #include <knotifyclient.h>
+ #include <krun.h>
++#include <kaboutdata.h>
+
+ // KTTS includes.
+ #include "notify.h"
+@@ -843,6 +844,11 @@
+ ready();
+ }
+
++/**
++* Return KTTSD daemon version number.
++*/
++QString KTTSD::version() { return kapp->aboutData()->version(); }
++
+ /*
+ * Checks if KTTSD is ready to speak and at least one talker is configured.
+ * If not, user is prompted to display the configuration dialog.
+@@ -1170,6 +1176,8 @@
+ { m_kttsd.kttsdExit(); }
+ /*virtual*/ void kspeech::reinit()
+ { m_kttsd.reinit(); }
++/*virtual*/ QString kspeech::version()
++ { return m_kttsd.version(); }
+
+ #include "kttsd.moc"
+
More information about the pkg-kde-commits
mailing list