diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 19:59:21 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-04 19:59:21 +0000 |
commit | b9c374725620ec064db7610132a8b8969fa405b9 (patch) | |
tree | 645c03144cac22f7b4fb5bd10985d389e8954290 /src/kile/configtester.cpp | |
parent | 71729070d61b36b96acd7fa9c34bba0cb8f58c3b (diff) | |
download | kile-b9c374725620ec064db7610132a8b8969fa405b9.tar.gz kile-b9c374725620ec064db7610132a8b8969fa405b9.zip |
TQt4 port kile
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kile@1239285 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kile/configtester.cpp')
-rw-r--r-- | src/kile/configtester.cpp | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/src/kile/configtester.cpp b/src/kile/configtester.cpp index eeaf5cb..a68cfe3 100644 --- a/src/kile/configtester.cpp +++ b/src/kile/configtester.cpp @@ -15,7 +15,7 @@ #include "configtester.h" -#include <qfile.h> +#include <tqfile.h> #include <kio/netaccess.h> #include <klocale.h> @@ -32,14 +32,14 @@ #include "kiletool.h" ConfigTest::ConfigTest() : - m_name(QString::null), - m_arg(QString::null), - m_altArg(QString::null), + m_name(TQString()), + m_arg(TQString()), + m_altArg(TQString()), m_mustPass(false) { } -ConfigTest::ConfigTest(const QString &name, bool mustpass, const QString &arg, const QString &altarg /*= QString::null*/) : +ConfigTest::ConfigTest(const TQString &name, bool mustpass, const TQString &arg, const TQString &altarg /*= TQString()*/) : m_name(name), m_arg(arg), m_altArg(altarg), @@ -62,22 +62,22 @@ int ConfigTest::status() const else return Failure; } -QString ConfigTest::name() const +TQString ConfigTest::name() const { return prettyName(m_name); } -QString ConfigTest::resultText() const +TQString ConfigTest::resultText() const { - QString str = successMessage(m_name); + TQString str = successMessage(m_name); if ( status() == Failure ) str = failureMessage(m_name); else if ( status() == Critical ) str = criticalMessage(m_name); if ( m_name == "binary" ) { str += " (" + m_altArg + " => " + m_arg + ')'; - if ( status()==Failure && s_msgFailure.contains(m_altArg) ) - str += QString("<br>(%1)").arg( s_msgFailure[m_altArg] ); + if ( status()==Failure && s_msgFailure.tqcontains(m_altArg) ) + str += TQString("<br>(%1)").tqarg( s_msgFailure[m_altArg] ); return str; } else if ( m_name == "version" ) @@ -86,41 +86,41 @@ QString ConfigTest::resultText() const return str; } -QMap<QString,QString> ConfigTest::s_prettyName; -QMap<QString,QString> ConfigTest::s_msgSuccess; -QMap<QString,QString> ConfigTest::s_msgFailure; -QMap<QString,QString> ConfigTest::s_msgCritical; +TQMap<TQString,TQString> ConfigTest::s_prettyName; +TQMap<TQString,TQString> ConfigTest::s_msgSuccess; +TQMap<TQString,TQString> ConfigTest::s_msgFailure; +TQMap<TQString,TQString> ConfigTest::s_msgCritical; -void ConfigTest::addPrettyName(const QString &test, const QString &prettyName) { s_prettyName [test] = prettyName;} -void ConfigTest::addSuccessMessage(const QString &test, const QString &msg) { s_msgSuccess [test] = msg; } -void ConfigTest::addFailureMessage(const QString &test, const QString &msg) { s_msgFailure [test] = msg; } -void ConfigTest::addCriticalMessage(const QString &test, const QString &msg) { s_msgCritical [test] = msg; } +void ConfigTest::addPrettyName(const TQString &test, const TQString &prettyName) { s_prettyName [test] = prettyName;} +void ConfigTest::addSuccessMessage(const TQString &test, const TQString &msg) { s_msgSuccess [test] = msg; } +void ConfigTest::addFailureMessage(const TQString &test, const TQString &msg) { s_msgFailure [test] = msg; } +void ConfigTest::addCriticalMessage(const TQString &test, const TQString &msg) { s_msgCritical [test] = msg; } -QString ConfigTest::prettyName(const QString &test) +TQString ConfigTest::prettyName(const TQString &test) { - if ( s_prettyName.contains(test) ) return s_prettyName[test]; + if ( s_prettyName.tqcontains(test) ) return s_prettyName[test]; else return test; } -QString ConfigTest::successMessage(const QString &test) +TQString ConfigTest::successMessage(const TQString &test) { - if ( s_msgSuccess.contains(test) ) return s_msgSuccess[test]; + if ( s_msgSuccess.tqcontains(test) ) return s_msgSuccess[test]; else return i18n("Passed"); } -QString ConfigTest::failureMessage(const QString &test) +TQString ConfigTest::failureMessage(const TQString &test) { - if ( s_msgFailure.contains(test) ) return s_msgFailure[test]; + if ( s_msgFailure.tqcontains(test) ) return s_msgFailure[test]; else return i18n("Failed"); } -QString ConfigTest::criticalMessage(const QString &test) +TQString ConfigTest::criticalMessage(const TQString &test) { - if ( s_msgCritical.contains(test) ) return s_msgCritical[test]; + if ( s_msgCritical.tqcontains(test) ) return s_msgCritical[test]; else return i18n("Critical failure"); } -Tester::Tester(QObject *parent, const char *name) : QObject(parent, name), m_process(0L) +Tester::Tester(TQObject *tqparent, const char *name) : TQObject(tqparent, name), m_process(0L) { ConfigTest::addPrettyName("binary", i18n("Binary")); ConfigTest::addCriticalMessage("binary", i18n("Could not find the binary for this essential tool.")); @@ -131,7 +131,7 @@ Tester::Tester(QObject *parent, const char *name) : QObject(parent, name), m_pro ConfigTest::addPrettyName("version", i18n("Version")); ConfigTest::addPrettyName("kile", i18n("Running in Kile")); - QString str = i18n("Kile is not configured correctly. Go to Settings->Configure Kile->Tools and either fix the problem or change to the default settings."); + TQString str = i18n("Kile is not configured correctly. Go to Settings->Configure Kile->Tools and either fix the problem or change to the default settings."); ConfigTest::addCriticalMessage("kile", str); ConfigTest::addFailureMessage("kile", str); @@ -161,16 +161,16 @@ void Tester::saveResults(const KURL & dest) void Tester::runTests() { - QString srcdir = KGlobal::dirs()->findResourceDir("appdata","test/runTests.sh") + "test"; + TQString srcdir = KGlobal::dirs()->findResourceDir("appdata","test/runTests.sh") + "test"; KILE_DEBUG() << "Tester::runTests: srcdir = " << srcdir << endl; m_tempDir = new KTempDir(); - QString destdir = m_tempDir->name(); + TQString destdir = m_tempDir->name(); KILE_DEBUG() << "Tester::runTests: destdir = " << destdir << endl; m_resultsFile = destdir + "results.rc"; - QString shellname = KGlobal::dirs()->findExe("sh"); + TQString shellname = KGlobal::dirs()->findExe("sh"); KILE_DEBUG() << "Tester::runTests: shellname = " << shellname << endl; - m_process = new KShellProcess(QFile::encodeName( shellname )); + m_process = new KShellProcess(TQFile::encodeName( shellname )); if (! KileConfig::teXPaths().isEmpty()) { m_process->setEnvironment("TEXINPUTS", KileInfo::expandEnvironmentVars( KileConfig::teXPaths() + ":$TEXINPUTS")); @@ -178,8 +178,8 @@ void Tester::runTests() *m_process << "cd " + KShellProcess::quote(destdir) + " && "; *m_process << "cp " + KShellProcess::quote(srcdir) +"/* " + KShellProcess::quote(destdir) + " && "; *m_process << "source runTests.sh " + KShellProcess::quote(m_resultsFile) + " " + KShellProcess::quote(destdir); - connect(m_process, SIGNAL(receivedStdout(KProcess *, char *, int)), this, SLOT(determineProgress(KProcess *, char *, int))); - connect(m_process, SIGNAL(processExited(KProcess *)), this, SLOT(processTestResults(KProcess *))); + connect(m_process, TQT_SIGNAL(receivedStdout(KProcess *, char *, int)), this, TQT_SLOT(determineProgress(KProcess *, char *, int))); + connect(m_process, TQT_SIGNAL(processExited(KProcess *)), this, TQT_SLOT(processTestResults(KProcess *))); if (m_process->start(KProcess::NotifyOnExit, KProcess::AllOutput)) emit(started()); } @@ -190,15 +190,15 @@ void Tester::stop() void Tester::determineProgress(KProcess */*proc*/, char *buf, int len) { - static QString s = QString::null; + static TQString s = TQString(); - s += QString::fromLocal8Bit(buf, len); + s += TQString::fromLocal8Bit(buf, len); if ( s.endsWith("\n") ) { bool ok = false; int number = s.toInt(&ok); if (ok) emit(percentageDone(number)); - s = QString::null; + s = TQString(); } } @@ -209,9 +209,9 @@ void Tester::processTestResults (KProcess *proc) emit(percentageDone(100)); KSimpleConfig config(m_resultsFile, true); - QStringList groups = config.groupList(); - QStringList::Iterator itend = groups.end(); - for ( QStringList::Iterator it = groups.begin(); it != itend; ++it ) + TQStringList groups = config.groupList(); + TQStringList::Iterator itend = groups.end(); + for ( TQStringList::Iterator it = groups.begin(); it != itend; ++it ) processTool(&config, *it); emit(finished(true)); @@ -223,41 +223,41 @@ void Tester::processTestResults (KProcess *proc) } } -void Tester::processTool(KConfig *config, const QString &tool) +void Tester::processTool(KConfig *config, const TQString &tool) { config->setGroup(tool); - QStringList criticaltests = QStringList::split(",", config->readEntry("mustpass", "")); + TQStringList criticaltests = TQStringList::split(",", config->readEntry("mustpass", "")); //Did we find the executable? - QValueList<ConfigTest> tests; - tests << ConfigTest("binary", criticaltests.contains("where"), config->readEntry("where"), config->readEntry("executable")); - if (config->hasKey("version") ) tests << ConfigTest("version", criticaltests.contains("version"), config->readEntry("version")); - if (config->hasKey("basic") ) tests << ConfigTest("basic", criticaltests.contains("basic"), config->readEntry("basic")); - if (config->hasKey("src") ) tests << ConfigTest("src", criticaltests.contains("src"), config->readEntry("src")); - if (config->hasKey("kile") ) tests << ConfigTest("kile", criticaltests.contains("kile"), config->readEntry("kile")); + TQValueList<ConfigTest> tests; + tests << ConfigTest("binary", criticaltests.tqcontains("where"), config->readEntry("where"), config->readEntry("executable")); + if (config->hasKey("version") ) tests << ConfigTest("version", criticaltests.tqcontains("version"), config->readEntry("version")); + if (config->hasKey("basic") ) tests << ConfigTest("basic", criticaltests.tqcontains("basic"), config->readEntry("basic")); + if (config->hasKey("src") ) tests << ConfigTest("src", criticaltests.tqcontains("src"), config->readEntry("src")); + if (config->hasKey("kile") ) tests << ConfigTest("kile", criticaltests.tqcontains("kile"), config->readEntry("kile")); addResult(tool, tests); } -void Tester::addResult(const QString &tool, const QValueList<ConfigTest> &tests) +void Tester::addResult(const TQString &tool, const TQValueList<ConfigTest> &tests) { m_results [tool] = tests; } -QStringList Tester::testedTools() +TQStringList Tester::testedTools() { return m_results.keys(); } -QValueList<ConfigTest> Tester::resultForTool(const QString & tool) +TQValueList<ConfigTest> Tester::resultForTool(const TQString & tool) { return m_results[tool]; } -int Tester::statusForTool(const QString & tool) +int Tester::statusForTool(const TQString & tool) { - QValueList<ConfigTest> tests = m_results[tool]; + TQValueList<ConfigTest> tests = m_results[tool]; int status = ConfigTest::Success; for ( uint i = 0; i < tests.count(); ++i) { |