summaryrefslogtreecommitdiffstats
path: root/kttsd/plugins/festivalint
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/plugins/festivalint
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/plugins/festivalint')
-rw-r--r--kttsd/plugins/festivalint/festivalintconf.cpp36
-rw-r--r--kttsd/plugins/festivalint/festivalintconf.h11
-rw-r--r--kttsd/plugins/festivalint/festivalintconfwidget.ui62
-rw-r--r--kttsd/plugins/festivalint/festivalintproc.cpp48
-rw-r--r--kttsd/plugins/festivalint/festivalintproc.h5
5 files changed, 82 insertions, 80 deletions
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 <math.h>
-// Qt includes.
+// TQt includes.
#include <tqlayout.h>
#include <tqlabel.h>
#include <tqstring.h>
@@ -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()
"<voice lang=\"%1\" name=\"%2\" gender=\"%3\" />"
"<prosody volume=\"%4\" rate=\"%5\" />"
"<kttsd synthesizer=\"%6\" />")
- .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 <tqstringlist.h>
#include <tqvaluelist.h>
@@ -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 @@
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>FestivalIntConfWidget</class>
<author>Gary Cramblitt &lt;garycramblitt@comcast.net&gt;</author>
-<widget class="QWidget">
+<widget class="TQWidget">
<property name="name">
<cstring>FestivalIntConfWidget</cstring>
</property>
@@ -31,7 +31,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QGroupBox" row="0" column="0">
+ <widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>festivalConfigurationBox</cstring>
</property>
@@ -65,7 +65,7 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QLayoutWidget" row="0" column="0">
+ <widget class="TQLayoutWidget" row="0" column="0">
<property name="name">
<cstring>voicesPathBox</cstring>
</property>
@@ -79,7 +79,7 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QLabel">
+ <widget class="TQLabel">
<property name="name">
<cstring>festivalPathLabel</cstring>
</property>
@@ -94,7 +94,7 @@
<property name="text">
<string>&amp;Festival executable:</string>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>AlignVCenter|AlignRight</set>
</property>
<property name="buddy" stdset="0">
@@ -122,7 +122,7 @@
</widget>
</hbox>
</widget>
- <widget class="QLayoutWidget" row="1" column="0">
+ <widget class="TQLayoutWidget" row="1" column="0">
<property name="name">
<cstring>selectVoiceBox</cstring>
</property>
@@ -136,14 +136,14 @@
<property name="spacing">
<number>6</number>
</property>
- <widget class="QLabel">
+ <widget class="TQLabel">
<property name="name">
<cstring>selectVoiceLabel</cstring>
</property>
<property name="text">
<string>&amp;Select voice:</string>
</property>
- <property name="alignment">
+ <property name="tqalignment">
<set>AlignVCenter|AlignRight</set>
</property>
<property name="buddy" stdset="0">
@@ -180,23 +180,23 @@
</widget>
</hbox>
</widget>
- <widget class="QLayoutWidget" row="2" column="0">
+ <widget class="TQLayoutWidget" row="2" column="0">
<property name="name">
- <cstring>layout11</cstring>
+ <cstring>tqlayout11</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLayoutWidget">
+ <widget class="TQLayoutWidget">
<property name="name">
- <cstring>layout8</cstring>
+ <cstring>tqlayout8</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLabel">
+ <widget class="TQLabel">
<property name="name">
<cstring>volumeLabel</cstring>
</property>
@@ -218,7 +218,7 @@
<string>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".</string>
</property>
</widget>
- <widget class="QLabel">
+ <widget class="TQLabel">
<property name="name">
<cstring>timeLabel</cstring>
</property>
@@ -240,7 +240,7 @@
<string>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.</string>
</property>
</widget>
- <widget class="QLabel">
+ <widget class="TQLabel">
<property name="name">
<cstring>frequencyLabel</cstring>
</property>
@@ -264,9 +264,9 @@
</widget>
</vbox>
</widget>
- <widget class="QLayoutWidget">
+ <widget class="TQLayoutWidget">
<property name="name">
- <cstring>layout9</cstring>
+ <cstring>tqlayout9</cstring>
</property>
<vbox>
<property name="name">
@@ -367,15 +367,15 @@
</widget>
</vbox>
</widget>
- <widget class="QLayoutWidget">
+ <widget class="TQLayoutWidget">
<property name="name">
- <cstring>layout10</cstring>
+ <cstring>tqlayout10</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QSlider">
+ <widget class="TQSlider">
<property name="name">
<cstring>volumeSlider</cstring>
</property>
@@ -407,7 +407,7 @@
<string>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".</string>
</property>
</widget>
- <widget class="QSlider">
+ <widget class="TQSlider">
<property name="name">
<cstring>timeSlider</cstring>
</property>
@@ -436,7 +436,7 @@
<string>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.</string>
</property>
</widget>
- <widget class="QSlider">
+ <widget class="TQSlider">
<property name="name">
<cstring>frequencySlider</cstring>
</property>
@@ -469,15 +469,15 @@
</widget>
</hbox>
</widget>
- <widget class="QLayoutWidget" row="4" column="0">
+ <widget class="TQLayoutWidget" row="4" column="0">
<property name="name">
- <cstring>layout6</cstring>
+ <cstring>tqlayout6</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QCheckBox">
+ <widget class="TQCheckBox">
<property name="name">
<cstring>preloadCheckBox</cstring>
</property>
@@ -498,14 +498,14 @@
<property name="sizeType">
<enum>Expanding</enum>
</property>
- <property name="sizeHint">
+ <property name="tqsizeHint">
<size>
<width>101</width>
<height>20</height>
</size>
</property>
</spacer>
- <widget class="QPushButton">
+ <widget class="TQPushButton">
<property name="name">
<cstring>testButton</cstring>
</property>
@@ -518,15 +518,15 @@
</widget>
</hbox>
</widget>
- <widget class="QLayoutWidget" row="3" column="0">
+ <widget class="TQLayoutWidget" row="3" column="0">
<property name="name">
- <cstring>layout5</cstring>
+ <cstring>tqlayout5</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLabel">
+ <widget class="TQLabel">
<property name="name">
<cstring>characterCodingLabel</cstring>
</property>
@@ -583,7 +583,7 @@
<include location="global" impldecl="in declaration">kurlrequester.h</include>
<include location="global" impldecl="in implementation">kurlrequester.h</include>
</includes>
-<layoutdefaults spacing="6" margin="11"/>
+<tqlayoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>kurlrequester.h</includehint>
<includehint>klineedit.h</includehint>
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 <math.h>
-// Qt includes.
+// TQt includes.
#include <tqstring.h>
#include <tqstringlist.h>
#include <tqthread.h>
@@ -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