diff options
Diffstat (limited to 'kregexpeditor/kregexpeditorprivate.cpp')
-rw-r--r-- | kregexpeditor/kregexpeditorprivate.cpp | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/kregexpeditor/kregexpeditorprivate.cpp b/kregexpeditor/kregexpeditorprivate.cpp index b13a655..e7796c8 100644 --- a/kregexpeditor/kregexpeditorprivate.cpp +++ b/kregexpeditor/kregexpeditorprivate.cpp @@ -26,35 +26,35 @@ #include "kregexpeditorprivate.moc" #endif -#include <qlineedit.h> -#include <qtooltip.h> -#include <qtoolbutton.h> +#include <tqlineedit.h> +#include <tqtooltip.h> +#include <tqtoolbutton.h> #include "kregexpeditorprivate.h" #include "scrollededitorwindow.h" #include "regexpbuttons.h" //#include <unistd.h> // What do I need this for? #include <stdio.h> #include "infopage.h" -#include <qsplitter.h> -#include <qdockarea.h> +#include <tqsplitter.h> +#include <tqdockarea.h> #include "userdefinedregexps.h" #include "auxbuttons.h" -#include <qaccel.h> -#include <qtimer.h> +#include <tqaccel.h> +#include <tqtimer.h> #include "verifier.h" -#include <qfile.h> +#include <tqfile.h> #include "verifybuttons.h" -#include <qwhatsthis.h> +#include <tqwhatsthis.h> -KRegExpEditorPrivate::KRegExpEditorPrivate(QWidget *parent, const char *name) - : QWidget(parent, name), _updating( false ), _autoVerify( true ) +KRegExpEditorPrivate::KRegExpEditorPrivate(TQWidget *parent, const char *name) + : TQWidget(parent, name), _updating( false ), _autoVerify( true ) { setMinimumSize(730,300); - QDockArea* area = new QDockArea( Horizontal, QDockArea::Normal, this ); + TQDockArea* area = new TQDockArea( Horizontal, TQDockArea::Normal, this ); area->setMinimumSize(2,2); - QDockArea* verArea1 = new QDockArea( Vertical, QDockArea::Normal, this ); + TQDockArea* verArea1 = new TQDockArea( Vertical, TQDockArea::Normal, this ); verArea1->setMinimumSize(2,2); - QDockArea* verArea2 = new QDockArea( Vertical, QDockArea::Reverse, this ); + TQDockArea* verArea2 = new TQDockArea( Vertical, TQDockArea::Reverse, this ); verArea2->setMinimumSize(2,2); // The DockWindows. @@ -63,33 +63,33 @@ KRegExpEditorPrivate::KRegExpEditorPrivate(QWidget *parent, const char *name) _auxButtons = new AuxButtons( area, "KRegExpEditorPrivate::AuxButtons" ); _userRegExps = new UserDefinedRegExps( verArea1, "KRegExpEditorPrivate::userRegExps" ); _userRegExps->setResizeEnabled( true ); - QWhatsThis::add( _userRegExps, i18n( "In this window you will find predefined regular expressions. Both regular expressions " + TQWhatsThis::add( _userRegExps, i18n( "In this window you will find predefined regular expressions. Both regular expressions " "you have developed and saved, and regular expressions shipped with the system." )); // Editor window - _editor = new QSplitter( Vertical, this, "KRegExpEditorPrivate::_editor" ); + _editor = new TQSplitter( Vertical, this, "KRegExpEditorPrivate::_editor" ); _scrolledEditorWindow = new RegExpScrolledEditorWindow( _editor, "KRegExpEditorPrivate::_scrolledEditorWindow" ); - QWhatsThis::add( _scrolledEditorWindow, i18n( "In this window you will develop your regular expressions. " + TQWhatsThis::add( _scrolledEditorWindow, i18n( "In this window you will develop your regular expressions. " "Select one of the actions from the action buttons above, and click the mouse in this " "window to insert the given action.")); _info = new InfoPage( this, "_info" ); _verifier = new Verifier( _editor, "KRegExpEditorPrivate::_verifier" ); - connect( _verifier, SIGNAL( textChanged() ), this, SLOT( maybeVerify() ) ); - QWhatsThis::add( _verifier, i18n("Type in some text in this window, and see what the regular expression you have developed matches.<p>" + connect( _verifier, TQT_SIGNAL( textChanged() ), this, TQT_SLOT( maybeVerify() ) ); + TQWhatsThis::add( _verifier, i18n("Type in some text in this window, and see what the regular expression you have developed matches.<p>" "Each second match will be colored in red and each other match will be colored blue, simply so you " "can distinguish them from each other.<p>" "If you select part of the regular expression in the editor window, then this part will be " "highlighted - This allows you to <i>debug</i> your regular expressions") ); _editor->hide(); - _editor->setSizes( QValueList<int>() << _editor->height()/2 << _editor->height()/2 ); + _editor->setSizes( TQValueList<int>() << _editor->height()/2 << _editor->height()/2 ); - QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 6, "KRegExpEditorPrivate::topLayout" ); + TQVBoxLayout *topLayout = new TQVBoxLayout( this, 0, 6, "KRegExpEditorPrivate::topLayout" ); topLayout->addWidget( area ); - QHBoxLayout* rows = new QHBoxLayout; // I need to cal addLayout explicit to get stretching right. + TQHBoxLayout* rows = new QHBoxLayout; // I need to cal addLayout explicit to get stretching right. topLayout->addLayout( rows, 1 ); rows->addWidget( verArea1 ); @@ -98,54 +98,54 @@ KRegExpEditorPrivate::KRegExpEditorPrivate(QWidget *parent, const char *name) rows->addWidget( verArea2 ); // Connect the buttons - connect( _regExpButtons, SIGNAL( clicked( int ) ), _scrolledEditorWindow, SLOT( slotInsertRegExp( int ) ) ); - connect( _regExpButtons, SIGNAL( doSelect() ), _scrolledEditorWindow, SLOT( slotDoSelect() ) ); - connect( _userRegExps, SIGNAL( load( RegExp* ) ), _scrolledEditorWindow, SLOT( slotInsertRegExp( RegExp* ) ) ); + connect( _regExpButtons, TQT_SIGNAL( clicked( int ) ), _scrolledEditorWindow, TQT_SLOT( slotInsertRegExp( int ) ) ); + connect( _regExpButtons, TQT_SIGNAL( doSelect() ), _scrolledEditorWindow, TQT_SLOT( slotDoSelect() ) ); + connect( _userRegExps, TQT_SIGNAL( load( RegExp* ) ), _scrolledEditorWindow, TQT_SLOT( slotInsertRegExp( RegExp* ) ) ); - connect( _regExpButtons, SIGNAL( clicked( int ) ), _userRegExps, SLOT( slotUnSelect() ) ); - connect( _regExpButtons, SIGNAL( doSelect() ), _userRegExps, SLOT( slotUnSelect() ) ); - connect( _userRegExps, SIGNAL( load( RegExp* ) ), _regExpButtons, SLOT( slotUnSelect() ) ); + connect( _regExpButtons, TQT_SIGNAL( clicked( int ) ), _userRegExps, TQT_SLOT( slotUnSelect() ) ); + connect( _regExpButtons, TQT_SIGNAL( doSelect() ), _userRegExps, TQT_SLOT( slotUnSelect() ) ); + connect( _userRegExps, TQT_SIGNAL( load( RegExp* ) ), _regExpButtons, TQT_SLOT( slotUnSelect() ) ); - connect( _scrolledEditorWindow, SIGNAL( doneEditing() ), _regExpButtons, SLOT( slotSelectNewAction() ) ); - connect( _scrolledEditorWindow, SIGNAL( doneEditing() ), _userRegExps, SLOT( slotSelectNewAction() ) ); + connect( _scrolledEditorWindow, TQT_SIGNAL( doneEditing() ), _regExpButtons, TQT_SLOT( slotSelectNewAction() ) ); + connect( _scrolledEditorWindow, TQT_SIGNAL( doneEditing() ), _userRegExps, TQT_SLOT( slotSelectNewAction() ) ); - connect( _regExpButtons, SIGNAL( clicked( int ) ), this, SLOT( slotShowEditor() ) ); - connect( _userRegExps, SIGNAL( load( RegExp* ) ), this, SLOT( slotShowEditor() ) ); - connect( _regExpButtons, SIGNAL( doSelect() ), this, SLOT( slotShowEditor() ) ); + connect( _regExpButtons, TQT_SIGNAL( clicked( int ) ), this, TQT_SLOT( slotShowEditor() ) ); + connect( _userRegExps, TQT_SIGNAL( load( RegExp* ) ), this, TQT_SLOT( slotShowEditor() ) ); + connect( _regExpButtons, TQT_SIGNAL( doSelect() ), this, TQT_SLOT( slotShowEditor() ) ); - connect( _scrolledEditorWindow, SIGNAL( savedRegexp() ), _userRegExps, SLOT( slotPopulateUserRegexps() ) ); + connect( _scrolledEditorWindow, TQT_SIGNAL( savedRegexp() ), _userRegExps, TQT_SLOT( slotPopulateUserRegexps() ) ); - connect( _auxButtons, SIGNAL( undo() ), this, SLOT( slotUndo() ) ); - connect( _auxButtons, SIGNAL( redo() ), this, SLOT( slotRedo() ) ); - connect( _auxButtons, SIGNAL( cut() ), _scrolledEditorWindow, SLOT( slotCut() ) ); - connect( _auxButtons, SIGNAL( copy() ), _scrolledEditorWindow, SLOT( slotCopy() ) ); - connect( _auxButtons, SIGNAL( paste() ), _scrolledEditorWindow, SLOT( slotPaste() ) ); - connect( _auxButtons, SIGNAL( save() ), _scrolledEditorWindow, SLOT( slotSave() ) ); - connect( _verifyButtons, SIGNAL( autoVerify( bool ) ), this, SLOT( setAutoVerify( bool ) ) ); - connect( _verifyButtons, SIGNAL( verify() ), this, SLOT( doVerify() ) ); - connect( _verifyButtons, SIGNAL( changeSyntax( const QString& ) ), this, SLOT( setSyntax( const QString& ) ) ); + connect( _auxButtons, TQT_SIGNAL( undo() ), this, TQT_SLOT( slotUndo() ) ); + connect( _auxButtons, TQT_SIGNAL( redo() ), this, TQT_SLOT( slotRedo() ) ); + connect( _auxButtons, TQT_SIGNAL( cut() ), _scrolledEditorWindow, TQT_SLOT( slotCut() ) ); + connect( _auxButtons, TQT_SIGNAL( copy() ), _scrolledEditorWindow, TQT_SLOT( slotCopy() ) ); + connect( _auxButtons, TQT_SIGNAL( paste() ), _scrolledEditorWindow, TQT_SLOT( slotPaste() ) ); + connect( _auxButtons, TQT_SIGNAL( save() ), _scrolledEditorWindow, TQT_SLOT( slotSave() ) ); + connect( _verifyButtons, TQT_SIGNAL( autoVerify( bool ) ), this, TQT_SLOT( setAutoVerify( bool ) ) ); + connect( _verifyButtons, TQT_SIGNAL( verify() ), this, TQT_SLOT( doVerify() ) ); + connect( _verifyButtons, TQT_SIGNAL( changeSyntax( const TQString& ) ), this, TQT_SLOT( setSyntax( const TQString& ) ) ); - connect( this, SIGNAL( canUndo( bool ) ), _auxButtons, SLOT( slotCanUndo( bool ) ) ); - connect( this, SIGNAL( canRedo( bool ) ), _auxButtons, SLOT( slotCanRedo( bool ) ) ); - connect( _scrolledEditorWindow, SIGNAL( anythingSelected( bool ) ), _auxButtons, SLOT( slotCanCut( bool ) ) ); - connect( _scrolledEditorWindow, SIGNAL( anythingSelected( bool ) ), _auxButtons, SLOT( slotCanCopy( bool ) ) ); - connect( _scrolledEditorWindow, SIGNAL( anythingOnClipboard( bool ) ), _auxButtons, SLOT( slotCanPaste( bool ) ) ); - connect( _scrolledEditorWindow, SIGNAL( canSave( bool ) ), _auxButtons, SLOT( slotCanSave( bool ) ) ); + connect( this, TQT_SIGNAL( canUndo( bool ) ), _auxButtons, TQT_SLOT( slotCanUndo( bool ) ) ); + connect( this, TQT_SIGNAL( canRedo( bool ) ), _auxButtons, TQT_SLOT( slotCanRedo( bool ) ) ); + connect( _scrolledEditorWindow, TQT_SIGNAL( anythingSelected( bool ) ), _auxButtons, TQT_SLOT( slotCanCut( bool ) ) ); + connect( _scrolledEditorWindow, TQT_SIGNAL( anythingSelected( bool ) ), _auxButtons, TQT_SLOT( slotCanCopy( bool ) ) ); + connect( _scrolledEditorWindow, TQT_SIGNAL( anythingOnClipboard( bool ) ), _auxButtons, TQT_SLOT( slotCanPaste( bool ) ) ); + connect( _scrolledEditorWindow, TQT_SIGNAL( canSave( bool ) ), _auxButtons, TQT_SLOT( slotCanSave( bool ) ) ); - connect( _scrolledEditorWindow, SIGNAL( verifyRegExp() ), this, SLOT( maybeVerify() ) ); + connect( _scrolledEditorWindow, TQT_SIGNAL( verifyRegExp() ), this, TQT_SLOT( maybeVerify() ) ); - connect( _verifyButtons, SIGNAL( loadVerifyText( const QString& ) ), this, SLOT( setVerifyText( const QString& ) ) ); + connect( _verifyButtons, TQT_SIGNAL( loadVerifyText( const TQString& ) ), this, TQT_SLOT( setVerifyText( const TQString& ) ) ); - // connect( _verifier, SIGNAL( countChanged( int ) ), _verifyButtons, SLOT( setMatchCount( int ) ) ); + // connect( _verifier, TQT_SIGNAL( countChanged( int ) ), _verifyButtons, TQT_SLOT( setMatchCount( int ) ) ); // Qt anchors do not work for <pre>...</pre>, thefore scrolling to next/prev match // do not work. Enable this when they work. - // connect( _verifyButtons, SIGNAL( gotoFirst() ), _verifier, SLOT( gotoFirst() ) ); - // connect( _verifyButtons, SIGNAL( gotoPrev() ), _verifier, SLOT( gotoPrev() ) ); - // connect( _verifyButtons, SIGNAL( gotoNext() ), _verifier, SLOT( gotoNext() ) ); - // connect( _verifyButtons, SIGNAL( gotoLast() ), _verifier, SLOT( gotoLast() ) ); - // connect( _verifier, SIGNAL( goForwardPossible( bool ) ), _verifyButtons, SLOT( enableForwardButtons( bool ) ) ); - // connect( _verifier, SIGNAL( goBackwardPossible( bool ) ), _verifyButtons, SLOT( enableBackwardButtons( bool ) ) ); + // connect( _verifyButtons, TQT_SIGNAL( gotoFirst() ), _verifier, TQT_SLOT( gotoFirst() ) ); + // connect( _verifyButtons, TQT_SIGNAL( gotoPrev() ), _verifier, TQT_SLOT( gotoPrev() ) ); + // connect( _verifyButtons, TQT_SIGNAL( gotoNext() ), _verifier, TQT_SLOT( gotoNext() ) ); + // connect( _verifyButtons, TQT_SIGNAL( gotoLast() ), _verifier, TQT_SLOT( gotoLast() ) ); + // connect( _verifier, TQT_SIGNAL( goForwardPossible( bool ) ), _verifyButtons, TQT_SLOT( enableForwardButtons( bool ) ) ); + // connect( _verifier, TQT_SIGNAL( goBackwardPossible( bool ) ), _verifyButtons, TQT_SLOT( enableBackwardButtons( bool ) ) ); _auxButtons->slotCanPaste( false ); _auxButtons->slotCanCut( false ); @@ -154,60 +154,60 @@ KRegExpEditorPrivate::KRegExpEditorPrivate(QWidget *parent, const char *name) // Line Edit - QHBoxLayout* layout = new QHBoxLayout( topLayout, 6 ); - QLabel* label = new QLabel( i18n("ASCII syntax:"), this ); + TQHBoxLayout* layout = new TQHBoxLayout( topLayout, 6 ); + TQLabel* label = new TQLabel( i18n("ASCII syntax:"), this ); layout->addWidget( label ); - clearButton = new QToolButton( this ); - const QString icon( QString::fromLatin1( QApplication::reverseLayout() ? "clear_left" : "locationbar_erase" ) ); - QIconSet clearIcon = SmallIconSet( icon ); + clearButton = new TQToolButton( this ); + const TQString icon( TQString::fromLatin1( TQApplication::reverseLayout() ? "clear_left" : "locationbar_erase" ) ); + TQIconSet clearIcon = SmallIconSet( icon ); clearButton->setIconSet( clearIcon ); layout->addWidget( clearButton ); - QToolTip::add( clearButton, i18n("Clear expression") ); - _regexpEdit = new QLineEdit( this ); + TQToolTip::add( clearButton, i18n("Clear expression") ); + _regexpEdit = new TQLineEdit( this ); layout->addWidget( _regexpEdit ); - QWhatsThis::add( _regexpEdit, i18n( "This is the regular expression in ASCII syntax. You are likely only " + TQWhatsThis::add( _regexpEdit, i18n( "This is the regular expression in ASCII syntax. You are likely only " "to be interested in this if you are a programmer, and need to " - "develop a regular expression using QRegExp.<p>" + "develop a regular expression using TQRegExp.<p>" "You may develop your regular expression both by using the graphical " "editor, and by typing the regular expression in this line edit.") ); #ifdef QT_ONLY - QPixmap pix( "icons/error.png" ); + TQPixmap pix( "icons/error.png" ); #else - QPixmap pix = KGlobal::iconLoader()->loadIcon(locate("data", QString::fromLatin1("kregexpeditor/pics/error.png") ), KIcon::Toolbar ); + TQPixmap pix = KGlobal::iconLoader()->loadIcon(locate("data", TQString::fromLatin1("kregexpeditor/pics/error.png") ), KIcon::Toolbar ); #endif - _error = new QLabel( this ); + _error = new TQLabel( this ); _error->setPixmap( pix ); layout->addWidget( _error ); _error->hide(); - _timer = new QTimer(this); + _timer = new TQTimer(this); - connect( _scrolledEditorWindow, SIGNAL( change() ), this, SLOT( slotUpdateLineEdit() ) ); - connect( _regexpEdit, SIGNAL(textChanged( const QString& ) ), this, SLOT( slotTriggerUpdate() ) ); - connect( _timer, SIGNAL( timeout() ), this, SLOT( slotTimeout() ) ); - connect( clearButton, SIGNAL( clicked() ), _regexpEdit, SLOT( clear() ) ); + connect( _scrolledEditorWindow, TQT_SIGNAL( change() ), this, TQT_SLOT( slotUpdateLineEdit() ) ); + connect( _regexpEdit, TQT_SIGNAL(textChanged( const TQString& ) ), this, TQT_SLOT( slotTriggerUpdate() ) ); + connect( _timer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( slotTimeout() ) ); + connect( clearButton, TQT_SIGNAL( clicked() ), _regexpEdit, TQT_SLOT( clear() ) ); // Push an initial empty element on the stack. _undoStack.push( _scrolledEditorWindow->regExp() ); _redoStack.setAutoDelete( true ); - QAccel* accel = new QAccel( this ); - accel->connectItem( accel->insertItem( CTRL+Key_Z ), this, SLOT( slotUndo() ) ); - accel->connectItem( accel->insertItem( CTRL+Key_R ), this, SLOT( slotRedo() ) ); + TQAccel* accel = new TQAccel( this ); + accel->connectItem( accel->insertItem( CTRL+Key_Z ), this, TQT_SLOT( slotUndo() ) ); + accel->connectItem( accel->insertItem( CTRL+Key_R ), this, TQT_SLOT( slotRedo() ) ); - setSyntax( QString::fromLatin1( "Qt" ) ); + setSyntax( TQString::fromLatin1( "Qt" ) ); } -QString KRegExpEditorPrivate::regexp() +TQString KRegExpEditorPrivate::regexp() { RegExp* regexp = _scrolledEditorWindow->regExp(); - QString res = RegExpConverter::current()->toStr( regexp, false ); + TQString res = RegExpConverter::current()->toStr( regexp, false ); delete regexp; return res; } -void KRegExpEditorPrivate::slotUpdateEditor( const QString & txt) +void KRegExpEditorPrivate::slotUpdateEditor( const TQString & txt) { _updating = true; bool ok; @@ -217,8 +217,8 @@ void KRegExpEditorPrivate::slotUpdateEditor( const QString & txt) else { RegExp* result = RegExpConverter::current()->parse( txt, &ok ); if ( ok ) { - QPtrList<CompoundRegExp> list = _userRegExps->regExps(); - for ( QPtrListIterator<CompoundRegExp> it( list ); *it; ++it ) { + TQPtrList<CompoundRegExp> list = _userRegExps->regExps(); + for ( TQPtrListIterator<CompoundRegExp> it( list ); *it; ++it ) { result->replacePart( *it ); } @@ -247,7 +247,7 @@ void KRegExpEditorPrivate::slotUpdateLineEdit() RegExp* regexp = _scrolledEditorWindow->regExp(); regexp->check( _errorMap ); - QString str = RegExpConverter::current()->toStr( regexp, false ); + TQString str = RegExpConverter::current()->toStr( regexp, false ); _regexpEdit->setText( str ); delete regexp; @@ -264,7 +264,7 @@ void KRegExpEditorPrivate::recordUndoInfo() RegExp* regexp = _scrolledEditorWindow->regExp(); if ( regexp->toXmlString() != _undoStack.top()->toXmlString() ) { _undoStack.push( regexp ); - _redoStack = QPtrStack<RegExp>(); + _redoStack = TQPtrStack<RegExp>(); emitUndoRedoSignals(); } } @@ -304,7 +304,7 @@ void KRegExpEditorPrivate::emitUndoRedoSignals() emit canRedo( _redoStack.count() > 0 ); } -void KRegExpEditorPrivate::slotSetRegexp( QString regexp ) +void KRegExpEditorPrivate::slotSetRegexp( TQString regexp ) { _regexpEdit->setText( regexp ); } @@ -329,7 +329,7 @@ void KRegExpEditorPrivate::slotTimeout() slotUpdateEditor( _regexpEdit->text() ); } -void KRegExpEditorPrivate::setMatchText( const QString& text ) +void KRegExpEditorPrivate::setMatchText( const TQString& text ) { bool autoVerify = _autoVerify; _autoVerify = false; @@ -365,17 +365,17 @@ void KRegExpEditorPrivate::setAutoVerify( bool on ) doVerify(); } -void KRegExpEditorPrivate::setVerifyText( const QString& fileName ) +void KRegExpEditorPrivate::setVerifyText( const TQString& fileName ) { bool autoVerify = _autoVerify; _autoVerify = false; - QFile file( fileName ); + TQFile file( fileName ); if ( !file.open( IO_ReadOnly ) ) { KMessageBox::sorry(0, i18n("Could not open file '%1' for reading").arg( fileName ) ); } else { - QTextStream s( &file ); - QString txt = s.read(); + TQTextStream s( &file ); + TQString txt = s.read(); file.close(); RegExp* regexp = _scrolledEditorWindow->regExp(); _verifier->setText( txt ); @@ -395,7 +395,7 @@ void KRegExpEditorPrivate::setMinimal( bool b ) _verifier->setMinimal( b ); } -void KRegExpEditorPrivate::setSyntax( const QString& syntax ) +void KRegExpEditorPrivate::setSyntax( const TQString& syntax ) { RegExpConverter* converter = _verifyButtons->setSyntax( syntax ); RegExpConverter::setCurrent( converter ); |