From 48d4a26399959121f33d2bc3bfe51c7827b654fc Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 14 Jun 2011 16:45:05 +0000 Subject: TQt4 port kdevelop This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1236710 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- parts/replace/replace_part.cpp | 20 +++++++-------- parts/replace/replace_part.h | 3 ++- parts/replace/replace_widget.cpp | 38 ++++++++++++++-------------- parts/replace/replace_widget.h | 9 ++++--- parts/replace/replacedlg.ui | 54 ++++++++++++++++++++-------------------- parts/replace/replacedlgimpl.cpp | 6 ++--- parts/replace/replacedlgimpl.h | 3 ++- parts/replace/replaceitem.cpp | 24 +++++++++--------- parts/replace/replaceitem.h | 14 +++++------ parts/replace/replaceview.cpp | 12 ++++----- parts/replace/replaceview.h | 1 + 11 files changed, 94 insertions(+), 90 deletions(-) (limited to 'parts/replace') diff --git a/parts/replace/replace_part.cpp b/parts/replace/replace_part.cpp index 7a64cac8..ebeeb311 100644 --- a/parts/replace/replace_part.cpp +++ b/parts/replace/replace_part.cpp @@ -24,24 +24,24 @@ #include "replace_widget.h" -static const KDevPluginInfo data("kdevreplace"); +static const KDevPluginInfo data("kdevtqreplace"); typedef KDevGenericFactory ReplaceFactory; -K_EXPORT_COMPONENT_FACTORY(libkdevreplace, ReplaceFactory(data)) +K_EXPORT_COMPONENT_FACTORY(libkdevtqreplace, ReplaceFactory(data)) -ReplacePart::ReplacePart(TQObject *parent, const char *name, const TQStringList& ) - : KDevPlugin( &data, parent, name ? name : "ReplacePart" ) +ReplacePart::ReplacePart(TQObject *tqparent, const char *name, const TQStringList& ) + : KDevPlugin( &data, tqparent, name ? name : "ReplacePart" ) { setInstance(ReplaceFactory::instance()); - setXMLFile("kdevpart_replace.rc"); + setXMLFile("kdevpart_tqreplace.rc"); m_widget = new ReplaceWidget(this); - m_widget->setIcon( SmallIcon("filefind") ); + m_widget->setIcon( SmallIcon("filetqfind") ); m_widget->setCaption(i18n("Replace")); TQWhatsThis::add (m_widget, i18n("Replace

" - "This window shows a preview of a string replace " + "This window shows a preview of a string tqreplace " "operation. Uncheck a line to exclude that replacement. " "Uncheck a file to exclude the whole file from the " "operation. " @@ -60,7 +60,7 @@ ReplacePart::ReplacePart(TQObject *parent, const char *name, const TQStringList& "can enter a string or a regular expression which is then " "searched for within all files in the locations " "you specify. Matches will be displayed in the Replace window, you " - "can replace them with the specified string, exclude them from replace operation or cancel the whole replace.") ); + "can replace them with the specified string, exclude them from replace operation or cancel the whole tqreplace.") ); connect( core(), TQT_SIGNAL(contextMenu(TQPopupMenu *, const Context *)), this, TQT_SLOT(contextMenu(TQPopupMenu *, const Context *)) ); connect( core(), TQT_SIGNAL(projectOpened()), this, TQT_SLOT(enableAction())); @@ -99,9 +99,9 @@ void ReplacePart::contextMenu(TQPopupMenu *popup, const Context *context) if (!ident.isEmpty()) { m_popupstr = ident; TQString squeezed = KStringHandler::csqueeze(ident, 30); - int id = popup->insertItem( i18n("Replace Project Wide: %1").arg(squeezed), + int id = popup->insertItem( i18n("Replace Project Wide: %1").tqarg(squeezed), this, TQT_SLOT(slotReplace()) ); - popup->setWhatsThis(id, i18n("Replace Project Wide

Opens the find in files dialog " + popup->tqsetWhatsThis(id, i18n("Replace Project Wide

Opens the find in files dialog " "and sets the pattern to the text under the cursor.")); popup->insertSeparator(); } diff --git a/parts/replace/replace_part.h b/parts/replace/replace_part.h index 8fb6f5e3..efad03bd 100644 --- a/parts/replace/replace_part.h +++ b/parts/replace/replace_part.h @@ -25,9 +25,10 @@ class Context; class ReplacePart : public KDevPlugin { Q_OBJECT + TQ_OBJECT public: - ReplacePart(TQObject *parent, const char *name, const TQStringList &); + ReplacePart(TQObject *tqparent, const char *name, const TQStringList &); ~ReplacePart(); public slots: diff --git a/parts/replace/replace_widget.cpp b/parts/replace/replace_widget.cpp index c20c3bbc..957f845a 100644 --- a/parts/replace/replace_widget.cpp +++ b/parts/replace/replace_widget.cpp @@ -65,25 +65,25 @@ ReplaceWidget::ReplaceWidget(ReplacePart *part) _terminateOperation( false ) { // setup outputview - TQVBoxLayout * layout = new TQVBoxLayout( this ); - TQHBoxLayout * buttonlayout = new TQHBoxLayout( layout ); + TQVBoxLayout * tqlayout = new TQVBoxLayout( this ); + TQHBoxLayout * buttontqlayout = new TQHBoxLayout( tqlayout ); _cancel = new KPushButton( KStdGuiItem::cancel(), this ); - _replace = new KPushButton( KGuiItem(i18n("Replace"),"filefind"), this ); + _tqreplace = new KPushButton( KGuiItem(i18n("Replace"),"filetqfind"), this ); _cancel->setEnabled( false ); - _replace->setEnabled( false ); + _tqreplace->setEnabled( false ); - buttonlayout->addWidget( _replace ); - buttonlayout->addWidget( _cancel ); + buttontqlayout->addWidget( _tqreplace ); + buttontqlayout->addWidget( _cancel ); _listview = new ReplaceView( this ); - layout->addWidget( _listview ); + tqlayout->addWidget( _listview ); // setup signals - connect( m_dialog->find_button, TQT_SIGNAL( clicked() ), TQT_SLOT( find() ) ); + connect( m_dialog->find_button, TQT_SIGNAL( clicked() ), TQT_SLOT( tqfind() ) ); - connect( _replace, TQT_SIGNAL( clicked() ), TQT_SLOT( replace() ) ); + connect( _tqreplace, TQT_SIGNAL( clicked() ), TQT_SLOT( tqreplace() ) ); connect( _cancel, TQT_SIGNAL( clicked() ), TQT_SLOT( clear() ) ); connect( _listview, TQT_SIGNAL( editDocument( const TQString &, int ) ), TQT_SLOT( editDocument( const TQString &, int ) ) ); @@ -142,7 +142,7 @@ void ReplaceWidget::showDialog() } -void ReplaceWidget::find() +void ReplaceWidget::tqfind() { _listview->clear(); m_part->mainWindow()->raiseView( this ); @@ -153,7 +153,7 @@ void ReplaceWidget::find() if ( showReplacements() ) { _cancel->setEnabled( true ); - _replace->setEnabled( true ); + _tqreplace->setEnabled( true ); } else { @@ -162,7 +162,7 @@ void ReplaceWidget::find() } } -void ReplaceWidget::replace() +void ReplaceWidget::tqreplace() { makeReplacements(); clear(); @@ -174,7 +174,7 @@ void ReplaceWidget::clear() _listview->clear(); _cancel->setEnabled( false ); - _replace->setEnabled( false ); + _tqreplace->setEnabled( false ); m_part->mainWindow()->setViewAvailable( this, false ); } @@ -215,7 +215,7 @@ bool ReplaceWidget::showReplacements() break; } - if ( openfiles.contains( *it ) ) + if ( openfiles.tqcontains( *it ) ) { if ( KTextEditor::EditInterface * ei = getEditInterfaceForFile( *it ) ) { @@ -235,7 +235,7 @@ bool ReplaceWidget::showReplacements() } ++it; - kapp->processEvents( 100 ); + kapp->tqprocessEvents( 100 ); } m_part->core()->running( m_part, false ); @@ -290,7 +290,7 @@ bool ReplaceWidget::makeReplacements() { TQString currentfile = fileitem->file(); - if ( openfiles.contains( currentfile ) ) + if ( openfiles.tqcontains( currentfile ) ) { if ( KTextEditor::EditInterface * ei = getEditInterfaceForFile( currentfile ) ) { @@ -330,7 +330,7 @@ bool ReplaceWidget::makeReplacements() } fileitem = fileitem->nextSibling(); - kapp->processEvents( 100 ); + kapp->tqprocessEvents( 100 ); } // Telling the project about the edited files @@ -343,7 +343,7 @@ bool ReplaceWidget::makeReplacements() m_part->core()->running( m_part, false ); - if ( calledUrl != TQString::null ) + if ( calledUrl != TQString() ) { m_part->partController()->editDocument( calledUrl, calledLine ); setCursorPos( m_part->partController()->activePart(), calledCol, calledLine ); @@ -437,7 +437,7 @@ TQStringList ReplaceWidget::openProjectFiles() if ( KTextEditor::Editor * ed = dynamic_cast( part ) ) { TQString editorpath = ed->url().path(); - if ( projectfiles.contains( editorpath ) ) + if ( projectfiles.tqcontains( editorpath ) ) { openfiles.append( editorpath ); } diff --git a/parts/replace/replace_widget.h b/parts/replace/replace_widget.h index 771643db..ea1e3dc6 100644 --- a/parts/replace/replace_widget.h +++ b/parts/replace/replace_widget.h @@ -26,9 +26,10 @@ class ReplaceDlgImpl; class ReplaceItem; class ReplaceView; -class ReplaceWidget : public QWidget +class ReplaceWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: ReplaceWidget(ReplacePart *part); @@ -41,8 +42,8 @@ protected: virtual void focusInEvent(TQFocusEvent *e); private slots: - void find(); - void replace(); + void tqfind(); + void tqreplace(); void clear(); void editDocument( const TQString & ,int ); void setCursorPos( KParts::Part *part, uint line, uint col ); @@ -68,7 +69,7 @@ private: ReplaceView * _listview; TQPushButton * _cancel; - TQPushButton * _replace; + TQPushButton * _tqreplace; uint calledCol; uint calledLine; diff --git a/parts/replace/replacedlg.ui b/parts/replace/replacedlg.ui index b1c7db92..81d9fd68 100644 --- a/parts/replace/replacedlg.ui +++ b/parts/replace/replacedlg.ui @@ -1,6 +1,6 @@ ReplaceDlg - + ReplaceDlg @@ -20,7 +20,7 @@ 0 - + 32767 32767 @@ -33,7 +33,7 @@ unnamed - + groupBox2 @@ -44,7 +44,7 @@ unnamed - + case_box @@ -55,7 +55,7 @@ true - + buttonGroup2 @@ -72,7 +72,7 @@ 0 - + strings_all_radio @@ -83,7 +83,7 @@ true - + strings_wholewords_radio @@ -91,15 +91,15 @@ Whole words onl&y - + - layout3 + tqlayout3 unnamed - + strings_regexp_radio @@ -110,7 +110,7 @@ Use regexp to specify target - + regexp_button @@ -141,7 +141,7 @@ - + buttonGroup1 @@ -152,7 +152,7 @@ unnamed - + files_all_radio @@ -166,7 +166,7 @@ All files in the project will be considered. - + files_open_radio @@ -177,7 +177,7 @@ Only open project files will be considered. - + files_path_radio @@ -198,15 +198,15 @@ - + - layout4 + tqlayout4 unnamed - + expression_varning_label @@ -229,14 +229,14 @@ Expanding - + 40 20 - + find_button @@ -250,7 +250,7 @@ Start looking for possible replacement targets. - + cancel_button @@ -260,7 +260,7 @@ - + groupBox1 @@ -271,12 +271,12 @@ unnamed - + textLabel1 - &Text to find: + &Text to tqfind: find_combo @@ -290,7 +290,7 @@ Target string - + textLabel2 @@ -369,8 +369,8 @@ kdialog.h - - + + kcombobox.h klineedit.h diff --git a/parts/replace/replacedlgimpl.cpp b/parts/replace/replacedlgimpl.cpp index b0c5bffd..0973e54f 100644 --- a/parts/replace/replacedlgimpl.cpp +++ b/parts/replace/replacedlgimpl.cpp @@ -27,7 +27,7 @@ TQString escape(const TQString &str) for (uint i=0; i < str.length(); ++i) { - if (escaped.find(str[i]) != -1) + if (escaped.tqfind(str[i]) != -1) res += "\\"; res += str[i]; } @@ -37,8 +37,8 @@ TQString escape(const TQString &str) } -ReplaceDlgImpl::ReplaceDlgImpl(TQWidget* parent, const char* name, bool modal, WFlags fl) - : ReplaceDlg(parent,name, modal,fl), _regexp_dialog( 0 ) +ReplaceDlgImpl::ReplaceDlgImpl(TQWidget* tqparent, const char* name, bool modal, WFlags fl) + : ReplaceDlg(tqparent,name, modal,fl), _regexp_dialog( 0 ) { connect( find_button, TQT_SIGNAL( clicked() ), TQT_SLOT( saveComboHistories() ) ); diff --git a/parts/replace/replacedlgimpl.h b/parts/replace/replacedlgimpl.h index 5ff94c75..73d49cb5 100644 --- a/parts/replace/replacedlgimpl.h +++ b/parts/replace/replacedlgimpl.h @@ -9,9 +9,10 @@ class TQDialog; class ReplaceDlgImpl : public ReplaceDlg { Q_OBJECT + TQ_OBJECT public: - ReplaceDlgImpl(TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ReplaceDlgImpl(TQWidget* tqparent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~ReplaceDlgImpl(); TQRegExp expressionPattern(); diff --git a/parts/replace/replaceitem.cpp b/parts/replace/replaceitem.cpp index d810e2ad..087e2b1f 100644 --- a/parts/replace/replaceitem.cpp +++ b/parts/replace/replaceitem.cpp @@ -45,18 +45,18 @@ void ReplaceItem::setChecked( bool checked ) { if ( !isFile() ) // this is a child item { - if ( checked || !(parent()->hasCheckedChildren())) + if ( checked || !(tqparent()->hasCheckedChildren())) { - if ( parent()->isOn() != checked ) + if ( tqparent()->isOn() != checked ) { - parent()->_clicked = false; - parent()->setOn( checked ); + tqparent()->_clicked = false; + tqparent()->setOn( checked ); } } return; } - // this is a parent item, set self and children + // this is a tqparent item, set self and tqchildren ReplaceItem * item = firstChild(); while ( item ) { @@ -84,13 +84,13 @@ void ReplaceItem::paintCell( TQPainter * p, const TQColorGroup & cg, int column, const BackgroundMode bgmode = lv->viewport()->backgroundMode(); const TQColorGroup::ColorRole crole = TQPalette::backgroundRoleFromMode( bgmode ); - if ( cg.brush( crole ) != lv->colorGroup().brush( crole ) ) + if ( cg.brush( crole ) != lv->tqcolorGroup().brush( crole ) ) p->fillRect( 0, 0, width, height(), cg.brush( crole ) ); else lv->paintEmptyArea( p, TQRect( 0, 0, width, height() ) ); TQFontMetrics fm( lv->fontMetrics() ); - int boxsize = lv->style().pixelMetric(TQStyle::PM_CheckListButtonSize, lv); + int boxsize = lv->tqstyle().tqpixelMetric(TQStyle::PM_CheckListButtonSize, lv); int marg = lv->itemMargin(); int r = marg; @@ -116,7 +116,7 @@ void ReplaceItem::paintCell( TQPainter * p, const TQColorGroup & cg, int column, else y = (fm.height() + 2 + marg - boxsize) / 2; - lv->style().drawPrimitive(TQStyle::PE_CheckListIndicator, p, + lv->tqstyle().tqdrawPrimitive(TQStyle::PE_CheckListIndicator, p, TQRect(x, y, boxsize, fm.height() + 2 + marg), cg, styleflags, TQStyleOption(this)); @@ -128,8 +128,8 @@ void ReplaceItem::paintCell( TQPainter * p, const TQColorGroup & cg, int column, p->setPen( TQPen( cg.text() ) ); TQColorGroup mcg = cg; - mcg.setColor( TQColorGroup::Text, ( isFile() ? Qt::darkGreen : Qt::blue ) ); - mcg.setColor( TQColorGroup::HighlightedText, ( isFile() ? Qt::darkGreen : Qt::blue ) ); + mcg.setColor( TQColorGroup::Text, ( isFile() ? TQt::darkGreen : TQt::blue ) ); + mcg.setColor( TQColorGroup::HighlightedText, ( isFile() ? TQt::darkGreen : TQt::blue ) ); TQListViewItem::paintCell( p, mcg, column, width - r, align ); } @@ -138,8 +138,8 @@ void ReplaceItem::activate( int, TQPoint const & localPos ) { TQListView * lv = listView(); TQCheckBox cb(0); - int boxsize = cb.sizeHint().width(); -//that's KDE-3.1 only int boxsize = lv->style().pixelMetric(TQStyle::PM_CheckListButtonSize, lv); + int boxsize = cb.tqsizeHint().width(); +//that's KDE-3.1 only int boxsize = lv->style().tqpixelMetric(TQStyle::PM_CheckListButtonSize, lv); int rightside = lv->itemMargin() + boxsize + ( isFile() ? 0 : lv->treeStepSize() ); // _lineclicked indicates if the click was on the line or in the checkbox diff --git a/parts/replace/replaceitem.h b/parts/replace/replaceitem.h index 4cea682c..8d4f3fd3 100644 --- a/parts/replace/replaceitem.h +++ b/parts/replace/replaceitem.h @@ -18,12 +18,12 @@ #include "replaceview.h" -class ReplaceItem : public QCheckListItem +class ReplaceItem : public TQCheckListItem { public: // the file item - ReplaceItem( ReplaceView * parent, ReplaceItem * after, TQString file ) : - TQCheckListItem( parent, + ReplaceItem( ReplaceView * tqparent, ReplaceItem * after, TQString file ) : + TQCheckListItem( tqparent, after, file, TQCheckListItem::CheckBox ), _file( file ), _string( file ), _line( 0 ), _isfile( true ), @@ -34,8 +34,8 @@ public: } // the line item - ReplaceItem( ReplaceItem * parent, ReplaceItem * after, TQString file, TQString string, int line ) : - TQCheckListItem( parent, + ReplaceItem( ReplaceItem * tqparent, ReplaceItem * after, TQString file, TQString string, int line ) : + TQCheckListItem( tqparent, after, TQString::number( line + 1 ) + ": " + string, TQCheckListItem::CheckBox ), _file( file ), _string( string ), _line( line ), _isfile( false ), @@ -76,9 +76,9 @@ public: return _lineclicked; } - ReplaceItem * parent() const + ReplaceItem * tqparent() const { - return static_cast( TQListViewItem::parent() ); + return static_cast( TQListViewItem::tqparent() ); } ReplaceItem * firstChild() const diff --git a/parts/replace/replaceview.cpp b/parts/replace/replaceview.cpp index 6730971a..5f5eee77 100644 --- a/parts/replace/replaceview.cpp +++ b/parts/replace/replaceview.cpp @@ -27,7 +27,7 @@ ReplaceItem * ReplaceView::firstChild() const } -ReplaceView::ReplaceView( TQWidget * parent ) : KListView( parent ), _latestfile( 0 ) +ReplaceView::ReplaceView( TQWidget * tqparent ) : KListView( tqparent ), _latestfile( 0 ) { setSorting( -1 ); addColumn( "" ); @@ -36,7 +36,7 @@ ReplaceView::ReplaceView( TQWidget * parent ) : KListView( parent ), _latestfile TQPalette pal = palette(); TQColorGroup cg = pal.active(); - cg.setColor( TQColorGroup::Highlight, Qt::lightGray ); + cg.setColor( TQColorGroup::Highlight, TQt::lightGray ); pal.setActive( cg ); setPalette( pal ); @@ -60,7 +60,7 @@ void ReplaceView::makeReplacementsForFile( TQTextStream & istream, TQTextStream line++; } // this is the hit - ostream << istream.readLine().replace( _regexp, _replacement ) << "\n"; + ostream << istream.readLine().tqreplace( _regexp, _replacement ) << "\n"; line++; } @@ -84,9 +84,9 @@ void ReplaceView::showReplacementsForFile( TQTextStream & stream, TQString const { TQString s = stream.readLine(); - if ( s.contains( _regexp ) > 0 ) + if ( s.tqcontains( _regexp ) > 0 ) { - s.replace( _regexp, _replacement ); + s.tqreplace( _regexp, _replacement ); if ( firstline ) { @@ -119,7 +119,7 @@ void ReplaceView::slotMousePressed(int btn, TQListViewItem* i, const TQPoint& po else if ( btn == Qt::LeftButton ) { // map pos to item/column and call ReplacetItem::activate(pos) - item->activate( col, viewport()->mapFromGlobal( pos ) - TQPoint( 0, itemRect(item).top() ) ); + item->activate( col, viewport()->mapFromGlobal( pos ) - TQPoint( 0, tqitemRect(item).top() ) ); } } } diff --git a/parts/replace/replaceview.h b/parts/replace/replaceview.h index 7031d80d..ceb480f3 100644 --- a/parts/replace/replaceview.h +++ b/parts/replace/replaceview.h @@ -24,6 +24,7 @@ class ReplaceItem; class ReplaceView : public KListView { Q_OBJECT + TQ_OBJECT signals: void editDocument( const TQString &, int ); -- cgit v1.2.3