diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-17 22:17:08 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-17 22:17:08 +0000 |
commit | f138d74fe16092003b06f5bde9663841929cde7f (patch) | |
tree | e9c497a0e59bc7d34264ac9404740d2ea76f3de4 /kttsd/plugins/command | |
parent | 3a3c4b256baee79bdcfe72c5e01b9ded9b525900 (diff) | |
download | tdeaccessibility-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/command')
-rw-r--r-- | kttsd/plugins/command/commandconf.cpp | 30 | ||||
-rw-r--r-- | kttsd/plugins/command/commandconf.h | 11 | ||||
-rw-r--r-- | kttsd/plugins/command/commandconfwidget.ui | 32 | ||||
-rw-r--r-- | kttsd/plugins/command/commandproc.cpp | 50 | ||||
-rw-r--r-- | kttsd/plugins/command/commandproc.h | 7 |
5 files changed, 66 insertions, 64 deletions
diff --git a/kttsd/plugins/command/commandconf.cpp b/kttsd/plugins/command/commandconf.cpp index 5d46fe9..5c4605f 100644 --- a/kttsd/plugins/command/commandconf.cpp +++ b/kttsd/plugins/command/commandconf.cpp @@ -15,7 +15,7 @@ * * ***************************************************************************/ -// Qt includes. +// TQt includes. #include <tqlayout.h> #include <tqcheckbox.h> #include <tqfile.h> @@ -41,18 +41,18 @@ #include "commandconf.h" /** Constructor */ -CommandConf::CommandConf( TQWidget* parent, const char* name, const TQStringList& /*args*/) : - PlugInConf(parent, name) +CommandConf::CommandConf( TQWidget* tqparent, const char* name, const TQStringList& /*args*/) : + PlugInConf(tqparent, name) { // kdDebug() << "CommandConf::CommandConf: Running" << endl; m_commandProc = 0; m_progressDlg = 0; - TQVBoxLayout *layout = new TQVBoxLayout(this, KDialog::marginHint(), + TQVBoxLayout *tqlayout = new TQVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint(), "CommandConfigWidgetLayout"); - layout->setAlignment (Qt::AlignTop); + tqlayout->tqsetAlignment (TQt::AlignTop); m_widget = new CommandConfWidget(this, "CommandConfigWidget"); - layout->addWidget(m_widget); + tqlayout->addWidget(m_widget); // Build codec list and fill combobox. m_codecList = PlugInProc::buildCodecList(); @@ -121,21 +121,21 @@ TQString CommandConf::getTalkerCode() { // 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()) + if ((url.tqcontains("%t") > 0) || (url.tqcontains("%f") > 0) || m_widget->stdInButton->isChecked()) { return TQString( "<voice lang=\"%1\" name=\"%2\" gender=\"%3\" />" "<prosody volume=\"%4\" rate=\"%5\" />" "<kttsd synthesizer=\"%6\" />") - .arg(m_languageCode) - .arg("fixed") - .arg("neutral") - .arg("medium") - .arg("medium") - .arg("Command"); + .tqarg(m_languageCode) + .tqarg("fixed") + .tqarg("neutral") + .tqarg("medium") + .tqarg("medium") + .tqarg("Command"); } } - return TQString::null; + return TQString(); } void CommandConf::slotCommandTest_clicked() @@ -203,7 +203,7 @@ void CommandConf::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/command/commandconf.h b/kttsd/plugins/command/commandconf.h index b3889b9..4607718 100644 --- a/kttsd/plugins/command/commandconf.h +++ b/kttsd/plugins/command/commandconf.h @@ -18,7 +18,7 @@ #ifndef _COMMANDCONF_H_ #define _COMMANDCONF_H_ -// Qt includes. +// TQt includes. #include <tqstring.h> #include <tqstringlist.h> @@ -35,11 +35,12 @@ class CommandProc; class KProgressDialog; class CommandConf : public PlugInConf { - Q_OBJECT + Q_OBJECT + TQ_OBJECT public: /** Constructor */ - CommandConf( TQWidget* parent = 0, const char* name = 0, const TQStringList &args = TQStringList()); + CommandConf( TQWidget* tqparent = 0, const char* name = 0, const TQStringList &args = TQStringList()); /** Destructor */ ~CommandConf(); @@ -71,7 +72,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 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. * @@ -89,7 +90,7 @@ class CommandConf : 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/command/commandconfwidget.ui b/kttsd/plugins/command/commandconfwidget.ui index b0b749c..7a45b20 100644 --- a/kttsd/plugins/command/commandconfwidget.ui +++ b/kttsd/plugins/command/commandconfwidget.ui @@ -1,6 +1,6 @@ <!DOCTYPE UI><UI version="3.2" stdsetdef="1"> <class>CommandConfWidget</class> -<widget class="QWidget"> +<widget class="TQWidget"> <property name="name"> <cstring>CommandConfWidget</cstring> </property> @@ -22,7 +22,7 @@ <property name="spacing"> <number>6</number> </property> - <widget class="QGroupBox" row="0" column="0"> + <widget class="TQGroupBox" row="0" column="0"> <property name="name"> <cstring>confiurationBox</cstring> </property> @@ -53,7 +53,7 @@ <enum>Horizontal</enum> </property> </widget> - <widget class="QLabel" row="2" column="0"> + <widget class="TQLabel" row="2" column="0"> <property name="name"> <cstring>urlLabel</cstring> </property> @@ -72,15 +72,15 @@ <string>This field specifies both the command used for speaking texts and its parameters. If you want to pass the text as a parameter, write %t at the place where the text should be inserted. To pass a file of the text, write %f. To synthesize only and let KTTSD play the synthesized text, write %w for the generated audio file.</string> </property> </widget> - <widget class="QLayoutWidget" row="5" column="0"> + <widget class="TQLayoutWidget" row="5" column="0"> <property name="name"> - <cstring>layout1</cstring> + <cstring>tqlayout1</cstring> </property> <hbox> <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QCheckBox"> + <widget class="TQCheckBox"> <property name="name"> <cstring>stdInButton</cstring> </property> @@ -101,14 +101,14 @@ <property name="sizeType"> <enum>Expanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>201</width> <height>20</height> </size> </property> </spacer> - <widget class="QPushButton"> + <widget class="TQPushButton"> <property name="name"> <cstring>commandTestButton</cstring> </property> @@ -118,15 +118,15 @@ </widget> </hbox> </widget> - <widget class="QLayoutWidget" row="4" column="0"> + <widget class="TQLayoutWidget" row="4" 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> @@ -163,7 +163,7 @@ </widget> </hbox> </widget> - <widget class="QLabel" row="0" column="0"> + <widget class="TQLabel" row="0" column="0"> <property name="name"> <cstring>explanationLabel</cstring> </property> @@ -187,7 +187,7 @@ <property name="sizeType"> <enum>Expanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>20</width> <height>30</height> @@ -214,10 +214,10 @@ <include location="global" impldecl="in implementation">kpushbutton.h</include> <include location="global" impldecl="in implementation">kcombobox.h</include> </includes> -<signals> +<Q_SIGNALS> <signal>configurationChanged()</signal> -</signals> -<layoutdefaults spacing="6" margin="11"/> +</Q_SIGNALS> +<tqlayoutdefaults spacing="6" margin="11"/> <includehints> <includehint>kurlrequester.h</includehint> <includehint>klineedit.h</includehint> diff --git a/kttsd/plugins/command/commandproc.cpp b/kttsd/plugins/command/commandproc.cpp index 77d63f3..8f8c500 100644 --- a/kttsd/plugins/command/commandproc.cpp +++ b/kttsd/plugins/command/commandproc.cpp @@ -15,7 +15,7 @@ * * ***************************************************************************/ -// Qt includes. +// TQt includes. #include <tqfile.h> #include <tqstring.h> #include <tqvaluelist.h> @@ -39,8 +39,8 @@ #include "commandproc.moc" /** Constructor */ -CommandProc::CommandProc( TQObject* parent, const char* name, const TQStringList& /*args*/) : - PlugInProc( parent, name ) +CommandProc::CommandProc( TQObject* tqparent, const char* name, const TQStringList& /*args*/) : + PlugInProc( tqparent, name ) { kdDebug() << "CommandProc::CommandProc: Running" << endl; m_commandProc = 0; @@ -72,8 +72,8 @@ bool CommandProc::init(KConfig *config, const TQString &configGroup){ m_stdin = config->readBoolEntry("StdIn", true); m_language = config->readEntry("LanguageCode", "en"); - // Support separate synthesis if the TTS command contains %w macro. - m_supportsSynth = (m_ttsCommand.contains("%w")); + // Support separate synthesis if the TTS command tqcontains %w macro. + m_supportsSynth = (m_ttsCommand.tqcontains("%w")); TQString codecString = config->readEntry("Codec", "Local"); m_codec = codecNameToCodec(codecString); @@ -89,7 +89,7 @@ bool CommandProc::init(KConfig *config, const TQString &configGroup){ */ void CommandProc::sayText(const TQString &text) { - synth(text, TQString::null, + synth(text, TQString(), m_ttsCommand, m_stdin, m_codec, m_language); } @@ -127,9 +127,9 @@ void CommandProc::synth(const TQString& inputText, const TQString& suggestedFile if (m_commandProc->isRunning()) m_commandProc->kill(); delete m_commandProc; m_commandProc = 0; - m_synthFilename = TQString::null; + m_synthFilename = TQString(); if (!m_textFilename.isNull()) TQFile::remove(m_textFilename); - m_textFilename = TQString::null; + m_textFilename = TQString(); } TQString command = userCmd; TQString text = inputText.stripWhiteSpace(); @@ -147,7 +147,7 @@ void CommandProc::synth(const TQString& inputText, const TQString& suggestedFile TQString escText = KShellProcess::quote(text); // 1.c) create a temporary file for the text, if %f macro is used. - if (command.contains("%f")) + if (command.tqcontains("%f")) { KTempFile tempFile(locateLocal("tmp", "commandplugin-"), ".txt"); TQTextStream* fs = tempFile.textStream(); @@ -156,13 +156,13 @@ void CommandProc::synth(const TQString& inputText, const TQString& suggestedFile *fs << endl; m_textFilename = tempFile.file()->name(); tempFile.close(); - } else m_textFilename = TQString::null; + } else m_textFilename = TQString(); // 2. replace variables with values TQValueStack<bool> stack; bool issinglequote=false; bool isdoublequote=false; - int noreplace=0; + int notqreplace=0; TQRegExp re_noquote("(\"|'|\\\\|`|\\$\\(|\\$\\{|\\(|\\{|\\)|\\}|%%|%t|%f|%l|%w)"); TQRegExp re_singlequote("('|%%|%t|%f|%l|%w)"); TQRegExp re_doublequote("(\"|\\\\|`|\\$\\(|\\$\\{|%%|%t|%f|%l|%w)"); @@ -178,18 +178,18 @@ void CommandProc::synth(const TQString& inputText, const TQString& suggestedFile { // assert(isdoublequote == false) stack.push(isdoublequote); - if (noreplace > 0) + if (notqreplace > 0) // count nested braces when within ${...} - noreplace++; + notqreplace++; i++; } else if (command[i]=='$') { stack.push(isdoublequote); isdoublequote = false; - if ((noreplace > 0) || (command[i+1]=='{')) + if ((notqreplace > 0) || (command[i+1]=='{')) // count nested braces when within ${...} - noreplace++; + notqreplace++; i+=2; } else if ((command[i]==')') || (command[i]=='}')) @@ -199,9 +199,9 @@ void CommandProc::synth(const TQString& inputText, const TQString& suggestedFile isdoublequote = stack.pop(); else qWarning("Parse error."); - if (noreplace > 0) + if (notqreplace > 0) // count nested braces when within ${...} - noreplace--; + notqreplace--; i++; } else if (command[i]=='\'') @@ -219,7 +219,7 @@ void CommandProc::synth(const TQString& inputText, const TQString& suggestedFile else if (command[i]=='`') { // Replace all `...` with safer $(...) - command.replace (i, 1, "$("); + command.tqreplace (i, 1, "$("); TQRegExp re_backticks("(`|\\\\`|\\\\\\\\|\\\\\\$)"); for ( int i2=re_backticks.search(command,i+2); i2!=-1; @@ -228,7 +228,7 @@ void CommandProc::synth(const TQString& inputText, const TQString& suggestedFile { if (command[i2] == '`') { - command.replace (i2, 1, ")"); + command.tqreplace (i2, 1, ")"); i2=command.length(); // leave loop } else @@ -239,7 +239,7 @@ void CommandProc::synth(const TQString& inputText, const TQString& suggestedFile } // Leave i unchanged! We need to process "$(" } - else if (noreplace == 0) // do not replace macros within ${...} + else if (notqreplace == 0) // do not replace macros within ${...} { TQString match, v; @@ -269,7 +269,7 @@ void CommandProc::synth(const TQString& inputText, const TQString& suggestedFile else if (issinglequote) v="'"+v+"'"; - command.replace (i, match.length(), v); + command.tqreplace (i, match.length(), v); i+=v.length(); } else @@ -382,13 +382,13 @@ void CommandProc::slotProcessExited(KProcess*) void CommandProc::slotReceivedStdout(KProcess*, char* buffer, int buflen) { - TQString buf = TQString::fromLatin1(buffer, buflen); + TQString buf = TQString::tqfromLatin1(buffer, buflen); kdDebug() << "CommandProc::slotReceivedStdout: Received output from Command: " << buf << endl; } void CommandProc::slotReceivedStderr(KProcess*, char* buffer, int buflen) { - TQString buf = TQString::fromLatin1(buffer, buflen); + TQString buf = TQString::tqfromLatin1(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 = TQString::null; + m_synthFilename = TQString(); if (!m_textFilename.isNull()) TQFile::remove(m_textFilename); - m_textFilename = TQString::null; + m_textFilename = TQString(); } } diff --git a/kttsd/plugins/command/commandproc.h b/kttsd/plugins/command/commandproc.h index c1880be..0faf1f4 100644 --- a/kttsd/plugins/command/commandproc.h +++ b/kttsd/plugins/command/commandproc.h @@ -18,7 +18,7 @@ #ifndef _COMMANDPROC_H_ #define _COMMANDPROC_H_ -// Qt includes. +// TQt includes. #include <tqstringlist.h> // KTTS includes. @@ -28,11 +28,12 @@ class KProcess; class TQTextCodec; class CommandProc : public PlugInProc{ - Q_OBJECT + Q_OBJECT + TQ_OBJECT public: /** Constructor */ - CommandProc( TQObject* parent = 0, const char* name = 0, + CommandProc( TQObject* tqparent = 0, const char* name = 0, const TQStringList &args = TQStringList()); /** Destructor */ |