diff options
Diffstat (limited to 'parts/valgrind/valgrind_part.cpp')
-rw-r--r-- | parts/valgrind/valgrind_part.cpp | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/parts/valgrind/valgrind_part.cpp b/parts/valgrind/valgrind_part.cpp index 868faf28..801d1c2a 100644 --- a/parts/valgrind/valgrind_part.cpp +++ b/parts/valgrind/valgrind_part.cpp @@ -1,8 +1,8 @@ #include "valgrind_part.h" -#include <qwhatsthis.h> -#include <qregexp.h> -#include <qfile.h> +#include <tqwhatsthis.h> +#include <tqregexp.h> +#include <tqfile.h> #include <kiconloader.h> #include <klocale.h> @@ -26,29 +26,29 @@ typedef KDevGenericFactory<ValgrindPart> ValgrindFactory; static const KDevPluginInfo data("kdevvalgrind"); K_EXPORT_COMPONENT_FACTORY( libkdevvalgrind, ValgrindFactory( data ) ) -ValgrindPart::ValgrindPart( QObject *parent, const char *name, const QStringList& ) +ValgrindPart::ValgrindPart( TQObject *parent, const char *name, const TQStringList& ) : KDevPlugin( &data, parent, name ? name : "ValgrindPart" ) { setInstance( ValgrindFactory::instance() ); setXMLFile( "kdevpart_valgrind.rc" ); proc = new KShellProcess(); - connect( proc, SIGNAL(receivedStdout( KProcess*, char*, int )), - this, SLOT(receivedStdout( KProcess*, char*, int )) ); - connect( proc, SIGNAL(receivedStderr( KProcess*, char*, int )), - this, SLOT(receivedStderr( KProcess*, char*, int )) ); - connect( proc, SIGNAL(processExited( KProcess* )), - this, SLOT(processExited( KProcess* )) ); - connect( core(), SIGNAL(stopButtonClicked(KDevPlugin*)), - this, SLOT(slotStopButtonClicked(KDevPlugin*)) ); - connect( core(), SIGNAL(projectOpened()), - this, SLOT(projectOpened()) ); + connect( proc, TQT_SIGNAL(receivedStdout( KProcess*, char*, int )), + this, TQT_SLOT(receivedStdout( KProcess*, char*, int )) ); + connect( proc, TQT_SIGNAL(receivedStderr( KProcess*, char*, int )), + this, TQT_SLOT(receivedStderr( KProcess*, char*, int )) ); + connect( proc, TQT_SIGNAL(processExited( KProcess* )), + this, TQT_SLOT(processExited( KProcess* )) ); + connect( core(), TQT_SIGNAL(stopButtonClicked(KDevPlugin*)), + this, TQT_SLOT(slotStopButtonClicked(KDevPlugin*)) ); + connect( core(), TQT_SIGNAL(projectOpened()), + this, TQT_SLOT(projectOpened()) ); m_widget = new ValgrindWidget( this ); m_widget->setIcon( SmallIcon("fork") ); m_widget->setCaption(i18n("Valgrind Output")); - QWhatsThis::add( m_widget, i18n( "<b>Valgrind</b><p>Shows the output of the valgrind. Valgrind detects<br>" + TQWhatsThis::add( m_widget, i18n( "<b>Valgrind</b><p>Shows the output of the valgrind. Valgrind detects<br>" "use of uninitialized memory<br>" "reading/writing memory after it has been free'd<br>" "reading/writing off the end of malloc'd blocks<br>" @@ -59,12 +59,12 @@ ValgrindPart::ValgrindPart( QObject *parent, const char *name, const QStringList "some abuses of the POSIX pthread API." ) ); KAction* action = new KAction( i18n("&Valgrind Memory Leak Check"), 0, this, - SLOT(slotExecValgrind()), actionCollection(), "tools_valgrind" ); + TQT_SLOT(slotExecValgrind()), actionCollection(), "tools_valgrind" ); action->setToolTip(i18n("Valgrind memory leak check")); action->setWhatsThis(i18n("<b>Valgrind memory leak check</b><p>Runs Valgrind - a tool to help you find memory-management problems in your programs.")); action = new KAction( i18n("P&rofile with KCachegrind"), 0, this, - SLOT(slotExecCalltree()), actionCollection(), "tools_calltree" ); + TQT_SLOT(slotExecCalltree()), actionCollection(), "tools_calltree" ); action->setToolTip(i18n("Profile with KCachegrind")); action->setWhatsThis(i18n("<b>Profile with KCachegrind</b><p>Runs your program in calltree and then displays profiler information in KCachegrind.")); @@ -87,11 +87,11 @@ void ValgrindPart::projectOpened() void ValgrindPart::loadOutput() { - QString fName = KFileDialog::getOpenFileName(QString::null, "*", 0, i18n("Open Valgrind Output")); + TQString fName = KFileDialog::getOpenFileName(TQString::null, "*", 0, i18n("Open Valgrind Output")); if ( fName.isEmpty() ) return; - QFile f( fName ); + TQFile f( fName ); if ( !f.open( IO_ReadOnly ) ) { KMessageBox::sorry( 0, i18n("Could not open valgrind output: %1").arg(fName) ); return; @@ -100,7 +100,7 @@ void ValgrindPart::loadOutput() clear(); getActiveFiles(); - QTextStream stream( &f ); + TQTextStream stream( &f ); while ( !stream.atEnd() ) { receivedString( stream.readLine() + "\n" ); } @@ -111,10 +111,10 @@ void ValgrindPart::getActiveFiles() { activeFiles.clear(); if ( project() ) { - QStringList projectFiles = project()->allFiles(); - QString projectDirectory = project()->projectDirectory(); + TQStringList projectFiles = project()->allFiles(); + TQString projectDirectory = project()->projectDirectory(); KURL url; - for ( QStringList::Iterator it = projectFiles.begin(); it != projectFiles.end(); ++it ) { + for ( TQStringList::Iterator it = projectFiles.begin(); it != projectFiles.end(); ++it ) { KURL url( projectDirectory + "/" + (*it) ); url.cleanPath( true ); activeFiles += url.path(); @@ -123,13 +123,13 @@ void ValgrindPart::getActiveFiles() } } -static void guessActiveItem( ValgrindItem& item, const QStringList activeFiles ) +static void guessActiveItem( ValgrindItem& item, const TQStringList activeFiles ) { if ( activeFiles.isEmpty() && item.backtrace().isEmpty() ) return; for ( ValgrindItem::BacktraceList::Iterator it = item.backtrace().begin(); it != item.backtrace().end(); ++it ) { // active: first line of backtrace that lies in project source file - for ( QStringList::ConstIterator it2 = activeFiles.begin(); it2 != activeFiles.end(); ++it2 ) { + for ( TQStringList::ConstIterator it2 = activeFiles.begin(); it2 != activeFiles.end(); ++it2 ) { if ( (*it).url() == (*it2) ) { (*it).setHighlighted( true ); return; @@ -138,7 +138,7 @@ static void guessActiveItem( ValgrindItem& item, const QStringList activeFiles ) } } -void ValgrindPart::appendMessage( const QString& message ) +void ValgrindPart::appendMessage( const TQString& message ) { if ( message.isEmpty() ) return; @@ -162,7 +162,7 @@ void ValgrindPart::slotExecValgrind() kcInfo.runKc = false; _lastValExec = dlg->valExecutable(); _lastValParams = dlg->valParams(); - if ( dlg->exec() == QDialog::Accepted ) { + if ( dlg->exec() == TQDialog::Accepted ) { runValgrind( dlg->executableName(), dlg->parameters(), dlg->valExecutable(), dlg->valParams() ); } } @@ -182,7 +182,7 @@ void ValgrindPart::slotExecCalltree() kcInfo.runKc = true; kcInfo.kcPath = dlg->kcExecutable(); // kcInfo.kcWorkDir = KURL(dlg->executableName()).directory(); - if ( dlg->exec() == QDialog::Accepted ) { + if ( dlg->exec() == TQDialog::Accepted ) { runValgrind( dlg->executableName(), dlg->parameters(), dlg->ctExecutable(), dlg->ctParams() ); } _lastKcExec = dlg->kcExecutable(); @@ -206,12 +206,12 @@ void ValgrindPart::slotStopButtonClicked( KDevPlugin* which ) void ValgrindPart::clear() { m_widget->clear(); - currentMessage = QString::null; + currentMessage = TQString::null; currentPid = -1; - lastPiece = QString::null; + lastPiece = TQString::null; } -void ValgrindPart::runValgrind( const QString& exec, const QString& params, const QString& valExec, const QString& valParams ) +void ValgrindPart::runValgrind( const TQString& exec, const TQString& params, const TQString& valExec, const TQString& valParams ) { if ( proc->isRunning() ) { KMessageBox::sorry( 0, i18n( "There is already an instance of valgrind running." ) ); @@ -230,11 +230,11 @@ void ValgrindPart::runValgrind( const QString& exec, const QString& params, cons if (project()) run_envvars = project()->runEnvironmentVars(); - QStringList envVarList; + TQStringList envVarList; DomUtil::PairList::ConstIterator it; for (it = run_envvars.begin(); it != run_envvars.end(); ++it) { - envVarList << QString("%1=\"%2\" ").arg((*it).first).arg((*it).second); + envVarList << TQString("%1=\"%2\" ").arg((*it).first).arg((*it).second); } *proc << envVarList.join("") << valExec << valParams << exec << params; @@ -248,20 +248,20 @@ void ValgrindPart::runValgrind( const QString& exec, const QString& params, cons void ValgrindPart::receivedStdout( KProcess*, char* /* msg */, int /* len */ ) { - //kdDebug() << "got StdOut: " <<QString::fromLocal8Bit( msg, len ) << endl; + //kdDebug() << "got StdOut: " <<TQString::fromLocal8Bit( msg, len ) << endl; } void ValgrindPart::receivedStderr( KProcess*, char* msg, int len ) { - receivedString( QString::fromLocal8Bit( msg, len ) ); + receivedString( TQString::fromLocal8Bit( msg, len ) ); } -void ValgrindPart::receivedString( const QString& str ) +void ValgrindPart::receivedString( const TQString& str ) { - QString rmsg = lastPiece + str; - QStringList lines = QStringList::split( "\n", rmsg ); + TQString rmsg = lastPiece + str; + TQStringList lines = TQStringList::split( "\n", rmsg ); -// kdDebug() << "got: " << QString::fromLocal8Bit( msg, len ) << endl; +// kdDebug() << "got: " << TQString::fromLocal8Bit( msg, len ) << endl; if ( !rmsg.endsWith( "\n" ) ) { // the last message is trucated, we'll receive @@ -269,16 +269,16 @@ void ValgrindPart::receivedString( const QString& str ) lastPiece = lines.back(); lines.pop_back(); } else { - lastPiece = QString::null; + lastPiece = TQString::null; } appendMessages( lines ); } -void ValgrindPart::appendMessages( const QStringList& lines ) +void ValgrindPart::appendMessages( const TQStringList& lines ) { - QRegExp valRe( "==(\\d+)== (.*)" ); + TQRegExp valRe( "==(\\d+)== (.*)" ); - for ( QStringList::ConstIterator it = lines.begin(); it != lines.end(); ++it ) { + for ( TQStringList::ConstIterator it = lines.begin(); it != lines.end(); ++it ) { if ( valRe.search( *it ) < 0 ) continue; @@ -286,7 +286,7 @@ void ValgrindPart::appendMessages( const QStringList& lines ) if ( valRe.cap( 2 ).isEmpty() ) { appendMessage( currentMessage ); - currentMessage = QString::null; + currentMessage = TQString::null; } else if ( cPid != currentPid ) { appendMessage( currentMessage ); currentMessage = *it; @@ -303,8 +303,8 @@ void ValgrindPart::processExited( KProcess* p ) { if ( p == proc ) { appendMessage( currentMessage + lastPiece ); - currentMessage = QString::null; - lastPiece = QString::null; + currentMessage = TQString::null; + lastPiece = TQString::null; core()->running( this, false ); if (kcInfo.runKc) @@ -312,49 +312,49 @@ void ValgrindPart::processExited( KProcess* p ) KProcess *kcProc = new KProcess; // kcProc->setWorkingDirectory(kcInfo.kcWorkDir); *kcProc << kcInfo.kcPath; - *kcProc << QString("callgrind.out.%1").arg(p->pid()); + *kcProc << TQString("callgrind.out.%1").arg(p->pid()); kcProc->start(KProcess::DontCare); } } } -void ValgrindPart::restorePartialProjectSession( const QDomElement* el ) +void ValgrindPart::restorePartialProjectSession( const TQDomElement* el ) { - QDomElement execElem = el->namedItem( "executable" ).toElement(); + TQDomElement execElem = el->namedItem( "executable" ).toElement(); _lastExec = execElem.attribute( "path", "" ); _lastParams = execElem.attribute( "params", "" ); - QDomElement valElem = el->namedItem( "valgrind" ).toElement(); + TQDomElement valElem = el->namedItem( "valgrind" ).toElement(); _lastValExec = valElem.attribute( "path", "" ); _lastValParams = valElem.attribute( "params", "" ); - QDomElement ctElem = el->namedItem( "calltree" ).toElement(); + TQDomElement ctElem = el->namedItem( "calltree" ).toElement(); _lastCtExec = ctElem.attribute( "path", "" ); _lastCtParams = ctElem.attribute( "params", "" ); - QDomElement kcElem = el->namedItem( "kcachegrind" ).toElement(); + TQDomElement kcElem = el->namedItem( "kcachegrind" ).toElement(); _lastKcExec = kcElem.attribute( "path", "" ); } -void ValgrindPart::savePartialProjectSession( QDomElement* el ) +void ValgrindPart::savePartialProjectSession( TQDomElement* el ) { - QDomDocument domDoc = el->ownerDocument(); + TQDomDocument domDoc = el->ownerDocument(); if ( domDoc.isNull() ) return; - QDomElement execElem = domDoc.createElement( "executable" ); + TQDomElement execElem = domDoc.createElement( "executable" ); execElem.setAttribute( "path", _lastExec ); execElem.setAttribute( "params", _lastParams ); - QDomElement valElem = domDoc.createElement( "valgrind" ); + TQDomElement valElem = domDoc.createElement( "valgrind" ); valElem.setAttribute( "path", _lastValExec ); valElem.setAttribute( "params", _lastValParams ); - QDomElement ctElem = domDoc.createElement( "calltree" ); + TQDomElement ctElem = domDoc.createElement( "calltree" ); ctElem.setAttribute( "path", _lastCtExec ); ctElem.setAttribute( "params", _lastCtParams ); - QDomElement kcElem = domDoc.createElement( "kcachegrind" ); + TQDomElement kcElem = domDoc.createElement( "kcachegrind" ); kcElem.setAttribute( "path", _lastKcExec ); el->appendChild( execElem ); |