summaryrefslogtreecommitdiffstats
path: root/kttsd/filters/sbd/sbdproc.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-17 22:17:08 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-17 22:17:08 +0000
commitf138d74fe16092003b06f5bde9663841929cde7f (patch)
treee9c497a0e59bc7d34264ac9404740d2ea76f3de4 /kttsd/filters/sbd/sbdproc.cpp
parent3a3c4b256baee79bdcfe72c5e01b9ded9b525900 (diff)
downloadtdeaccessibility-f138d74fe16092003b06f5bde9663841929cde7f.tar.gz
tdeaccessibility-f138d74fe16092003b06f5bde9663841929cde7f.zip
TQt4 port kdeaccessibility
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaccessibility@1237325 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kttsd/filters/sbd/sbdproc.cpp')
-rw-r--r--kttsd/filters/sbd/sbdproc.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/kttsd/filters/sbd/sbdproc.cpp b/kttsd/filters/sbd/sbdproc.cpp
index 6117b11..6b0a1a4 100644
--- a/kttsd/filters/sbd/sbdproc.cpp
+++ b/kttsd/filters/sbd/sbdproc.cpp
@@ -21,7 +21,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
******************************************************************************/
-// Qt includes.
+// TQt includes.
#include <tqregexp.h>
#include <tqdom.h>
#include <tqapplication.h>
@@ -41,8 +41,8 @@
/**
* Constructor.
*/
-SbdThread::SbdThread( TQObject *parent, const char *name ) :
- TQObject( parent, name ),
+SbdThread::SbdThread( TQObject *tqparent, const char *name ) :
+ TQObject( tqparent, name ),
TQThread()
{
}
@@ -175,7 +175,7 @@ void SbdThread::pushSsmlElem( SsmlElemType et, const TQDomElement& elem )
// i.e., name="value".
TQString SbdThread::makeAttr( const TQString& name, const TQString& value )
{
- if ( value.isEmpty() ) return TQString::null;
+ if ( value.isEmpty() ) return TQString();
return " " + name + "=\"" + value + "\"";
}
@@ -277,8 +277,8 @@ TQString SbdThread::makeSentence( const TQString& text )
if ( !e.isEmpty() ) s += e;
// Escape ampersands and less thans.
TQString newText = text;
- newText.replace(TQRegExp("&(?!amp;)"), "&amp;");
- newText.replace(TQRegExp("<(?!lt;)"), "&lt;");
+ newText.tqreplace(TQRegExp("&(?!amp;)"), "&amp;");
+ newText.tqreplace(TQRegExp("<(?!lt;)"), "&lt;");
s += newText;
if ( !e.isEmpty() ) s += "</emphasis>";
if ( !p.isEmpty() ) s += "</prosody>";
@@ -289,7 +289,7 @@ TQString SbdThread::makeSentence( const TQString& text )
// Starts a sentence by returning a speak tag.
TQString SbdThread::startSentence()
{
- if ( m_sentenceStarted ) return TQString::null;
+ if ( m_sentenceStarted ) return TQString();
TQString s;
s += makeSsmlElem( etSpeak );
m_sentenceStarted = true;
@@ -299,14 +299,14 @@ TQString SbdThread::startSentence()
// Ends a sentence and appends a Tab.
TQString SbdThread::endSentence()
{
- if ( !m_sentenceStarted ) return TQString::null;
+ if ( !m_sentenceStarted ) return TQString();
TQString s = "</speak>";
s += "\t";
m_sentenceStarted = false;
return s;
}
-// Parses a node of the SSML tree and recursively parses its children.
+// Parses a node of the SSML tree and recursively parses its tqchildren.
// Returns the filtered text with each sentence a complete ssml tree.
TQString SbdThread::parseSsmlNode( TQDomNode& n, const TQString& re )
{
@@ -351,7 +351,7 @@ TQString SbdThread::parseSsmlNode( TQDomNode& n, const TQString& re )
case TQDomNode::TextNode: { // = 3
TQString s = parsePlainText( n.toText().data(), re );
// TQString d = s;
- // d.replace("\t", "\\t");
+ // d.tqreplace("\t", "\\t");
// kdDebug() << "SbdThread::parseSsmlNode: parsedPlainText = [" << d << "]" << endl;
TQStringList sentenceList = TQStringList::split( '\t', s, false );
int lastNdx = sentenceList.count() - 1;
@@ -441,7 +441,7 @@ TQString SbdThread::parseSsml( const TQString& inputText, const TQString& re )
// This flag is used to close out a previous sentence.
m_sentenceStarted = false;
- // Get the root element (speak) and recursively process its children.
+ // Get the root element (speak) and recursively process its tqchildren.
TQDomElement docElem = doc.documentElement();
TQDomNode n = docElem.firstChild();
TQString ssml = parseSsmlNode( docElem, re );
@@ -457,13 +457,13 @@ TQString SbdThread::parseCode( const TQString& inputText )
{
TQString temp = inputText;
// Replace newlines with tabs.
- temp.replace("\n","\t");
+ temp.tqreplace("\n","\t");
// Remove leading spaces.
- temp.replace(TQRegExp("\\t +"), "\t");
+ temp.tqreplace(TQRegExp("\\t +"), "\t");
// Remove trailing spaces.
- temp.replace(TQRegExp(" +\\t"), "\t");
+ temp.tqreplace(TQRegExp(" +\\t"), "\t");
// Remove blank lines.
- temp.replace(TQRegExp("\t\t+"),"\t");
+ temp.tqreplace(TQRegExp("\t\t+"),"\t");
return temp;
}
@@ -474,16 +474,16 @@ TQString SbdThread::parsePlainText( const TQString& inputText, const TQString& r
TQRegExp sentenceDelimiter = TQRegExp( re );
TQString temp = inputText;
// Replace sentence delimiters with tab.
- temp.replace(sentenceDelimiter, m_configuredSentenceBoundary);
+ temp.tqreplace(sentenceDelimiter, m_configuredSentenceBoundary);
// Replace remaining newlines with spaces.
- temp.replace("\n"," ");
- temp.replace("\r"," ");
+ temp.tqreplace("\n"," ");
+ temp.tqreplace("\r"," ");
// Remove leading spaces.
- temp.replace(TQRegExp("\\t +"), "\t");
+ temp.tqreplace(TQRegExp("\\t +"), "\t");
// Remove trailing spaces.
- temp.replace(TQRegExp(" +\\t"), "\t");
+ temp.tqreplace(TQRegExp(" +\\t"), "\t");
// Remove blank lines.
- temp.replace(TQRegExp("\t\t+"),"\t");
+ temp.tqreplace(TQRegExp("\t\t+"),"\t");
return temp;
}
@@ -503,7 +503,7 @@ TQString SbdThread::parsePlainText( const TQString& inputText, const TQString& r
{
// Examine just the first 500 chars to see if it is code.
TQString p = m_text.left( 500 );
- if ( p.contains( TQRegExp( "(/\\*)|(if\\b\\()|(^#include\\b)" ) ) )
+ if ( p.tqcontains( TQRegExp( "(/\\*)|(if\\b\\()|(^#include\\b)" ) ) )
textType = ttCode;
else
textType = ttPlain;
@@ -515,7 +515,7 @@ TQString SbdThread::parsePlainText( const TQString& inputText, const TQString& r
if ( re.isEmpty() ) re = m_configuredRe;
// Replace spaces, tabs, and formfeeds with a single space.
- m_text.replace(TQRegExp("[ \\t\\f]+"), " ");
+ m_text.tqreplace(TQRegExp("[ \\t\\f]+"), " ");
// Perform the filtering based on type of text.
switch ( textType )
@@ -534,7 +534,7 @@ TQString SbdThread::parsePlainText( const TQString& inputText, const TQString& r
}
// Clear app-specified sentence delimiter. App must call setSbRegExp for each conversion.
- m_re = TQString::null;
+ m_re = TQString();
// kdDebug() << "SbdThread::run: filtered text = " << m_text << endl;
@@ -562,11 +562,11 @@ bool SbdThread::event ( TQEvent * e )
/**
* Constructor.
*/
-SbdProc::SbdProc( TQObject *parent, const char *name, const TQStringList& /*args*/) :
- KttsFilterProc(parent, name)
+SbdProc::SbdProc( TQObject *tqparent, const char *name, const TQStringList& /*args*/) :
+ KttsFilterProc(tqparent, name)
{
// kdDebug() << "SbdProc::SbdProc: Running" << endl;
- m_sbdThread = new SbdThread( parent, *name + "_thread" );
+ m_sbdThread = new SbdThread( tqparent, *name + "_thread" );
connect( m_sbdThread, TQT_SIGNAL(filteringFinished()), this, TQT_SLOT(slotSbdThreadFilteringFinished()) );
}
@@ -603,7 +603,7 @@ bool SbdProc::init(KConfig* config, const TQString& configGroup){
m_configuredRe = config->readEntry( "SentenceDelimiterRegExp", "([\\.\\?\\!\\:\\;])(\\s|$|(\\n *\\n))" );
m_sbdThread->setConfiguredSbRegExp( m_configuredRe );
TQString sb = config->readEntry( "SentenceBoundary", "\\1\t" );
- sb.replace( "\\t", "\t" );
+ sb.tqreplace( "\\t", "\t" );
m_sbdThread->setConfiguredSentenceBoundary( sb );
m_appIdList = config->readListEntry( "AppID" );
m_languageCodeList = config->readListEntry( "LanguageCodes" );
@@ -672,14 +672,14 @@ bool SbdProc::init(KConfig* config, const TQString& configGroup){
TQString languageCode = talkerCode->languageCode();
// kdDebug() << "StringReplacerProc::convert: converting " << inputText <<
// " if language code " << languageCode << " matches " << m_languageCodeList << endl;
- if ( !m_languageCodeList.contains( languageCode ) )
+ if ( !m_languageCodeList.tqcontains( languageCode ) )
{
if ( !talkerCode->countryCode().isEmpty() )
{
languageCode += '_' + talkerCode->countryCode();
// kdDebug() << "StringReplacerProc::convert: converting " << inputText <<
// " if language code " << languageCode << " matches " << m_languageCodeList << endl;
- if ( !m_languageCodeList.contains( languageCode ) ) return false;
+ if ( !m_languageCodeList.tqcontains( languageCode ) ) return false;
} else return false;
}
}
@@ -692,7 +692,7 @@ bool SbdProc::init(KConfig* config, const TQString& configGroup){
TQString appIdStr = appId;
for ( uint ndx=0; ndx < m_appIdList.count(); ++ndx )
{
- if ( appIdStr.contains(m_appIdList[ndx]) )
+ if ( appIdStr.tqcontains(m_appIdList[ndx]) )
{
found = true;
break;
@@ -737,7 +737,7 @@ bool SbdProc::init(KConfig* config, const TQString& configGroup){
/*virtual*/ void SbdProc::ackFinished()
{
m_state = fsIdle;
- m_sbdThread->setText( TQString::null );
+ m_sbdThread->setText( TQString() );
}
/**