diff options
Diffstat (limited to 'kttsd/plugins/command')
-rw-r--r-- | kttsd/plugins/command/commandconf.cpp | 70 | ||||
-rw-r--r-- | kttsd/plugins/command/commandconf.h | 24 | ||||
-rw-r--r-- | kttsd/plugins/command/commandproc.cpp | 92 | ||||
-rw-r--r-- | kttsd/plugins/command/commandproc.h | 30 |
4 files changed, 108 insertions, 108 deletions
diff --git a/kttsd/plugins/command/commandconf.cpp b/kttsd/plugins/command/commandconf.cpp index 9d70ff2..5d46fe9 100644 --- a/kttsd/plugins/command/commandconf.cpp +++ b/kttsd/plugins/command/commandconf.cpp @@ -16,11 +16,11 @@ ***************************************************************************/ // Qt includes. -#include <qlayout.h> -#include <qcheckbox.h> -#include <qfile.h> -#include <qapplication.h> -#include <qtextcodec.h> +#include <tqlayout.h> +#include <tqcheckbox.h> +#include <tqfile.h> +#include <tqapplication.h> +#include <tqtextcodec.h> // KDE includes. #include <kdialog.h> @@ -41,14 +41,14 @@ #include "commandconf.h" /** Constructor */ -CommandConf::CommandConf( QWidget* parent, const char* name, const QStringList& /*args*/) : +CommandConf::CommandConf( TQWidget* parent, const char* name, const TQStringList& /*args*/) : PlugInConf(parent, name) { // kdDebug() << "CommandConf::CommandConf: Running" << endl; m_commandProc = 0; m_progressDlg = 0; - QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), + TQVBoxLayout *layout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint(), "CommandConfigWidgetLayout"); layout->setAlignment (Qt::AlignTop); m_widget = new CommandConfWidget(this, "CommandConfigWidget"); @@ -60,39 +60,39 @@ CommandConf::CommandConf( QWidget* parent, const char* name, const QStringList& m_widget->characterCodingBox->insertStringList(m_codecList); defaults(); - connect(m_widget->characterCodingBox, SIGNAL(textChanged(const QString&)), - this, SLOT(configChanged())); - connect(m_widget->characterCodingBox, SIGNAL(activated(const QString&)), - this, SLOT(configChanged())); - connect(m_widget->stdInButton, SIGNAL(toggled(bool)), - this, SLOT(configChanged())); - connect(m_widget->urlReq, SIGNAL(textChanged(const QString&)), - this, SLOT(configChanged())); - connect(m_widget->commandTestButton, SIGNAL(clicked()), - this, SLOT(slotCommandTest_clicked())); + connect(m_widget->characterCodingBox, TQT_SIGNAL(textChanged(const TQString&)), + this, TQT_SLOT(configChanged())); + connect(m_widget->characterCodingBox, TQT_SIGNAL(activated(const TQString&)), + this, TQT_SLOT(configChanged())); + connect(m_widget->stdInButton, TQT_SIGNAL(toggled(bool)), + this, TQT_SLOT(configChanged())); + connect(m_widget->urlReq, TQT_SIGNAL(textChanged(const TQString&)), + this, TQT_SLOT(configChanged())); + connect(m_widget->commandTestButton, TQT_SIGNAL(clicked()), + this, TQT_SLOT(slotCommandTest_clicked())); } /** Destructor */ CommandConf::~CommandConf() { // kdDebug() << "CommandConf::~CommandConf: Running" << endl; - if (!m_waveFile.isNull()) QFile::remove(m_waveFile); + if (!m_waveFile.isNull()) TQFile::remove(m_waveFile); delete m_commandProc; delete m_progressDlg; } -void CommandConf::load(KConfig *config, const QString &configGroup) { +void CommandConf::load(KConfig *config, const TQString &configGroup) { // kdDebug() << "CommandConf::load: Running" << endl; config->setGroup(configGroup); m_widget->urlReq->setURL (config->readEntry("Command", "cat -")); m_widget->stdInButton->setChecked(config->readBoolEntry("StdIn", false)); - QString codecString = config->readEntry("Codec", "Local"); + TQString codecString = config->readEntry("Codec", "Local"); m_languageCode = config->readEntry("LanguageCode", m_languageCode); int codec = PlugInProc::codecNameToListIndex(codecString, m_codecList); m_widget->characterCodingBox->setCurrentItem(codec); } -void CommandConf::save(KConfig *config, const QString &configGroup) { +void CommandConf::save(KConfig *config, const TQString &configGroup) { // kdDebug() << "CommandConf::save: Running" << endl; config->setGroup(configGroup); config->writeEntry("Command", m_widget->urlReq->url()); @@ -109,21 +109,21 @@ void CommandConf::defaults(){ m_widget->characterCodingBox->setCurrentItem(0); } -void CommandConf::setDesiredLanguage(const QString &lang) +void CommandConf::setDesiredLanguage(const TQString &lang) { m_languageCode = lang; } -QString CommandConf::getTalkerCode() +TQString CommandConf::getTalkerCode() { - QString url = m_widget->urlReq->url(); + TQString url = m_widget->urlReq->url(); if (!url.isEmpty()) { // Must contain either text or file parameter, or StdIn checkbox must be checked, // otherwise, does nothing! if ((url.contains("%t") > 0) || (url.contains("%f") > 0) || m_widget->stdInButton->isChecked()) { - return QString( + return TQString( "<voice lang=\"%1\" name=\"%2\" gender=\"%3\" />" "<prosody volume=\"%4\" rate=\"%5\" />" "<kttsd synthesizer=\"%6\" />") @@ -135,7 +135,7 @@ QString CommandConf::getTalkerCode() .arg("Command"); } } - return QString::null; + return TQString::null; } void CommandConf::slotCommandTest_clicked() @@ -147,16 +147,16 @@ void CommandConf::slotCommandTest_clicked() else { m_commandProc = new CommandProc(); - connect (m_commandProc, SIGNAL(stopped()), this, SLOT(slotSynthStopped())); + connect (m_commandProc, TQT_SIGNAL(stopped()), this, TQT_SLOT(slotSynthStopped())); } // Create a temp file name for the wave file. KTempFile tempFile (locateLocal("tmp", "commandplugin-"), ".wav"); - QString tmpWaveFile = tempFile.file()->name(); + TQString tmpWaveFile = tempFile.file()->name(); tempFile.close(); // Get test message in the language of the voice. - QString testMsg = testMessage(m_languageCode); + TQString testMsg = testMessage(m_languageCode); // Tell user to wait. m_progressDlg = new KProgressDialog(m_widget, "kttsmgr_command_testdlg", @@ -167,7 +167,7 @@ void CommandConf::slotCommandTest_clicked() m_progressDlg->setAllowCancel(true); // TODO: Do codec names contain non-ASCII characters? - connect (m_commandProc, SIGNAL(synthFinished()), this, SLOT(slotSynthFinished())); + connect (m_commandProc, TQT_SIGNAL(synthFinished()), this, TQT_SLOT(slotSynthFinished())); m_commandProc->synth( testMsg, tmpWaveFile, @@ -179,7 +179,7 @@ void CommandConf::slotCommandTest_clicked() // Display progress dialog modally. Processing continues when plugin signals synthFinished, // or if user clicks Cancel button. m_progressDlg->exec(); - disconnect (m_commandProc, SIGNAL(synthFinished()), this, SLOT(slotSynthFinished())); + disconnect (m_commandProc, TQT_SIGNAL(synthFinished()), this, TQT_SLOT(slotSynthFinished())); if (m_progressDlg->wasCancelled()) m_commandProc->stopText(); delete m_progressDlg; m_progressDlg = 0; @@ -202,16 +202,16 @@ void CommandConf::slotSynthFinished() // Play the wave file (possibly adjusting its Speed). // Player object deletes the wave file when done. if (m_player) m_player->play(m_waveFile); - QFile::remove(m_waveFile); - m_waveFile = QString::null; + TQFile::remove(m_waveFile); + m_waveFile = TQString::null; if (m_progressDlg) m_progressDlg->close(); } void CommandConf::slotSynthStopped() { // Clean up after canceling test. - QString filename = m_commandProc->getFilename(); - if (!filename.isNull()) QFile::remove(filename); + TQString filename = m_commandProc->getFilename(); + if (!filename.isNull()) TQFile::remove(filename); } #include "commandconf.moc" diff --git a/kttsd/plugins/command/commandconf.h b/kttsd/plugins/command/commandconf.h index 7e9a573..b3889b9 100644 --- a/kttsd/plugins/command/commandconf.h +++ b/kttsd/plugins/command/commandconf.h @@ -19,8 +19,8 @@ #define _COMMANDCONF_H_ // Qt includes. -#include <qstring.h> -#include <qstringlist.h> +#include <tqstring.h> +#include <tqstringlist.h> // KDE includes. #include <kconfig.h> @@ -39,7 +39,7 @@ class CommandConf : public PlugInConf { public: /** Constructor */ - CommandConf( QWidget* parent = 0, const char* name = 0, const QStringList &args = QStringList()); + CommandConf( TQWidget* parent = 0, const char* name = 0, const TQStringList &args = TQStringList()); /** Destructor */ ~CommandConf(); @@ -51,14 +51,14 @@ class CommandConf : public PlugInConf { * valid settings. NOTE that this is not called after the modules is loaded, * so you probably want to call this method in the constructor. */ - void load(KConfig *config, const QString &configGroup); + void load(KConfig *config, const TQString &configGroup); /** This function gets called when the user wants to save the settings in * the user interface, updating the config files or wherever the * configuration is stored. The method is called when the user clicks "Apply" * or "Ok". */ - void save(KConfig *config, const QString &configGroup); + void save(KConfig *config, const TQString &configGroup); /** This function is called to set the settings in the module to sensible * default values. It gets called when hitting the "Default" button. The @@ -71,7 +71,7 @@ class CommandConf : 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 QString::null, no specific language has + * If the passed-in code is TQString::null, no specific language has * been chosen. * @param lang The desired language code or Null if none. * @@ -83,16 +83,16 @@ class CommandConf : public PlugInConf { * not the given country, treat it as though the country * code were not specified, i.e., adapt to the given language. */ - void setDesiredLanguage(const QString &lang); + void setDesiredLanguage(const TQString &lang); /** * 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 QString::null. + * i.e., cannot yet synthesize, return TQString::null. * @return Fully-specified talker code. */ - QString getTalkerCode(); + TQString getTalkerCode(); private slots: void configChanged(){ @@ -104,7 +104,7 @@ class CommandConf : public PlugInConf { void slotSynthStopped(); private: - QString m_languageCode; + TQString m_languageCode; // Configuration Widget. CommandConfWidget* m_widget; @@ -112,10 +112,10 @@ class CommandConf : public PlugInConf { // Command synthesizer. CommandProc* m_commandProc; // Synthesized wave file name. - QString m_waveFile; + TQString m_waveFile; // Progress dialog. KProgressDialog* m_progressDlg; // Codec list. - QStringList m_codecList; + TQStringList m_codecList; }; #endif // _COMMANDCONF_H_ diff --git a/kttsd/plugins/command/commandproc.cpp b/kttsd/plugins/command/commandproc.cpp index e8d3e72..77d63f3 100644 --- a/kttsd/plugins/command/commandproc.cpp +++ b/kttsd/plugins/command/commandproc.cpp @@ -16,13 +16,13 @@ ***************************************************************************/ // Qt includes. -#include <qfile.h> -#include <qstring.h> -#include <qvaluelist.h> -#include <qstringlist.h> -#include <qregexp.h> -#include <qtextcodec.h> -#include <qvaluestack.h> +#include <tqfile.h> +#include <tqstring.h> +#include <tqvaluelist.h> +#include <tqstringlist.h> +#include <tqregexp.h> +#include <tqtextcodec.h> +#include <tqvaluestack.h> // KDE includes. #include <kdebug.h> @@ -39,7 +39,7 @@ #include "commandproc.moc" /** Constructor */ -CommandProc::CommandProc( QObject* parent, const char* name, const QStringList& /*args*/) : +CommandProc::CommandProc( TQObject* parent, const char* name, const TQStringList& /*args*/) : PlugInProc( parent, name ) { kdDebug() << "CommandProc::CommandProc: Running" << endl; @@ -59,12 +59,12 @@ CommandProc::~CommandProc() if (m_commandProc->isRunning()) m_commandProc->kill(); delete m_commandProc; // Don't delete synth file. That is responsibility of caller. - if (!m_textFilename.isNull()) QFile::remove(m_textFilename); + if (!m_textFilename.isNull()) TQFile::remove(m_textFilename); } } /** Initialize */ -bool CommandProc::init(KConfig *config, const QString &configGroup){ +bool CommandProc::init(KConfig *config, const TQString &configGroup){ kdDebug() << "CommandProc::init: Initializing plug in: Command " << endl; config->setGroup(configGroup); @@ -75,7 +75,7 @@ bool CommandProc::init(KConfig *config, const QString &configGroup){ // Support separate synthesis if the TTS command contains %w macro. m_supportsSynth = (m_ttsCommand.contains("%w")); - QString codecString = config->readEntry("Codec", "Local"); + TQString codecString = config->readEntry("Codec", "Local"); m_codec = codecNameToCodec(codecString); kdDebug() << "CommandProc::init: Initialized with command: " << m_ttsCommand << " codec: " << codecString << endl; return true; @@ -87,9 +87,9 @@ bool CommandProc::init(KConfig *config, const QString &configGroup){ * * If the plugin supports asynchronous operation, it should return immediately. */ -void CommandProc::sayText(const QString &text) +void CommandProc::sayText(const TQString &text) { - synth(text, QString::null, + synth(text, TQString::null, m_ttsCommand, m_stdin, m_codec, m_language); } @@ -103,7 +103,7 @@ void CommandProc::sayText(const QString &text) * * If the plugin supports asynchronous operation, it should return immediately. */ -void CommandProc::synthText(const QString& text, const QString& suggestedFilename) +void CommandProc::synthText(const TQString& text, const TQString& suggestedFilename) { synth(text, suggestedFilename, m_ttsCommand, m_stdin, m_codec, m_language); @@ -116,56 +116,56 @@ void CommandProc::synthText(const QString& text, const QString& suggestedFilenam * synthesize and audibilize the text. * @param userCmd The program that shall be executed for speaking * @param stdIn True if the program shall recieve its data via standard input -* @param codec The QTextCodec if encoding==UseCodec +* @param codec The TQTextCodec if encoding==UseCodec * @param language The language code (used for the %l macro) */ -void CommandProc::synth(const QString& inputText, const QString& suggestedFilename, - const QString& userCmd, bool stdIn, QTextCodec *codec, QString& language) +void CommandProc::synth(const TQString& inputText, const TQString& suggestedFilename, + const TQString& userCmd, bool stdIn, TQTextCodec *codec, TQString& language) { if (m_commandProc) { if (m_commandProc->isRunning()) m_commandProc->kill(); delete m_commandProc; m_commandProc = 0; - m_synthFilename = QString::null; - if (!m_textFilename.isNull()) QFile::remove(m_textFilename); - m_textFilename = QString::null; + m_synthFilename = TQString::null; + if (!m_textFilename.isNull()) TQFile::remove(m_textFilename); + m_textFilename = TQString::null; } - QString command = userCmd; - QString text = inputText.stripWhiteSpace(); + TQString command = userCmd; + TQString text = inputText.stripWhiteSpace(); if (text.isEmpty()) return; // 1. prepare the text: // 1.a) encode the text text += "\n"; - QCString encodedText; + TQCString encodedText; if (codec) encodedText = codec->fromUnicode(text); else encodedText = text.latin1(); // Should not happen, but just in case. // 1.b) quote the text as one parameter - QString escText = KShellProcess::quote(text); + TQString escText = KShellProcess::quote(text); // 1.c) create a temporary file for the text, if %f macro is used. if (command.contains("%f")) { KTempFile tempFile(locateLocal("tmp", "commandplugin-"), ".txt"); - QTextStream* fs = tempFile.textStream(); + TQTextStream* fs = tempFile.textStream(); fs->setCodec(codec); *fs << text; *fs << endl; m_textFilename = tempFile.file()->name(); tempFile.close(); - } else m_textFilename = QString::null; + } else m_textFilename = TQString::null; // 2. replace variables with values - QValueStack<bool> stack; + TQValueStack<bool> stack; bool issinglequote=false; bool isdoublequote=false; int noreplace=0; - QRegExp re_noquote("(\"|'|\\\\|`|\\$\\(|\\$\\{|\\(|\\{|\\)|\\}|%%|%t|%f|%l|%w)"); - QRegExp re_singlequote("('|%%|%t|%f|%l|%w)"); - QRegExp re_doublequote("(\"|\\\\|`|\\$\\(|\\$\\{|%%|%t|%f|%l|%w)"); + TQRegExp re_noquote("(\"|'|\\\\|`|\\$\\(|\\$\\{|\\(|\\{|\\)|\\}|%%|%t|%f|%l|%w)"); + TQRegExp re_singlequote("('|%%|%t|%f|%l|%w)"); + TQRegExp re_doublequote("(\"|\\\\|`|\\$\\(|\\$\\{|%%|%t|%f|%l|%w)"); for ( int i = re_noquote.search(command); i != -1; @@ -220,7 +220,7 @@ void CommandProc::synth(const QString& inputText, const QString& suggestedFilena { // Replace all `...` with safer $(...) command.replace (i, 1, "$("); - QRegExp re_backticks("(`|\\\\`|\\\\\\\\|\\\\\\$)"); + TQRegExp re_backticks("(`|\\\\`|\\\\\\\\|\\\\\\$)"); for ( int i2=re_backticks.search(command,i+2); i2!=-1; i2=re_backticks.search(command,i2) @@ -241,7 +241,7 @@ void CommandProc::synth(const QString& inputText, const QString& suggestedFilena } else if (noreplace == 0) // do not replace macros within ${...} { - QString match, v; + TQString match, v; // get match if (issinglequote) @@ -290,14 +290,14 @@ void CommandProc::synth(const QString& inputText, const QString& suggestedFilena m_commandProc->setEnvironment("LANG", language + "." + codec->mimeName()); m_commandProc->setEnvironment("LC_CTYPE", language + "." + codec->mimeName()); *m_commandProc << command; - connect(m_commandProc, SIGNAL(processExited(KProcess*)), - this, SLOT(slotProcessExited(KProcess*))); - connect(m_commandProc, SIGNAL(receivedStdout(KProcess*, char*, int)), - this, SLOT(slotReceivedStdout(KProcess*, char*, int))); - connect(m_commandProc, SIGNAL(receivedStderr(KProcess*, char*, int)), - this, SLOT(slotReceivedStderr(KProcess*, char*, int))); - connect(m_commandProc, SIGNAL(wroteStdin(KProcess*)), - this, SLOT(slotWroteStdin(KProcess* ))); + connect(m_commandProc, TQT_SIGNAL(processExited(KProcess*)), + this, TQT_SLOT(slotProcessExited(KProcess*))); + connect(m_commandProc, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)), + this, TQT_SLOT(slotReceivedStdout(KProcess*, char*, int))); + connect(m_commandProc, TQT_SIGNAL(receivedStderr(KProcess*, char*, int)), + this, TQT_SLOT(slotReceivedStderr(KProcess*, char*, int))); + connect(m_commandProc, TQT_SIGNAL(wroteStdin(KProcess*)), + this, TQT_SLOT(slotWroteStdin(KProcess* ))); // 4. start the process @@ -326,7 +326,7 @@ void CommandProc::synth(const QString& inputText, const QString& suggestedFilena * * The plugin must not re-use the filename. */ -QString CommandProc::getFilename() +TQString CommandProc::getFilename() { kdDebug() << "CommandProc::getFilename: returning " << m_synthFilename << endl; return m_synthFilename; @@ -382,13 +382,13 @@ void CommandProc::slotProcessExited(KProcess*) void CommandProc::slotReceivedStdout(KProcess*, char* buffer, int buflen) { - QString buf = QString::fromLatin1(buffer, buflen); + TQString buf = TQString::fromLatin1(buffer, buflen); kdDebug() << "CommandProc::slotReceivedStdout: Received output from Command: " << buf << endl; } void CommandProc::slotReceivedStderr(KProcess*, char* buffer, int buflen) { - QString buf = QString::fromLatin1(buffer, buflen); + TQString buf = TQString::fromLatin1(buffer, buflen); kdDebug() << "CommandProc::slotReceivedStderr: Received error from Command: " << buf << endl; } @@ -420,9 +420,9 @@ void CommandProc::ackFinished() if (m_state == psFinished) { m_state = psIdle; - m_synthFilename = QString::null; - if (!m_textFilename.isNull()) QFile::remove(m_textFilename); - m_textFilename = QString::null; + m_synthFilename = TQString::null; + if (!m_textFilename.isNull()) TQFile::remove(m_textFilename); + m_textFilename = TQString::null; } } diff --git a/kttsd/plugins/command/commandproc.h b/kttsd/plugins/command/commandproc.h index 4b46fe5..d5027c5 100644 --- a/kttsd/plugins/command/commandproc.h +++ b/kttsd/plugins/command/commandproc.h @@ -19,7 +19,7 @@ #define _COMMANDPROC_H_ // Qt includes. -#include <qstringlist.h> +#include <tqstringlist.h> // KTTS includes. #include <pluginproc.h> @@ -32,20 +32,20 @@ class CommandProc : public PlugInProc{ public: /** Constructor */ - CommandProc( QObject* parent = 0, const char* name = 0, - const QStringList &args = QStringList()); + CommandProc( TQObject* parent = 0, const char* name = 0, + const TQStringList &args = TQStringList()); /** Destructor */ ~CommandProc(); /** Initializate the speech */ - bool init (KConfig *config, const QString &configGroup); + bool init (KConfig *config, const TQString &configGroup); /** * Say a text string. * @param text The text to speak. */ - virtual void sayText(const QString &text); + virtual void sayText(const TQString &text); /** * Synthesize text into an audio file, but do not send to the audio device. @@ -57,7 +57,7 @@ class CommandProc : public PlugInProc{ * * If the plugin supports asynchronous operation, it should return immediately. */ - virtual void synthText(const QString& text, const QString& suggestedFilename); + virtual void synthText(const TQString& text, const TQString& suggestedFilename); /** * Get the generated audio filename from synthText. @@ -66,7 +66,7 @@ class CommandProc : public PlugInProc{ * * The plugin must not re-use the filename. */ - virtual QString getFilename(); + virtual TQString getFilename(); /** * Stop current operation (saying or synthesizing text). @@ -134,9 +134,9 @@ class CommandProc : public PlugInProc{ * @param codec Codec for encoding the text. * @param language The language code (used for the %l macro) */ - void synth(const QString& inputText, const QString& suggestedFilename, - const QString& userCmd, bool stdIn, - QTextCodec *codec, QString& language); + void synth(const TQString& inputText, const TQString& suggestedFilename, + const TQString& userCmd, bool stdIn, + TQTextCodec *codec, TQString& language); private slots: void slotProcessExited(KProcess* proc); @@ -154,7 +154,7 @@ class CommandProc : public PlugInProc{ /** * TTS command */ - QString m_ttsCommand; + TQString m_ttsCommand; /** * True if process should use Stdin. @@ -164,12 +164,12 @@ class CommandProc : public PlugInProc{ /** * Language Group. */ - QString m_language; + TQString m_language; /** * Codec. */ - QTextCodec* m_codec; + TQTextCodec* m_codec; /** * Flite process @@ -179,12 +179,12 @@ class CommandProc : public PlugInProc{ /** * Name of temporary file containing text. */ - QString m_textFilename; + TQString m_textFilename; /** * Synthesis filename. */ - QString m_synthFilename; + TQString m_synthFilename; /** * Plugin state. |