From d6f8bbb45b267065a6907e71ff9c98bb6d161241 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:56:07 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- parts/grepview/grepviewwidget.cpp | 146 +++++++++++++++++++------------------- 1 file changed, 73 insertions(+), 73 deletions(-) (limited to 'parts/grepview/grepviewwidget.cpp') diff --git a/parts/grepview/grepviewwidget.cpp b/parts/grepview/grepviewwidget.cpp index 326e2897..78aa4224 100644 --- a/parts/grepview/grepviewwidget.cpp +++ b/parts/grepview/grepviewwidget.cpp @@ -9,11 +9,11 @@ * * ***************************************************************************/ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include @@ -40,26 +40,26 @@ using namespace KTextEditor; class GrepListBoxItem : public ProcessListBoxItem { public: - GrepListBoxItem(const QString &fileName, const QString &lineNumber, const QString &text, bool showFilename); - QString filename() + GrepListBoxItem(const TQString &fileName, const TQString &lineNumber, const TQString &text, bool showFilename); + TQString filename() { return fileName; } int linenumber() { return lineNumber.toInt(); } virtual bool isCustomItem(); private: - virtual void paint(QPainter *p); - QString fileName, lineNumber, text; + virtual void paint(TQPainter *p); + TQString fileName, lineNumber, text; bool show; }; -GrepListBoxItem::GrepListBoxItem(const QString &fileName, const QString &lineNumber, const QString &text, bool showFilename) - : ProcessListBoxItem( QString::null, Normal), +GrepListBoxItem::GrepListBoxItem(const TQString &fileName, const TQString &lineNumber, const TQString &text, bool showFilename) + : ProcessListBoxItem( TQString::null, Normal), fileName(fileName), lineNumber(lineNumber), text(text.stripWhiteSpace()), show(showFilename) { - this->text.replace( QChar('\t'), QString(" ") ); + this->text.replace( TQChar('\t'), TQString(" ") ); } @@ -69,11 +69,11 @@ bool GrepListBoxItem::isCustomItem() } -void GrepListBoxItem::paint(QPainter *p) +void GrepListBoxItem::paint(TQPainter *p) { - QColor base, dim, result, bkground; + TQColor base, dim, result, bkground; if (listBox()) { - const QColorGroup& group = listBox()->palette().active(); + const TQColorGroup& group = listBox()->palette().active(); if (isSelected()) { bkground = group.button(); base = group.buttonText(); @@ -96,11 +96,11 @@ void GrepListBoxItem::paint(QPainter *p) else bkground = Qt::white; } - QFontMetrics fm = p->fontMetrics(); - QString stx = lineNumber + ": "; + TQFontMetrics fm = p->fontMetrics(); + TQString stx = lineNumber + ": "; int y = fm.ascent()+fm.leading()/2; int x = 3; - p->fillRect(p->window(), QBrush(bkground)); + p->fillRect(p->window(), TQBrush(bkground)); if (show) { p->setPen(dim); @@ -110,8 +110,8 @@ void GrepListBoxItem::paint(QPainter *p) else { p->setPen(base); - QFont font1(p->font()); - QFont font2(font1); + TQFont font1(p->font()); + TQFont font2(font1); font2.setBold(true); p->setFont(font2); p->drawText(x, y, stx); @@ -124,9 +124,9 @@ void GrepListBoxItem::paint(QPainter *p) } -GrepViewWidget::GrepViewWidget(GrepViewPart *part) : QWidget(0, "grepview widget") +GrepViewWidget::GrepViewWidget(GrepViewPart *part) : TQWidget(0, "grepview widget") { - m_layout = new QHBoxLayout(this, 0, -1, "greplayout"); + m_layout = new TQHBoxLayout(this, 0, -1, "greplayout"); m_tabWidget = new KTabWidget(this); @@ -137,25 +137,25 @@ GrepViewWidget::GrepViewWidget(GrepViewPart *part) : QWidget(0, "grepview widge m_tabWidget->addTab(m_curOutput, i18n("Search Results")); grepdlg = new GrepDialog( part, this, "grep widget"); - connect( grepdlg, SIGNAL(searchClicked()), this, SLOT(searchActivated()) ); - connect( m_curOutput, SIGNAL(processExited(KProcess* )), this, SLOT(slotSearchProcessExited()) ); + connect( grepdlg, TQT_SIGNAL(searchClicked()), this, TQT_SLOT(searchActivated()) ); + connect( m_curOutput, TQT_SIGNAL(processExited(KProcess* )), this, TQT_SLOT(slotSearchProcessExited()) ); - connect( m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(slotOutputTabChanged()) ); + connect( m_tabWidget, TQT_SIGNAL(currentChanged(TQWidget*)), this, TQT_SLOT(slotOutputTabChanged()) ); - connect( m_curOutput, SIGNAL(clicked(QListBoxItem*)), - this, SLOT(slotExecuted(QListBoxItem*)) ); - connect( m_curOutput, SIGNAL(returnPressed(QListBoxItem*)), - this, SLOT(slotExecuted(QListBoxItem*)) ); + connect( m_curOutput, TQT_SIGNAL(clicked(TQListBoxItem*)), + this, TQT_SLOT(slotExecuted(TQListBoxItem*)) ); + connect( m_curOutput, TQT_SIGNAL(returnPressed(TQListBoxItem*)), + this, TQT_SLOT(slotExecuted(TQListBoxItem*)) ); - connect( m_curOutput, SIGNAL(contextMenuRequested( QListBoxItem*, const QPoint&)), this, SLOT(popupMenu(QListBoxItem*, const QPoint&))); + connect( m_curOutput, TQT_SIGNAL(contextMenuRequested( TQListBoxItem*, const TQPoint&)), this, TQT_SLOT(popupMenu(TQListBoxItem*, const TQPoint&))); m_part = part; - m_closeButton = new QToolButton(m_tabWidget);//@todo change text/icon + m_closeButton = new TQToolButton(m_tabWidget);//@todo change text/icon m_closeButton->setIconSet(SmallIconSet("tab_remove")); m_closeButton->setEnabled(false); - connect (m_closeButton, SIGNAL(clicked()), this, SLOT(slotCloseCurrentOutput())); + connect (m_closeButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotCloseCurrentOutput())); m_tabWidget->setCornerWidget(m_closeButton); } @@ -173,7 +173,7 @@ void GrepViewWidget::showDialog() SelectionInterface *selectIface = dynamic_cast(ro_part); if(selectIface && selectIface->hasSelection()) { - QString selText = selectIface->selection(); + TQString selText = selectIface->selection(); if(!selText.contains('\n')) { grepdlg->setPattern(selText); @@ -194,10 +194,10 @@ void GrepViewWidget::showDialog() } // @todo - put this somewhere common - or just use Qt if possible -static QString escape(const QString &str) +static TQString escape(const TQString &str) { - QString escaped("[]{}()\\^$?.+-*|"); - QString res; + TQString escaped("[]{}()\\^$?.+-*|"); + TQString res; for (uint i=0; i < str.length(); ++i) { @@ -210,7 +210,7 @@ static QString escape(const QString &str) } -void GrepViewWidget::showDialogWithPattern(QString pattern) +void GrepViewWidget::showDialogWithPattern(TQString pattern) { // Before anything, this removes line feeds from the // beginning and the end. @@ -248,47 +248,47 @@ void GrepViewWidget::searchActivated() m_curOutput->setLastFileName(""); m_curOutput->setMatchCount( 0 ); - QString command, files; + TQString command, files; // waba: code below breaks on filenames containing a ',' !!! - QStringList filelist = QStringList::split(",", grepdlg->filesString()); + TQStringList filelist = TQStringList::split(",", grepdlg->filesString()); if (grepdlg->useProjectFilesFlag()) { KDevProject *openProject = m_part->project(); if (openProject) { - QString tmpFilePath; - QStringList projectFiles = openProject->allFiles(); + TQString tmpFilePath; + TQStringList projectFiles = openProject->allFiles(); if (!projectFiles.isEmpty()) { - tmpFilePath = openProject->projectDirectory() + QChar(QDir::separator()) + ".grep.tmp"; - QString dir = grepdlg->directoryString(), file; - QValueList regExpList; + tmpFilePath = openProject->projectDirectory() + TQChar(TQDir::separator()) + ".grep.tmp"; + TQString dir = grepdlg->directoryString(), file; + TQValueList regExpList; - if (dir.endsWith(QChar(QDir::separator()))) + if (dir.endsWith(TQChar(TQDir::separator()))) dir.truncate(dir.length() - 1); if (!filelist.isEmpty()) { - for (QStringList::Iterator it = filelist.begin(); it != filelist.end(); ++it) - regExpList.append(QRegExp(*it, true, true)); + for (TQStringList::Iterator it = filelist.begin(); it != filelist.end(); ++it) + regExpList.append(TQRegExp(*it, true, true)); } m_tempFile.setName(tmpFilePath); if (m_tempFile.open(IO_WriteOnly)) { - QTextStream out(&m_tempFile); - for (QStringList::Iterator it = projectFiles.begin(); it != projectFiles.end(); ++it) + TQTextStream out(&m_tempFile); + for (TQStringList::Iterator it = projectFiles.begin(); it != projectFiles.end(); ++it) { - file = QDir::cleanDirPath(openProject->projectDirectory() + QChar(QDir::separator()) + *it); + file = TQDir::cleanDirPath(openProject->projectDirectory() + TQChar(TQDir::separator()) + *it); - QFileInfo info(file); + TQFileInfo info(file); if (grepdlg->recursiveFlag() && !info.dirPath(true).startsWith(dir)) continue; if (!grepdlg->recursiveFlag() && info.dirPath(true) != dir) continue; bool matchOne = regExpList.count() == 0; - for (QValueList::Iterator it2 = regExpList.begin(); it2 != regExpList.end() && !matchOne; ++it2) + for (TQValueList::Iterator it2 = regExpList.begin(); it2 != regExpList.end() && !matchOne; ++it2) matchOne = (*it2).exactMatch(file); if (matchOne) @@ -312,14 +312,14 @@ void GrepViewWidget::searchActivated() { if (!filelist.isEmpty()) { - QStringList::Iterator it(filelist.begin()); + TQStringList::Iterator it(filelist.begin()); files = KShellProcess::quote(*it); ++it; for (; it != filelist.end(); ++it) files += " -o -name " + KShellProcess::quote(*it); } - QString filepattern = "find "; + TQString filepattern = "find "; filepattern += KShellProcess::quote(grepdlg->directoryString()); if (!grepdlg->recursiveFlag()) filepattern += " -maxdepth 1"; @@ -332,10 +332,10 @@ void GrepViewWidget::searchActivated() command = filepattern + " " ; } - QStringList excludelist = QStringList::split(",", grepdlg->excludeString()); + TQStringList excludelist = TQStringList::split(",", grepdlg->excludeString()); if (!excludelist.isEmpty()) { - QStringList::Iterator it(excludelist.begin()); + TQStringList::Iterator it(excludelist.begin()); command += "| grep -v "; for (; it != excludelist.end(); ++it) command += "-e " + KShellProcess::quote(*it) + " "; @@ -364,11 +364,11 @@ void GrepViewWidget::searchActivated() command += "-e "; m_lastPattern = grepdlg->patternString(); - QString pattern = grepdlg->templateString(); + TQString pattern = grepdlg->templateString(); if (grepdlg->regexpFlag()) - pattern.replace(QRegExp("%s"), grepdlg->patternString()); + pattern.replace(TQRegExp("%s"), grepdlg->patternString()); else - pattern.replace(QRegExp("%s"), escape( grepdlg->patternString() ) ); + pattern.replace(TQRegExp("%s"), escape( grepdlg->patternString() ) ); command += KShellProcess::quote(pattern); m_curOutput->startJob("", command); @@ -377,7 +377,7 @@ void GrepViewWidget::searchActivated() } -void GrepViewWidget::slotExecuted(QListBoxItem* item) +void GrepViewWidget::slotExecuted(TQListBoxItem* item) { ProcessListBoxItem *i = static_cast(item); if (!i || !i->isCustomItem()) @@ -388,19 +388,19 @@ void GrepViewWidget::slotExecuted(QListBoxItem* item) } -void GrepViewProcessWidget::insertStdoutLine(const QCString &line) +void GrepViewProcessWidget::insertStdoutLine(const TQCString &line) { int pos; - QString filename, linenumber, rest; + TQString filename, linenumber, rest; - QString str; + TQString str; if( !grepbuf.isEmpty() ) { - str = QString::fromLocal8Bit( grepbuf+line ); + str = TQString::fromLocal8Bit( grepbuf+line ); grepbuf.truncate( 0 ); }else { - str = QString::fromLocal8Bit( line ); + str = TQString::fromLocal8Bit( line ); } if ( (pos = str.find(':')) != -1) { @@ -432,11 +432,11 @@ void GrepViewProcessWidget::insertStdoutLine(const QCString &line) void GrepViewWidget::projectChanged(KDevProject *project) { - QString dir = project? project->projectDirectory() : QDir::homeDirPath(); + TQString dir = project? project->projectDirectory() : TQDir::homeDirPath(); grepdlg->setDirectory(dir); } -void GrepViewWidget::popupMenu(QListBoxItem*, const QPoint& p) +void GrepViewWidget::popupMenu(TQListBoxItem*, const TQPoint& p) { if(m_curOutput->isRunning()) return; @@ -452,17 +452,17 @@ void GrepViewWidget::popupMenu(QListBoxItem*, const QPoint& p) void GrepViewWidget::slotKeepOutput( ) { - if ( m_lastPattern == QString::null ) return; + if ( m_lastPattern == TQString::null ) return; m_tabWidget->changeTab(m_curOutput, m_lastPattern); m_curOutput = new GrepViewProcessWidget(m_tabWidget); m_tabWidget->insertTab(m_curOutput, i18n("Search Results"), 0); - connect( m_curOutput, SIGNAL(clicked(QListBoxItem*)), this, SLOT(slotExecuted(QListBoxItem*)) ); - connect( m_curOutput, SIGNAL(returnPressed(QListBoxItem*)), this, SLOT(slotExecuted(QListBoxItem*)) ); - connect( m_curOutput, SIGNAL(processExited(KProcess* )), this, SLOT(slotSearchProcessExited()) ); - connect( m_curOutput, SIGNAL(contextMenuRequested( QListBoxItem*, const QPoint&)), this, SLOT(popupMenu(QListBoxItem*, const QPoint&))); + connect( m_curOutput, TQT_SIGNAL(clicked(TQListBoxItem*)), this, TQT_SLOT(slotExecuted(TQListBoxItem*)) ); + connect( m_curOutput, TQT_SIGNAL(returnPressed(TQListBoxItem*)), this, TQT_SLOT(slotExecuted(TQListBoxItem*)) ); + connect( m_curOutput, TQT_SIGNAL(processExited(KProcess* )), this, TQT_SLOT(slotSearchProcessExited()) ); + connect( m_curOutput, TQT_SIGNAL(contextMenuRequested( TQListBoxItem*, const TQPoint&)), this, TQT_SLOT(popupMenu(TQListBoxItem*, const TQPoint&))); } void GrepViewWidget::slotCloseCurrentOutput( ) @@ -526,7 +526,7 @@ void GrepViewProcessWidget::childFinished( bool normal, int status ) ProcessWidget::childFinished(normal, status); } -void GrepViewProcessWidget::addPartialStdoutLine(const QCString & line) +void GrepViewProcessWidget::addPartialStdoutLine(const TQCString & line) { grepbuf += line; } -- cgit v1.2.1