From f138d74fe16092003b06f5bde9663841929cde7f Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 17 Jun 2011 22:17:08 +0000 Subject: 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 --- kttsd/filters/sbd/sbdconf.cpp | 32 +++++++++---------- kttsd/filters/sbd/sbdconf.h | 5 +-- kttsd/filters/sbd/sbdconfwidget.ui | 58 +++++++++++++++++----------------- kttsd/filters/sbd/sbdproc.cpp | 64 +++++++++++++++++++------------------- kttsd/filters/sbd/sbdproc.h | 12 ++++--- 5 files changed, 87 insertions(+), 84 deletions(-) (limited to 'kttsd/filters/sbd') diff --git a/kttsd/filters/sbd/sbdconf.cpp b/kttsd/filters/sbd/sbdconf.cpp index 5244974..6beaba3 100644 --- a/kttsd/filters/sbd/sbdconf.cpp +++ b/kttsd/filters/sbd/sbdconf.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ -// Qt includes. +// TQt includes. #include #include #include @@ -56,17 +56,17 @@ /** * Constructor */ -SbdConf::SbdConf( TQWidget *parent, const char *name, const TQStringList& /*args*/) : - KttsFilterConf(parent, name) +SbdConf::SbdConf( TQWidget *tqparent, const char *name, const TQStringList& /*args*/) : + KttsFilterConf(tqparent, name) { // kdDebug() << "SbdConf::SbdConf: Running" << endl; // Create configuration widget. - TQVBoxLayout *layout = new TQVBoxLayout(this, KDialog::marginHint(), + TQVBoxLayout *tqlayout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint(), "SbdConfigWidgetLayout"); - layout->setAlignment (Qt::AlignTop); + tqlayout->tqsetAlignment (TQt::AlignTop); m_widget = new SbdConfWidget(this, "SbdConfigWidget"); - layout->addWidget(m_widget); + tqlayout->addWidget(m_widget); // Determine if kdeutils Regular Expression Editor is installed. m_reEditorInstalled = !KTrader::self()->query("KRegExpEditor/KRegExpEditor").isEmpty(); @@ -156,7 +156,7 @@ void SbdConf::save(KConfig* config, const TQString& configGroup){ config->writeEntry("SentenceDelimiterRegExp", m_widget->reLineEdit->text() ); config->writeEntry("SentenceBoundary", m_widget->sbLineEdit->text() ); config->writeEntry("LanguageCodes", m_languageCodeList ); - config->writeEntry("AppID", m_widget->appIdLineEdit->text().replace(" ", "") ); + config->writeEntry("AppID", m_widget->appIdLineEdit->text().tqreplace(" ", "") ); } /** @@ -195,7 +195,7 @@ bool SbdConf::supportsMultiInstance() { return true; } TQString SbdConf::userPlugInName() { if ( m_widget->reLineEdit->text().isEmpty() ) - return TQString::null; + return TQString(); else return m_widget->nameLineEdit->text(); } @@ -257,7 +257,7 @@ void SbdConf::slotLanguageBrowseButton_clicked() if (!countryCode.isEmpty()) language += " (" + KGlobal::locale()->twoAlphaToCountryName(countryCode)+")"; TQListViewItem* item = new KListViewItem(langLView, language, locale); - if (m_languageCodeList.contains(locale)) item->setSelected(true); + if (m_languageCodeList.tqcontains(locale)) item->setSelected(true); } // Sort by language. langLView->setSorting(0); @@ -276,7 +276,7 @@ void SbdConf::slotLanguageBrowseButton_clicked() dlg->setHelp("", "kttsd"); dlg->setInitialSize(TQSize(300, 500), false); int dlgResult = dlg->exec(); - languageCode = TQString::null; + languageCode = TQString(); if (dlgResult == TQDialog::Accepted) { m_languageCodeList.clear(); @@ -288,7 +288,7 @@ void SbdConf::slotLanguageBrowseButton_clicked() } } delete dlg; - // TODO: Also delete KListView and QHBox? + // TODO: Also delete KListView and TQHBox? if (dlgResult != TQDialog::Accepted) return; language = ""; for ( uint ndx=0; ndx < m_languageCodeList.count(); ++ndx) @@ -331,11 +331,11 @@ void SbdConf::slotSaveButton_clicked() void SbdConf::slotClearButton_clicked() { - m_widget->nameLineEdit->setText( TQString::null ); - m_widget->reLineEdit->setText( TQString::null ); - m_widget->sbLineEdit->setText( TQString::null ); + m_widget->nameLineEdit->setText( TQString() ); + m_widget->reLineEdit->setText( TQString() ); + m_widget->sbLineEdit->setText( TQString() ); m_languageCodeList.clear(); - m_widget->languageLineEdit->setText( TQString::null ); - m_widget->appIdLineEdit->setText( TQString::null ); + m_widget->languageLineEdit->setText( TQString() ); + m_widget->appIdLineEdit->setText( TQString() ); configChanged(); } diff --git a/kttsd/filters/sbd/sbdconf.h b/kttsd/filters/sbd/sbdconf.h index eb1b817..f2610c4 100644 --- a/kttsd/filters/sbd/sbdconf.h +++ b/kttsd/filters/sbd/sbdconf.h @@ -24,7 +24,7 @@ #ifndef _SBDCONF_H_ #define _SBDCONF_H_ -// Qt includes. +// TQt includes. #include // KDE includes. @@ -43,12 +43,13 @@ class EditReplacementWidget; class SbdConf : public KttsFilterConf { Q_OBJECT + TQ_OBJECT public: /** * Constructor */ - SbdConf( TQWidget *parent, const char *name, const TQStringList &args = TQStringList() ); + SbdConf( TQWidget *tqparent, const char *name, const TQStringList &args = TQStringList() ); /** * Destructor diff --git a/kttsd/filters/sbd/sbdconfwidget.ui b/kttsd/filters/sbd/sbdconfwidget.ui index 17cd525..c094a52 100644 --- a/kttsd/filters/sbd/sbdconfwidget.ui +++ b/kttsd/filters/sbd/sbdconfwidget.ui @@ -1,7 +1,7 @@ SbdConfWidget Gary Cramblitt <garycramblitt@comcast.net> - + SbdConfWidget @@ -25,7 +25,7 @@ unnamed - + textLabel1 @@ -33,22 +33,22 @@ <b>WARNING: This filter is a key component of the KTTS system. Please read the KTTS Handbook before modifying these settings.</b> - + - layout3 + tqlayout3 unnamed - + nameLabel &Name: - + AlignVCenter|AlignRight @@ -72,22 +72,22 @@ - + - layout17 + tqlayout17 unnamed - + reLabel &Sentence boundary regular expression: - + AlignVCenter|AlignRight @@ -116,22 +116,22 @@ - + - layout17_2 + tqlayout17_2 unnamed - + sbLabel &Replacement sentence boundary: - + AlignVCenter|AlignRight @@ -152,7 +152,7 @@ - + applyGroupBox @@ -166,22 +166,22 @@ unnamed - + - layout11 + tqlayout11 unnamed - + languageLabel &Language is: - + AlignVCenter|AlignRight @@ -192,14 +192,14 @@ What's this text - + appIdLabel - Application &ID contains: + Application &ID tqcontains: - + AlignVCenter|AlignRight @@ -211,17 +211,17 @@ - + - layout13 + tqlayout13 unnamed - + - layout12 + tqlayout12 @@ -263,9 +263,9 @@ - + - layout6 + tqlayout6 @@ -347,7 +347,7 @@ languageBrowseButton appIdLineEdit - + klineedit.h klineedit.h 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 #include #include @@ -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;)"), "&"); - newText.replace(TQRegExp("<(?!lt;)"), "<"); + newText.tqreplace(TQRegExp("&(?!amp;)"), "&"); + newText.tqreplace(TQRegExp("<(?!lt;)"), "<"); s += newText; if ( !e.isEmpty() ) s += ""; if ( !p.isEmpty() ) s += ""; @@ -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 = ""; 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() ); } /** diff --git a/kttsd/filters/sbd/sbdproc.h b/kttsd/filters/sbd/sbdproc.h index 4592c29..49f7b09 100644 --- a/kttsd/filters/sbd/sbdproc.h +++ b/kttsd/filters/sbd/sbdproc.h @@ -45,7 +45,7 @@ #ifndef _SBDPROC_H_ #define _SBDPROC_H_ -// Qt includes. +// TQt includes. #include #include #include @@ -60,15 +60,16 @@ class KConfig; class TQDomElement; class TQDomNode; -class SbdThread: public TQObject, public QThread +class SbdThread: public TQObject, public TQThread { Q_OBJECT + TQ_OBJECT public: /** * Constructor. */ - SbdThread( TQObject *parent = 0, const char *name = 0); + SbdThread( TQObject *tqparent = 0, const char *name = 0); /** * Destructor. @@ -203,7 +204,7 @@ class SbdThread: public TQObject, public QThread TQString startSentence(); // Ends a sentence and appends a Tab. TQString endSentence(); - // 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 parseSsmlNode( TQDomNode& n, const TQString& re ); @@ -240,12 +241,13 @@ class SbdThread: public TQObject, public QThread class SbdProc : virtual public KttsFilterProc { Q_OBJECT + TQ_OBJECT public: /** * Constructor. */ - SbdProc( TQObject *parent, const char *name, const TQStringList &args = TQStringList() ); + SbdProc( TQObject *tqparent, const char *name, const TQStringList &args = TQStringList() ); /** * Destructor. -- cgit v1.2.1