diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /parts/outputviews/makewidget.cpp | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/outputviews/makewidget.cpp')
-rw-r--r-- | parts/outputviews/makewidget.cpp | 210 |
1 files changed, 105 insertions, 105 deletions
diff --git a/parts/outputviews/makewidget.cpp b/parts/outputviews/makewidget.cpp index 554713c4..3ccc4608 100644 --- a/parts/outputviews/makewidget.cpp +++ b/parts/outputviews/makewidget.cpp @@ -33,15 +33,15 @@ #include <kapplication.h> #include <kconfig.h> -#include <qmessagebox.h> -#include <qapplication.h> -#include <qdir.h> -#include <qimage.h> -#include <qstylesheet.h> -#include <qtimer.h> -#include <qfileinfo.h> -#include <qclipboard.h> -#include <qpopupmenu.h> +#include <tqmessagebox.h> +#include <tqapplication.h> +#include <tqdir.h> +#include <tqimage.h> +#include <tqstylesheet.h> +#include <tqtimer.h> +#include <tqfileinfo.h> +#include <tqclipboard.h> +#include <tqpopupmenu.h> #include <private/qrichtext_p.h> #include <stdlib.h> @@ -116,7 +116,7 @@ static const char *const message_xpm[] = class SelectionPreserver { public: - SelectionPreserver( QTextEdit& textEdit, bool stayAtEnd ) + SelectionPreserver( TQTextEdit& textEdit, bool stayAtEnd ) : m_textEdit( textEdit ) , m_atEnd( false ) { @@ -136,18 +136,18 @@ public: if ( m_atEnd ) { - m_textEdit.moveCursor(QTextEdit::MoveEnd, false); - m_textEdit.moveCursor(QTextEdit::MoveLineStart, false);//if linewrap is off we must avoid the jumping of the vertical scrollbar + m_textEdit.moveCursor(TQTextEdit::MoveEnd, false); + m_textEdit.moveCursor(TQTextEdit::MoveLineStart, false);//if linewrap is off we must avoid the jumping of the vertical scrollbar } } - QTextEdit& m_textEdit; + TQTextEdit& m_textEdit; bool m_atEnd; int paraFrom, indexFrom, paraTo, indexTo; }; MakeWidget::MakeWidget(MakeViewPart *part) - : QTextEdit(0, "make widget") + : TQTextEdit(0, "make widget") , m_directoryStatusFilter( m_errorFilter ) , m_errorFilter( m_continuationFilter ) , m_continuationFilter( m_actionFilter ) @@ -171,51 +171,51 @@ MakeWidget::MakeWidget(MakeViewPart *part) setWrapPolicy(Anywhere); setReadOnly(true); - setMimeSourceFactory(new QMimeSourceFactory); - mimeSourceFactory()->setImage("error", QImage((const char**)error_xpm)); - mimeSourceFactory()->setImage("warning", QImage((const char**)warning_xpm)); - mimeSourceFactory()->setImage("message", QImage((const char**)message_xpm)); + setMimeSourceFactory(new TQMimeSourceFactory); + mimeSourceFactory()->setImage("error", TQImage((const char**)error_xpm)); + mimeSourceFactory()->setImage("warning", TQImage((const char**)warning_xpm)); + mimeSourceFactory()->setImage("message", TQImage((const char**)message_xpm)); dirstack.setAutoDelete(true); childproc = new KProcess(this); procLineMaker = new ProcessLineMaker( childproc ); - connect( procLineMaker, SIGNAL(receivedStdoutLine(const QCString&)), - this, SLOT(insertStdoutLine(const QCString&) )); - connect( procLineMaker, SIGNAL(receivedStderrLine(const QCString&)), - this, SLOT(insertStderrLine(const QCString&) )); - connect( procLineMaker, SIGNAL(receivedPartialStdoutLine(const QCString&)), - this, SLOT(storePartialStdoutLine(const QCString&) )); - connect( procLineMaker, SIGNAL(receivedPartialStderrLine(const QCString&)), - this, SLOT(storePartialStderrLine(const QCString&) )); - - connect( childproc, SIGNAL(processExited(KProcess*)), - this, SLOT(slotProcessExited(KProcess*) )) ; - - connect( &m_directoryStatusFilter, SIGNAL(item(EnteringDirectoryItem*)), - this, SLOT(slotEnteredDirectory(EnteringDirectoryItem*)) ); - connect( &m_directoryStatusFilter, SIGNAL(item(ExitingDirectoryItem*)), - this, SLOT(slotExitedDirectory(ExitingDirectoryItem*)) ); - connect( &m_errorFilter, SIGNAL(item(MakeItem*)), - this, SLOT(insertItem(MakeItem*)) ); - connect( &m_actionFilter, SIGNAL(item(MakeItem*)), - this, SLOT(insertItem(MakeItem*)) ); - connect( &m_otherFilter, SIGNAL(item(MakeItem*)), - this, SLOT(insertItem(MakeItem*)) ); - - connect( verticalScrollBar(), SIGNAL(sliderPressed()), - this, SLOT(verticScrollingOn()) ); - connect( verticalScrollBar(), SIGNAL(sliderReleased()), - this, SLOT(verticScrollingOff()) ); - connect( horizontalScrollBar(), SIGNAL(sliderPressed()), - this, SLOT(horizScrollingOn()) ); - connect( horizontalScrollBar(), SIGNAL(sliderReleased()), - this, SLOT(horizScrollingOff()) ); + connect( procLineMaker, TQT_SIGNAL(receivedStdoutLine(const TQCString&)), + this, TQT_SLOT(insertStdoutLine(const TQCString&) )); + connect( procLineMaker, TQT_SIGNAL(receivedStderrLine(const TQCString&)), + this, TQT_SLOT(insertStderrLine(const TQCString&) )); + connect( procLineMaker, TQT_SIGNAL(receivedPartialStdoutLine(const TQCString&)), + this, TQT_SLOT(storePartialStdoutLine(const TQCString&) )); + connect( procLineMaker, TQT_SIGNAL(receivedPartialStderrLine(const TQCString&)), + this, TQT_SLOT(storePartialStderrLine(const TQCString&) )); + + connect( childproc, TQT_SIGNAL(processExited(KProcess*)), + this, TQT_SLOT(slotProcessExited(KProcess*) )) ; + + connect( &m_directoryStatusFilter, TQT_SIGNAL(item(EnteringDirectoryItem*)), + this, TQT_SLOT(slotEnteredDirectory(EnteringDirectoryItem*)) ); + connect( &m_directoryStatusFilter, TQT_SIGNAL(item(ExitingDirectoryItem*)), + this, TQT_SLOT(slotExitedDirectory(ExitingDirectoryItem*)) ); + connect( &m_errorFilter, TQT_SIGNAL(item(MakeItem*)), + this, TQT_SLOT(insertItem(MakeItem*)) ); + connect( &m_actionFilter, TQT_SIGNAL(item(MakeItem*)), + this, TQT_SLOT(insertItem(MakeItem*)) ); + connect( &m_otherFilter, TQT_SIGNAL(item(MakeItem*)), + this, TQT_SLOT(insertItem(MakeItem*)) ); + + connect( verticalScrollBar(), TQT_SIGNAL(sliderPressed()), + this, TQT_SLOT(verticScrollingOn()) ); + connect( verticalScrollBar(), TQT_SIGNAL(sliderReleased()), + this, TQT_SLOT(verticScrollingOff()) ); + connect( horizontalScrollBar(), TQT_SIGNAL(sliderPressed()), + this, TQT_SLOT(horizScrollingOn()) ); + connect( horizontalScrollBar(), TQT_SIGNAL(sliderReleased()), + this, TQT_SLOT(horizScrollingOff()) ); // this slot doesn't exist anymore -// connect( m_part->partController(), SIGNAL(loadedFile(const KURL&)), -// this, SLOT(slotDocumentOpened(const KURL&)) ); +// connect( m_part->partController(), TQT_SIGNAL(loadedFile(const KURL&)), +// this, TQT_SLOT(slotDocumentOpened(const KURL&)) ); } MakeWidget::~MakeWidget() @@ -225,7 +225,7 @@ MakeWidget::~MakeWidget() delete procLineMaker; } -void MakeWidget::queueJob(const QString &dir, const QString &command) +void MakeWidget::queueJob(const TQString &dir, const TQString &command) { commandList.append(command); dirList.append(dir); @@ -240,7 +240,7 @@ void MakeWidget::queueJob(const QString &dir, const QString &command) void MakeWidget::startNextJob() { - QStringList::Iterator it = commandList.begin(); + TQStringList::Iterator it = commandList.begin(); if ( it == commandList.end() ) return; @@ -254,7 +254,7 @@ void MakeWidget::startNextJob() m_bCompiling = false; else { - QString s = currentCommand.right(currentCommand.length() - i); + TQString s = currentCommand.right(currentCommand.length() - i); if ( s.contains("configure ") || s.contains(" Makefile.cvs") || s.contains(" clean") || @@ -270,12 +270,12 @@ void MakeWidget::startNextJob() } it = dirList.begin(); - QString dir = *it; + TQString dir = *it; m_lastBuildDir = dir; dirList.remove(it); clear(); // clear the widget - for ( QValueVector<MakeItem*>::iterator it = m_items.begin(); it != m_items.end(); ++it ) + for ( TQValueVector<MakeItem*>::iterator it = m_items.begin(); it != m_items.end(); ++it ) delete *it; m_items.clear(); m_paragraphToItem.clear(); @@ -290,7 +290,7 @@ void MakeWidget::startNextJob() childproc->start(KProcess::OwnGroup, KProcess::AllOutput); dirstack.clear(); - dirstack.push(new QString(dir)); + dirstack.push(new TQString(dir)); m_part->mainWindow()->raiseView(this); m_part->core()->running(m_part, true); @@ -317,7 +317,7 @@ void MakeWidget::copy() return; } - QString selection; + TQString selection; for(int i = parafrom; i<=parato; i++) selection += text(i) + "\n"; @@ -325,7 +325,7 @@ void MakeWidget::copy() if(m_compilerOutputLevel == eShort || m_compilerOutputLevel == eVeryShort ) { - QRegExp regexp("<.*>"); + TQRegExp regexp("<.*>"); regexp.setMinimal(true); selection.remove(regexp); } @@ -390,15 +390,15 @@ void MakeWidget::prevError() KNotifyClient::beep(); } -void MakeWidget::contentsMouseReleaseEvent( QMouseEvent* e ) +void MakeWidget::contentsMouseReleaseEvent( TQMouseEvent* e ) { - QTextEdit::contentsMouseReleaseEvent(e); + TQTextEdit::contentsMouseReleaseEvent(e); if ( e->button() != LeftButton ) return; searchItem(paragraphAt(e->pos())); } -void MakeWidget::keyPressEvent(QKeyEvent *e) +void MakeWidget::keyPressEvent(TQKeyEvent *e) { if (e->key() == Key_Return || e->key() == Key_Enter) { @@ -407,15 +407,15 @@ void MakeWidget::keyPressEvent(QKeyEvent *e) searchItem(parag); } else - QTextEdit::keyPressEvent(e); + TQTextEdit::keyPressEvent(e); } // returns the current directory for parag -QString MakeWidget::directory(int parag) const +TQString MakeWidget::directory(int parag) const { - QValueVector<MakeItem*>::const_iterator it = qFind( m_items.begin(), m_items.end(), m_paragraphToItem[parag] ); + TQValueVector<MakeItem*>::const_iterator it = qFind( m_items.begin(), m_items.end(), m_paragraphToItem[parag] ); if ( it == m_items.end() ) - return QString::null; + return TQString::null; // run backwards over directories and figure out where we are while ( it != m_items.begin() ) { --it; @@ -423,24 +423,24 @@ QString MakeWidget::directory(int parag) const if ( edi ) return edi->directory + "/"; } - return QString::null; + return TQString::null; } // hackish function that will return true and put string "file" in "fName" if the file // exists -static bool checkFileExists( const QString& file, QString& fName ) +static bool checkFileExists( const TQString& file, TQString& fName ) { - if ( QFile::exists( file ) ) { + if ( TQFile::exists( file ) ) { fName = file; return true; } return false; } -void MakeWidget::specialCheck( const QString& file, QString& fName ) const +void MakeWidget::specialCheck( const TQString& file, TQString& fName ) const { - QString firstLine = text(0); - QRegExp rx("cd \\'(.*)\\'.*"); + TQString firstLine = text(0); + TQRegExp rx("cd \\'(.*)\\'.*"); if (rx.search(firstLine) != -1) { KURL url(rx.cap(1)+"/", file); @@ -454,8 +454,8 @@ void MakeWidget::specialCheck( const QString& file, QString& fName ) const } // Ok the "worst case", lets see if we can find a file in the project that has the same name // obviously this will pick always the wrong file when you've got the same filename multiple times. - QStringList files = m_part->project()->allFiles(); - for( QStringList::iterator it = files.begin() ; it != files.end(); ++it) + TQStringList files = m_part->project()->allFiles(); + for( TQStringList::iterator it = files.begin() ; it != files.end(); ++it) { if( (*it).contains( file ) ) { @@ -464,13 +464,13 @@ void MakeWidget::specialCheck( const QString& file, QString& fName ) const } } -QString MakeWidget::guessFileName( const QString& fName, int parag ) const +TQString MakeWidget::guessFileName( const TQString& fName, int parag ) const { // pathological case if ( ! m_part->project() ) return fName; - QString name; - QString dir = directory( parag ); + TQString name; + TQString dir = directory( parag ); if ( fName.startsWith( "/" ) ) { @@ -497,12 +497,12 @@ QString MakeWidget::guessFileName( const QString& fName, int parag ) const // GNU make resolves symlinks. if "name" is a real path to a file the // project know by symlink path, we need to return the symlink path -// QStringList projectFiles = m_part->project()->allFiles(); - QStringList projectFiles = m_part->project()->symlinkProjectFiles(); - QStringList::iterator it = projectFiles.begin(); +// TQStringList projectFiles = m_part->project()->allFiles(); + TQStringList projectFiles = m_part->project()->symlinkProjectFiles(); + TQStringList::iterator it = projectFiles.begin(); while ( it != projectFiles.end() ) { - QString file = m_part->project()->projectDirectory() + "/" + *it; + TQString file = m_part->project()->projectDirectory() + "/" + *it; if ( name == URLUtil::canonicalPath( file ) ) { kdDebug(9004) << "Found file in project - " << file << " == " << name << endl; @@ -528,31 +528,31 @@ void MakeWidget::searchItem(int parag) } } -void MakeWidget::insertStdoutLine( const QCString& line ) +void MakeWidget::insertStdoutLine( const TQCString& line ) { - QString sline; + TQString sline; bool forceCLocale = KConfigGroup( kapp->config(), "MakeOutputWidget" ).readBoolEntry( "ForceCLocale", true ); if( forceCLocale ) - sline = QString::fromAscii( stdoutbuf+line ); + sline = TQString::fromAscii( stdoutbuf+line ); else - sline = QString::fromLocal8Bit( stdoutbuf+line ); + sline = TQString::fromLocal8Bit( stdoutbuf+line ); if ( !appendToLastLine( sline ) ) m_directoryStatusFilter.processLine( sline ); stdoutbuf.truncate(0); } -void MakeWidget::insertStderrLine( const QCString& line ) +void MakeWidget::insertStderrLine( const TQCString& line ) { - QString sline; + TQString sline; bool forceCLocale = KConfigGroup( kapp->config(), "MakeOutputWidget" ).readBoolEntry( "ForceCLocale", true ); if( forceCLocale ) { - sline = QString( stderrbuf+line ); + sline = TQString( stderrbuf+line ); } else - sline = QString::fromLocal8Bit( stderrbuf+line ); + sline = TQString::fromLocal8Bit( stderrbuf+line ); if ( !appendToLastLine( sline ) ) m_errorFilter.processLine( sline ); @@ -584,7 +584,7 @@ void MakeWidget::slotProcessExited(KProcess *) insertItem( item ); displayPendingItem(); - m_part->mainWindow()->statusBar()->message( QString("%1: %2").arg(currentCommand).arg(item->m_text), 3000); + m_part->mainWindow()->statusBar()->message( TQString("%1: %2").arg(currentCommand).arg(item->m_text), 3000); m_part->core()->running(m_part, false); // Defensive programming: We emit this with a single shot timer so that we go once again @@ -592,7 +592,7 @@ void MakeWidget::slotProcessExited(KProcess *) // and its KProcess object can be reused. if (childproc->normalExit() && !childproc->exitStatus()) { - QTimer::singleShot(0, this, SLOT(startNextJob())); + TQTimer::singleShot(0, this, TQT_SLOT(startNextJob())); // if (commandList.isEmpty()) // The last command on the list was successful so restore the // output view to what it had before the compilation process started @@ -608,16 +608,16 @@ void MakeWidget::slotProcessExited(KProcess *) void MakeWidget::slotEnteredDirectory( EnteringDirectoryItem* item ) { // kdDebug(9004) << "Entering dir: " << item->directory << endl; - QString* dir = new QString( item->directory ); + TQString* dir = new TQString( item->directory ); dirstack.push( dir ); insertItem( item ); } void MakeWidget::slotExitedDirectory( ExitingDirectoryItem* item ) { - QString eDir = item->directory; + TQString eDir = item->directory; // kdDebug(9004) << "Leaving dir: " << eDir << endl; - QString *dir = dirstack.pop(); + TQString *dir = dirstack.pop(); if (!dir) { kdWarning(9004) << "Left more directories than entered: " << eDir; @@ -652,7 +652,7 @@ void MakeWidget::displayPendingItem() append( m_pendingItem->formattedText( m_compilerOutputLevel, brightBg() ) ); } -bool MakeWidget::appendToLastLine( const QString& text ) +bool MakeWidget::appendToLastLine( const TQString& text ) { if ( !m_pendingItem ) return false; if ( !m_pendingItem->append( text ) ) @@ -696,29 +696,29 @@ bool MakeWidget::brightBg() return (v > 127); } -QPopupMenu* MakeWidget::createPopupMenu( const QPoint& pos ) +TQPopupMenu* MakeWidget::createPopupMenu( const TQPoint& pos ) { - QPopupMenu* pMenu = QTextEdit::createPopupMenu(pos); + TQPopupMenu* pMenu = TQTextEdit::createPopupMenu(pos); pMenu->setCheckable(true); pMenu->insertSeparator(); - int id = pMenu->insertItem(i18n("Line Wrapping"), this, SLOT(toggleLineWrapping()) ); + int id = pMenu->insertItem(i18n("Line Wrapping"), this, TQT_SLOT(toggleLineWrapping()) ); pMenu->setItemChecked(id, m_bLineWrapping); pMenu->setWhatsThis(id, i18n("<b>Line wrapping</b><p>Enables or disables wrapping of command lines displayed.")); pMenu->insertSeparator(); - id = pMenu->insertItem(i18n("Very Short Compiler Output"), this, SLOT(slotVeryShortCompilerOutput()) ); + id = pMenu->insertItem(i18n("Very Short Compiler Output"), this, TQT_SLOT(slotVeryShortCompilerOutput()) ); pMenu->setWhatsThis(id, i18n("<b>Very short compiler output</b><p>Displays only warnings, errors and the file names which are compiled.")); pMenu->setItemChecked(id, m_compilerOutputLevel == eVeryShort); - id = pMenu->insertItem(i18n("Short Compiler Output"), this, SLOT(slotShortCompilerOutput()) ); + id = pMenu->insertItem(i18n("Short Compiler Output"), this, TQT_SLOT(slotShortCompilerOutput()) ); pMenu->setWhatsThis(id, i18n("<b>Short compiler output</b><p>Suppresses all the compiler flags and formats to something readable.")); pMenu->setItemChecked(id, m_compilerOutputLevel == eShort); - id = pMenu->insertItem(i18n("Full Compiler Output"), this, SLOT(slotFullCompilerOutput()) ); + id = pMenu->insertItem(i18n("Full Compiler Output"), this, TQT_SLOT(slotFullCompilerOutput()) ); pMenu->setWhatsThis(id, i18n("<b>Full compiler output</b><p>Displays unmodified compiler output.")); pMenu->setItemChecked(id, m_compilerOutputLevel == eFull); pMenu->insertSeparator(); - id = pMenu->insertItem(i18n("Show Directory Navigation Messages"), this, SLOT(toggleShowDirNavigMessages())); + id = pMenu->insertItem(i18n("Show Directory Navigation Messages"), this, TQT_SLOT(toggleShowDirNavigMessages())); pMenu->setWhatsThis(id, i18n("<b>Show directory navigation messages</b><p>Shows <b>cd</b> commands that are executed while building.")); pMenu->setItemChecked(id, DirectoryItem::getShowDirectoryMessages()); @@ -784,7 +784,7 @@ void MakeWidget::updateSettingsFromConfig() { KConfig *pConfig = kapp->config(); pConfig->setGroup("General Options"); - QFont outputFont = pConfig->readFontEntry("OutputViewFont"); + TQFont outputFont = pConfig->readFontEntry("OutputViewFont"); setFont(outputFont); pConfig->setGroup("MakeOutputView"); m_bLineWrapping = pConfig->readBoolEntry("LineWrapping", true); @@ -834,12 +834,12 @@ bool MakeWidget::scanErrorBackward( int parag ) return false; } -void MakeWidget::storePartialStderrLine(const QCString & line) +void MakeWidget::storePartialStderrLine(const TQCString & line) { stderrbuf += line; } -void MakeWidget::storePartialStdoutLine(const QCString & line) +void MakeWidget::storePartialStdoutLine(const TQCString & line) { stdoutbuf += line; } |