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/plugins/festivalint/festivalintconf.cpp | 36 ++++++------- kttsd/plugins/festivalint/festivalintconf.h | 11 ++-- kttsd/plugins/festivalint/festivalintconfwidget.ui | 62 +++++++++++----------- kttsd/plugins/festivalint/festivalintproc.cpp | 48 ++++++++--------- kttsd/plugins/festivalint/festivalintproc.h | 5 +- 5 files changed, 82 insertions(+), 80 deletions(-) (limited to 'kttsd/plugins/festivalint') diff --git a/kttsd/plugins/festivalint/festivalintconf.cpp b/kttsd/plugins/festivalint/festivalintconf.cpp index 8464ad7..54542ab 100644 --- a/kttsd/plugins/festivalint/festivalintconf.cpp +++ b/kttsd/plugins/festivalint/festivalintconf.cpp @@ -24,7 +24,7 @@ // C++ includes. #include -// Qt includes. +// TQt includes. #include #include #include @@ -57,19 +57,19 @@ #include "festivalintconf.moc" /** Constructor */ -FestivalIntConf::FestivalIntConf( TQWidget* parent, const char* name, const TQStringList& /*args*/) : - PlugInConf(parent, name) +FestivalIntConf::FestivalIntConf( TQWidget* tqparent, const char* name, const TQStringList& /*args*/) : + PlugInConf(tqparent, name) { // kdDebug() << "FestivalIntConf::FestivalIntConf: Running" << endl; m_festProc = 0; m_progressDlg = 0; m_supportsSSML = FestivalIntProc::ssUnknown; - TQVBoxLayout *layout = new TQVBoxLayout(this, KDialog::marginHint(), + TQVBoxLayout *tqlayout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint(), "FestivalIntConfigWidgetLayout"); - layout->setAlignment (Qt::AlignTop); + tqlayout->tqsetAlignment (TQt::AlignTop); m_widget = new FestivalIntConfWidget(this, "FestivalIntConfigWidget"); - layout->addWidget(m_widget); + tqlayout->addWidget(m_widget); m_widget->festivalPath->setMode(KFile::File | KFile::ExistingOnly); m_widget->festivalPath->setFilter("*"); @@ -210,11 +210,11 @@ void FestivalIntConf::setDesiredLanguage(const TQString &lang) TQString FestivalIntConf::getTalkerCode() { - if (!m_widget->selectVoiceCombo->isEnabled()) return TQString::null; + if (!m_widget->selectVoiceCombo->isEnabled()) return TQString(); TQString exePath = realFilePath(m_widget->festivalPath->url()); - if (exePath.isEmpty()) return TQString::null; - if (getLocation(exePath).isEmpty()) return TQString::null; - if (m_voiceList.count() == 0) return TQString::null; + if (exePath.isEmpty()) return TQString(); + if (getLocation(exePath).isEmpty()) return TQString(); + if (m_voiceList.count() == 0) return TQString(); TQString normalTalkerCode; voiceStruct voiceTemp = m_voiceList[m_widget->selectVoiceCombo->currentItem()]; // Determine volume attribute. soft < 75% <= medium <= 125% < loud. @@ -229,12 +229,12 @@ TQString FestivalIntConf::getTalkerCode() "" "" "") - .arg(voiceTemp.languageCode) - .arg(voiceTemp.code) - .arg(voiceTemp.gender) - .arg(volume) - .arg(rate) - .arg("Festival Interactive"); + .tqarg(voiceTemp.languageCode) + .tqarg(voiceTemp.code) + .tqarg(voiceTemp.gender) + .tqarg(volume) + .tqarg(rate) + .tqarg("Festival Interactive"); return normalTalkerCode; } @@ -485,7 +485,7 @@ void FestivalIntConf::scanVoices() for (uint index=0; index < voicesCount; ++index) { TQDomNode voiceNode = voices.item(index); - TQString voiceCode = readXmlString(voiceNode, "code", TQString::null); + TQString voiceCode = readXmlString(voiceNode, "code", TQString()); // kdDebug() << "FestivalIntConf::scanVoices: Comparing code " << code << " to " << voiceCode << endl; if (voiceCode == code) { @@ -621,7 +621,7 @@ void FestivalIntConf::slotSynthFinished() // Player object deletes the wave file when done. if (m_player) m_player->play(m_waveFile); TQFile::remove(m_waveFile); - m_waveFile = TQString::null; + m_waveFile = TQString(); if (m_progressDlg) m_progressDlg->close(); } diff --git a/kttsd/plugins/festivalint/festivalintconf.h b/kttsd/plugins/festivalint/festivalintconf.h index 5282394..3379719 100644 --- a/kttsd/plugins/festivalint/festivalintconf.h +++ b/kttsd/plugins/festivalint/festivalintconf.h @@ -24,7 +24,7 @@ #ifndef _FESTIVALINTCONF_H_ #define _FESTIVALINTCONF_H_ -// Qt includes. +// TQt includes. #include #include @@ -55,11 +55,12 @@ typedef struct voiceStruct{ } voice; class FestivalIntConf : public PlugInConf { - Q_OBJECT + Q_OBJECT + TQ_OBJECT public: /** Constructor */ - FestivalIntConf( TQWidget* parent = 0, const char* name = 0, const TQStringList &args = TQStringList()); + FestivalIntConf( TQWidget* tqparent = 0, const char* name = 0, const TQStringList &args = TQStringList()); /** Destructor */ ~FestivalIntConf(); @@ -90,7 +91,7 @@ class FestivalIntConf : public PlugInConf { * This function informs the plugin of the desired language to be spoken * by the plugin. The plugin should attempt to adapt itself to the * specified language code, choosing sensible defaults if necessary. - * If the passed-in code is TQString::null, no specific language has + * If the passed-in code is TQString(), no specific language has * been chosen. * @param lang The desired language code or Null if none. * @@ -108,7 +109,7 @@ class FestivalIntConf : public PlugInConf { * Return fully-specified talker code for the configured plugin. This code * uniquely identifies the configured instance of the plugin and distinquishes * one instance from another. If the plugin has not been fully configured, - * i.e., cannot yet synthesize, return TQString::null. + * i.e., cannot yet synthesize, return TQString(). * @return Fully-specified talker code. */ TQString getTalkerCode(); diff --git a/kttsd/plugins/festivalint/festivalintconfwidget.ui b/kttsd/plugins/festivalint/festivalintconfwidget.ui index f8b33fb..36f65bd 100644 --- a/kttsd/plugins/festivalint/festivalintconfwidget.ui +++ b/kttsd/plugins/festivalint/festivalintconfwidget.ui @@ -1,7 +1,7 @@ FestivalIntConfWidget Gary Cramblitt <garycramblitt@comcast.net> - + FestivalIntConfWidget @@ -31,7 +31,7 @@ unnamed - + festivalConfigurationBox @@ -65,7 +65,7 @@ 6 - + voicesPathBox @@ -79,7 +79,7 @@ 6 - + festivalPathLabel @@ -94,7 +94,7 @@ &Festival executable: - + AlignVCenter|AlignRight @@ -122,7 +122,7 @@ - + selectVoiceBox @@ -136,14 +136,14 @@ 6 - + selectVoiceLabel &Select voice: - + AlignVCenter|AlignRight @@ -180,23 +180,23 @@ - + - layout11 + tqlayout11 unnamed - + - layout8 + tqlayout8 unnamed - + volumeLabel @@ -218,7 +218,7 @@ Sets the volume (loudness) of speech. Slide the slider to the left to lower the volume; to the right to increase volume. Anything less than 75 percent is considered "soft", and anything greater than 125 percent is considered "loud". - + timeLabel @@ -240,7 +240,7 @@ Sets the speed of speech. Slide the slider to the left to slow speech down; to the right to increase talking speed. Anything less than 75 percent is considered "slow", and anything greater than 125 percent is considered "fast". You cannot change the speed of MultiSyn voices. - + frequencyLabel @@ -264,9 +264,9 @@ - + - layout9 + tqlayout9 @@ -367,15 +367,15 @@ - + - layout10 + tqlayout10 unnamed - + volumeSlider @@ -407,7 +407,7 @@ Sets the volume (loudness) of speech. Slide the slider to the left to lower the volume; to the right to increase volume. Anything less than 75 percent is considered "soft", and anything greater than 125 percent is considered "loud". - + timeSlider @@ -436,7 +436,7 @@ Sets the speed of speech. Slide the slider to the left to slow speech down; to the right to increase talking speed. Anything less than 75 percent is considered "slow", and anything greater than 125 percent is considered "fast". You cannot change the speed of MultiSyn voices. - + frequencySlider @@ -469,15 +469,15 @@ - + - layout6 + tqlayout6 unnamed - + preloadCheckBox @@ -498,14 +498,14 @@ Expanding - + 101 20 - + testButton @@ -518,15 +518,15 @@ - + - layout5 + tqlayout5 unnamed - + characterCodingLabel @@ -583,7 +583,7 @@ kurlrequester.h kurlrequester.h - + kurlrequester.h klineedit.h diff --git a/kttsd/plugins/festivalint/festivalintproc.cpp b/kttsd/plugins/festivalint/festivalintproc.cpp index e48f2c4..2b4aea3 100644 --- a/kttsd/plugins/festivalint/festivalintproc.cpp +++ b/kttsd/plugins/festivalint/festivalintproc.cpp @@ -24,7 +24,7 @@ // C++ includes. #include -// Qt includes. +// TQt includes. #include #include #include @@ -43,8 +43,8 @@ #include "festivalintproc.moc" /** Constructor */ -FestivalIntProc::FestivalIntProc( TQObject* parent, const char* name, const TQStringList& ) : - PlugInProc( parent, name ){ +FestivalIntProc::FestivalIntProc( TQObject* tqparent, const char* name, const TQStringList& ) : + PlugInProc( tqparent, name ){ // kdDebug() << "FestivalIntProc::FestivalIntProc: Running" << endl; m_ready = true; m_writingStdin = false; @@ -113,7 +113,7 @@ bool FestivalIntProc::init(KConfig *config, const TQString &configGroup) */ void FestivalIntProc::sayText(const TQString &text) { - synth(m_festivalExePath, text, TQString::null, m_voiceCode, m_time, m_pitch, m_volume, + synth(m_festivalExePath, text, TQString(), m_voiceCode, m_time, m_pitch, m_volume, m_languageCode, m_codec); } @@ -144,7 +144,7 @@ bool FestivalIntProc::queryVoices(const TQString &festivalExePath) // kdDebug() << "FestivalIntProc::queryVoices: Running" << endl; if (m_state != psIdle && m_waitingQueryVoices && m_waitingStop) return false; // Start Festival if not already running. - startEngine(festivalExePath, TQString::null, m_languageCode, m_codec); + startEngine(festivalExePath, TQString(), m_languageCode, m_codec); // Set state, waiting for voice codes list from Festival. m_waitingQueryVoices = true; // Voice rab_diphone is needed in order to support SSML. @@ -196,7 +196,7 @@ void FestivalIntProc::startEngine(const TQString &festivalExePath, const TQStrin if (!m_festProc->isRunning()) { // kdDebug() << "FestivalIntProc::startEngine: Starting Festival process" << endl; - m_runningVoiceCode = TQString::null; + m_runningVoiceCode = TQString(); m_runningTime = 100; m_runningPitch = 100; m_ready = false; @@ -257,7 +257,7 @@ void FestivalIntProc::synth( // If we just started Festival, or rate changed, tell festival. if (m_runningTime != time) { TQString timeMsg; - if (voiceCode.contains("_hts") > 0) + if (voiceCode.tqcontains("_hts") > 0) { // Map 50% to 200% onto 0 to 1000. // slider = alpha * (log(percent)-log(50)) @@ -268,11 +268,11 @@ void FestivalIntProc::synth( slider = slider - 500; // Map -500 to 500 onto 0.15 to -0.15. float stretchValue = -float(slider) * 0.15 / 500.0; - timeMsg = TQString("(set! hts_duration_stretch %1)").arg( + timeMsg = TQString("(set! hts_duration_stretch %1)").tqarg( stretchValue, 0, 'f', 3); } else - timeMsg = TQString("(Parameter.set 'Duration_Stretch %1)").arg( + timeMsg = TQString("(Parameter.set 'Duration_Stretch %1)").tqarg( 1.0/(float(time)/100.0), 0, 'f', 2); sendToFestival(timeMsg); m_runningTime = time; @@ -292,7 +292,7 @@ void FestivalIntProc::synth( } TQString pitchMsg = TQString( "(set! int_lr_params '((target_f0_mean %1) (target_f0_std 14)" - "(model_f0_mean 170) (model_f0_std 34)))").arg(pitchValue, 0, 10); + "(model_f0_mean 170) (model_f0_std 34)))").tqarg(pitchValue, 0, 10); sendToFestival(pitchMsg); m_runningPitch = pitch; } @@ -304,14 +304,14 @@ void FestivalIntProc::synth( int len = saidText.length(); while (len > c_tooLong) { - len = saidText.findRev(", ", len - (c_tooLong * 2 / 3), true); + len = saidText.tqfindRev(", ", len - (c_tooLong * 2 / 3), true); if (len != -1) { TQString c = saidText.mid(len+2, 1); if (c != c.upper()) { - saidText.replace(len, 2, ". "); - saidText.replace(len+2, 1, c.upper()); + saidText.tqreplace(len, 2, ". "); + saidText.tqreplace(len+2, 1, c.upper()); kdDebug() << "FestivalIntProc::synth: Splitting long sentence at " << len << endl; // kdDebug() << saidText << endl; } @@ -319,17 +319,17 @@ void FestivalIntProc::synth( } // Encode quotation characters. - saidText.replace("\\\"", "#!#!"); - saidText.replace("\"", "\\\""); - saidText.replace("#!#!", "\\\""); + saidText.tqreplace("\\\"", "#!#!"); + saidText.tqreplace("\"", "\\\""); + saidText.tqreplace("#!#!", "\\\""); // Remove certain comment characters. - saidText.replace("--", ""); + saidText.tqreplace("--", ""); // Ok, let's rock. if (synthFilename.isNull()) { m_state = psSaying; - m_synthFilename = TQString::null; + m_synthFilename = TQString(); // kdDebug() << "FestivalIntProc::synth: Saying text: '" << saidText << "' using Festival plug in with voice " // << voiceCode << endl; saidText = "(SayText \"" + saidText + "\")"; @@ -500,9 +500,9 @@ void FestivalIntProc::slotProcessExited(KProcess*) void FestivalIntProc::slotReceivedStdout(KProcess*, char* buffer, int buflen) { - TQString buf = TQString::fromLatin1(buffer, buflen); + TQString buf = TQString::tqfromLatin1(buffer, buflen); // kdDebug() << "FestivalIntProc::slotReceivedStdout: Received from Festival: " << buf << endl; - bool promptSeen = (buf.contains("festival>") > 0); + bool promptSeen = (buf.tqcontains("festival>") > 0); bool emitQueryVoicesFinished = false; TQStringList voiceCodesList; if (m_waitingQueryVoices && m_outputQueue.isEmpty()) @@ -515,7 +515,7 @@ void FestivalIntProc::slotReceivedStdout(KProcess*, char* buffer, int buflen) } else { if (buf.left(1) == "(") { - int rightParen = buf.find(')'); + int rightParen = buf.tqfind(')'); if (rightParen > 0) { m_waitingQueryVoices = false; @@ -562,14 +562,14 @@ void FestivalIntProc::slotReceivedStdout(KProcess*, char* buffer, int buflen) if (emitQueryVoicesFinished) { // kdDebug() << "FestivalIntProc::slotReceivedStdout: emitting queryVoicesFinished" << endl; - m_supportsSSML = (voiceCodesList.contains("rab_diphone")) ? ssYes : ssNo; + m_supportsSSML = (voiceCodesList.tqcontains("rab_diphone")) ? ssYes : ssNo; emit queryVoicesFinished(voiceCodesList); } } void FestivalIntProc::slotReceivedStderr(KProcess*, char* buffer, int buflen) { - TQString buf = TQString::fromLatin1(buffer, buflen); + TQString buf = TQString::tqfromLatin1(buffer, buflen); kdDebug() << "FestivalIntProc::slotReceivedStderr: Received error from Festival: " << buf << endl; } @@ -620,7 +620,7 @@ void FestivalIntProc::ackFinished() if (m_state == psFinished) { m_state = psIdle; - m_synthFilename = TQString::null; + m_synthFilename = TQString(); } } diff --git a/kttsd/plugins/festivalint/festivalintproc.h b/kttsd/plugins/festivalint/festivalintproc.h index 4425245..e70127f 100644 --- a/kttsd/plugins/festivalint/festivalintproc.h +++ b/kttsd/plugins/festivalint/festivalintproc.h @@ -34,7 +34,8 @@ class TQTextCodec; class FestivalIntProc : public PlugInProc{ - Q_OBJECT + Q_OBJECT + TQ_OBJECT public: enum SupportsSSML { @@ -46,7 +47,7 @@ class FestivalIntProc : public PlugInProc{ /** * Constructor */ - FestivalIntProc( TQObject* parent = 0, const char* name = 0, const TQStringList &args = TQStringList()); + FestivalIntProc( TQObject* tqparent = 0, const char* name = 0, const TQStringList &args = TQStringList()); /** * Destructor -- cgit v1.2.1