From 4ae0c208b66e0f7954e194384464fe2d0a2c56dd Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:51:49 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1157652 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kunittest/runnergui.cpp | 122 ++++++++++++++++++++++++------------------------ 1 file changed, 61 insertions(+), 61 deletions(-) (limited to 'kunittest/runnergui.cpp') diff --git a/kunittest/runnergui.cpp b/kunittest/runnergui.cpp index ef5afe98..ded28e57 100644 --- a/kunittest/runnergui.cpp +++ b/kunittest/runnergui.cpp @@ -23,13 +23,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -68,7 +68,7 @@ namespace KUnitTest * @param name The name of the test. * @param info The debug info. */ - bool addDebugInfo(const QString &name, const QString &info) + bool addDebugInfo(const TQString &name, const TQString &info) { Tester *tester = Runner::self()->registry().find(name.local8Bit()); if ( tester == 0L ) return false; @@ -78,7 +78,7 @@ namespace KUnitTest return true; } - bool addSlotDebugInfo(const QString &name, const QString &slt, const QString &info) + bool addSlotDebugInfo(const TQString &name, const TQString &slt, const TQString &info) { Tester *tester = Runner::self()->registry().find(name.local8Bit()); @@ -95,7 +95,7 @@ namespace KUnitTest RunnerGUI *m_rg; }; - RunnerGUI::RunnerGUI(QWidget *parent) : QHBox(parent) + RunnerGUI::RunnerGUI(TQWidget *parent) : TQHBox(parent) { m_dcop = new RunnerGUIDCOPImpl(this); @@ -107,12 +107,12 @@ namespace KUnitTest m_testerWidget->selectCombo()->insertItem("Selected tests . . ."); RegistryIteratorType it(Runner::self()->registry()); - QStringList suites; + TQStringList suites; for ( ; it.current(); ++it ) { addTester(it.currentKey(), it.current()); - QString test = it.currentKey(); + TQString test = it.currentKey(); int index = test.find("::"); if ( index != -1 ) test = test.left(index); @@ -125,7 +125,7 @@ namespace KUnitTest // configure the resultslist m_testerWidget->resultList()->setAllColumnsShowFocus(true); - m_testerWidget->resultList()->setSelectionMode(QListView::Extended); + m_testerWidget->resultList()->setSelectionMode(TQListView::Extended); m_testerWidget->resultList()->setRootIsDecorated(true); m_testerWidget->resultList()->setColumnAlignment(g_finishedColumn, Qt::AlignHCenter); m_testerWidget->resultList()->setColumnAlignment(g_skippedColumn, Qt::AlignHCenter); @@ -140,10 +140,10 @@ namespace KUnitTest // init the progress bar configureProgressBar(Runner::self()->numberOfTestCases(), 0); - connect(Runner::self(), SIGNAL(finished(const char *, Tester *)), this, SLOT(addTestResult(const char *, Tester *))); - connect(m_testerWidget->resultList(), SIGNAL(clicked(QListViewItem *)), this, SLOT(showDetails(QListViewItem *))); - connect(m_testerWidget, SIGNAL(run()), this, SLOT(runSuite())); - connect(m_testerWidget->details(), SIGNAL(doubleClicked(int, int)), this, SLOT(doubleClickedOnDetails(int, int))); + connect(Runner::self(), TQT_SIGNAL(finished(const char *, Tester *)), this, TQT_SLOT(addTestResult(const char *, Tester *))); + connect(m_testerWidget->resultList(), TQT_SIGNAL(clicked(TQListViewItem *)), this, TQT_SLOT(showDetails(TQListViewItem *))); + connect(m_testerWidget, TQT_SIGNAL(run()), this, TQT_SLOT(runSuite())); + connect(m_testerWidget->details(), TQT_SIGNAL(doubleClicked(int, int)), this, TQT_SLOT(doubleClickedOnDetails(int, int))); } RunnerGUI::~RunnerGUI() @@ -161,23 +161,23 @@ namespace KUnitTest { if ( Runner::self()->numberOfTests() > 0 ) m_testerWidget->resultsLabel()->setText( - QString("Test cases: %1 | Tests performed: %5, Skipped: %4 | Passed: %2, Failed: %3") + TQString("Test cases: %1 | Tests performed: %5, Skipped: %4 | Passed: %2, Failed: %3") .arg(Runner::self()->numberOfTestCases()) .arg(Runner::self()->numberOfPassedTests()) .arg(Runner::self()->numberOfFailedTests()) .arg(Runner::self()->numberOfSkippedTests()) .arg(Runner::self()->numberOfTests()) ); else - m_testerWidget->resultsLabel()->setText(QString("Test cases: %1").arg(Runner::self()->numberOfTestCases())); + m_testerWidget->resultsLabel()->setText(TQString("Test cases: %1").arg(Runner::self()->numberOfTestCases())); } void RunnerGUI::addTestResult(const char *name, Tester *test) { - QStringList scopes = QStringList::split("::", name); - QString suite = scopes[0]; + TQStringList scopes = TQStringList::split("::", name); + TQString suite = scopes[0]; // find the suite item - QListViewItem *item = 0L; + TQListViewItem *item = 0L; for ( uint i = 0; i < scopes.count(); ++i ) item = getItem(scopes[i], item); @@ -185,7 +185,7 @@ namespace KUnitTest { SlotTester *sltest = static_cast(test); TestResultsListIteratorType it(sltest->resultsList()); - QListViewItem *slotItem = 0L; + TQListViewItem *slotItem = 0L; for ( ; it.current(); ++it) { slotItem = getItem(it.currentKey(), item); @@ -201,28 +201,28 @@ namespace KUnitTest void RunnerGUI::addTester(const char *name, Tester *test) { - QStringList scopes = QStringList::split("::", name); - QString suite = scopes[0]; + TQStringList scopes = TQStringList::split("::", name); + TQString suite = scopes[0]; // find the suite item - QListViewItem *item = 0L; + TQListViewItem *item = 0L; for ( uint i = 0; i < scopes.count(); ++i ) item = getItem(scopes[i], item); if ( test->inherits("KUnitTest::SlotTester") ) { - QStrList allSlots = test->metaObject()->slotNames(); + TQStrList allSlots = test->metaObject()->slotNames(); for ( char *sl = allSlots.first(); sl; sl = allSlots.next() ) { - if ( QString(sl).startsWith("test") ) + if ( TQString(sl).startsWith("test") ) getItem(sl, item); } } } - QListViewItem *RunnerGUI::getItem(const QString &name, QListViewItem *item /*= 0L*/) + TQListViewItem *RunnerGUI::getItem(const TQString &name, TQListViewItem *item /*= 0L*/) { - QListViewItem *parent = item; + TQListViewItem *parent = item; if ( item == 0L ) item = m_testerWidget->resultList()->firstChild(); else item = item->firstChild(); @@ -234,9 +234,9 @@ namespace KUnitTest if ( item == 0L ) { if ( parent == 0L ) - item = new QListViewItem(m_testerWidget->resultList()); + item = new TQListViewItem(m_testerWidget->resultList()); else - item = new QListViewItem(parent); + item = new TQListViewItem(parent); item->setText(g_nameColumn, name); } @@ -246,44 +246,44 @@ namespace KUnitTest void RunnerGUI::reset() { - QListViewItemIterator it( m_testerWidget->resultList() ); + TQListViewItemIterator it( m_testerWidget->resultList() ); while ( it.current() ) { - QListViewItem *item = it.current(); + TQListViewItem *item = it.current(); item->setText(g_finishedColumn, "0"); item->setText(g_skippedColumn, "0"); item->setText(g_failedColumn, "0"); item->setText(g_xfailedColumn, "0"); item->setText(g_passedColumn, "0"); item->setText(g_xpassedColumn, "0"); - item->setPixmap(g_nameColumn, QPixmap()); + item->setPixmap(g_nameColumn, TQPixmap()); ++it; } } - void RunnerGUI::setSummary(QListViewItem *item, TestResults *res) + void RunnerGUI::setSummary(TQListViewItem *item, TestResults *res) { if ( item == 0L ) return; bool ok; int val = item->text(g_finishedColumn).toInt(&ok); if (!ok) val = 0; - item->setText(g_finishedColumn, QString::number(val + res->testsFinished())); + item->setText(g_finishedColumn, TQString::number(val + res->testsFinished())); val = item->text(g_skippedColumn).toInt(&ok); if (!ok) val = 0; - item->setText(g_skippedColumn, QString::number(val + res->skipped())); + item->setText(g_skippedColumn, TQString::number(val + res->skipped())); val = item->text(g_passedColumn).toInt(&ok); if (!ok) val = 0; - item->setText(g_passedColumn, QString::number(val + res->passed())); + item->setText(g_passedColumn, TQString::number(val + res->passed())); val = item->text(g_failedColumn).toInt(&ok); if (!ok) val = 0; - item->setText(g_failedColumn, QString::number(val + res->errors())); + item->setText(g_failedColumn, TQString::number(val + res->errors())); val = item->text(g_xfailedColumn).toInt(&ok); if (!ok) val = 0; - item->setText(g_xfailedColumn, QString::number(val + res->xfails())); + item->setText(g_xfailedColumn, TQString::number(val + res->xfails())); val = item->text(g_xpassedColumn).toInt(&ok); if (!ok) val = 0; - item->setText(g_xpassedColumn, QString::number(val + res->xpasses())); + item->setText(g_xpassedColumn, TQString::number(val + res->xpasses())); bool passed = (item->text(g_failedColumn).toInt(&ok) + item->text(g_xfailedColumn).toInt(&ok)) == 0; item->setPixmap(g_nameColumn, passed ? SmallIcon("button_ok") : SmallIcon("button_cancel") ); @@ -291,9 +291,9 @@ namespace KUnitTest setSummary(item->parent(), res); } - QString RunnerGUI::fullName(QListViewItem *item) + TQString RunnerGUI::fullName(TQListViewItem *item) { - QString name = item->text(g_nameColumn); + TQString name = item->text(g_nameColumn); while ( (item = item->parent()) != 0L ) name = item->text(g_nameColumn) + "::" + name; @@ -312,14 +312,14 @@ namespace KUnitTest } else if ( m_testerWidget->selectCombo()->currentItem() == 1 ) { - QListViewItemIterator it( m_testerWidget->resultList() ); - QStringList prefixes; + TQListViewItemIterator it( m_testerWidget->resultList() ); + TQStringList prefixes; while ( it.current() ) { - QListViewItem *item = it.current(); + TQListViewItem *item = it.current(); if ( item->isSelected() ) { - QString prefix = fullName(item); + TQString prefix = fullName(item); if ( prefix.endsWith("()") ) { int index = prefix.findRev("::"); @@ -337,11 +337,11 @@ namespace KUnitTest } else { - QString suite = m_testerWidget->selectCombo()->currentText(); - QStringList tests; + TQString suite = m_testerWidget->selectCombo()->currentText(); + TQStringList tests; RegistryIteratorType it(Runner::self()->registry()); for ( ; it.current(); ++it ) - if ( QString(it.currentKey()).startsWith(suite) ) + if ( TQString(it.currentKey()).startsWith(suite) ) tests.append(it.currentKey()); configureProgressBar(tests.count(), 0); @@ -353,11 +353,11 @@ namespace KUnitTest showDetails(m_testerWidget->resultList()->currentItem()); } - void RunnerGUI::showDetails(QListViewItem *item) + void RunnerGUI::showDetails(TQListViewItem *item) { if ( item == 0L ) return; - QString name = fullName(item); + TQString name = fullName(item); if ( name.endsWith("()") ) name = fullName(item->parent()); Tester *tester = Runner::self()->registry().find(name.local8Bit()); @@ -374,7 +374,7 @@ namespace KUnitTest m_testerWidget->details()->setText("No test found with name: " + fullName(item)); else { - QTextEdit *te = m_testerWidget->details(); + TQTextEdit *te = m_testerWidget->details(); te->clear(); @@ -401,7 +401,7 @@ namespace KUnitTest } } - void RunnerGUI::appendList(QTextEdit *te, const QStringList &list) + void RunnerGUI::appendList(TQTextEdit *te, const TQStringList &list) { for ( uint i = 0; i < list.count(); ++i ) te->append(list[i]); @@ -409,20 +409,20 @@ namespace KUnitTest void RunnerGUI::doubleClickedOnDetails(int para, int /*pos*/) { - static QRegExp reFileAndLine("^(.*)\\[([0-9]+)\\]:"); + static TQRegExp reFileAndLine("^(.*)\\[([0-9]+)\\]:"); - QString line = m_testerWidget->details()->text(para); + TQString line = m_testerWidget->details()->text(para); m_testerWidget->details()->setSelection(para, 0, para, line.length()-1); if ( reFileAndLine.search(line) != -1 ) { DCOPClient client; client.attach(); - QByteArray data; - QDataStream arg(data, IO_WriteOnly); + TQByteArray data; + TQDataStream arg(data, IO_WriteOnly); bool ok; - arg << QString(reFileAndLine.cap(1)) << (reFileAndLine.cap(2).toInt(&ok) - 1); - client.send("kdevelop-*", "KDevPartController", "editDocument(QString,int)", data); + arg << TQString(reFileAndLine.cap(1)) << (reFileAndLine.cap(2).toInt(&ok) - 1); + client.send("kdevelop-*", "KDevPartController", "editDocument(TQString,int)", data); client.send("kdevelop-*", "MainWindow", "raise()", ""); client.detach(); -- cgit v1.2.1