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/diff/diffwidget.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/diff/diffwidget.cpp')
-rw-r--r-- | parts/diff/diffwidget.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/parts/diff/diffwidget.cpp b/parts/diff/diffwidget.cpp index 0b3399ab..7d403e46 100644 --- a/parts/diff/diffwidget.cpp +++ b/parts/diff/diffwidget.cpp @@ -9,11 +9,11 @@ * * ***************************************************************************/ -#include <qlayout.h> -#include <qtextedit.h> -#include <qpopupmenu.h> -#include <qcursor.h> -#include <qfile.h> +#include <tqlayout.h> +#include <tqtextedit.h> +#include <tqpopupmenu.h> +#include <tqcursor.h> +#include <tqfile.h> #include <kconfig.h> #include <kapplication.h> @@ -39,10 +39,10 @@ // yup, magic value for the popupmenu-id static const int POPUP_BASE = 130977; -QStringList KDiffTextEdit::extParts; -QStringList KDiffTextEdit::extPartsTranslated; +TQStringList KDiffTextEdit::extParts; +TQStringList KDiffTextEdit::extPartsTranslated; -KDiffTextEdit::KDiffTextEdit( QWidget* parent, const char* name ): QTextEdit( parent, name ) +KDiffTextEdit::KDiffTextEdit( TQWidget* parent, const char* name ): TQTextEdit( parent, name ) { KConfig* config = kapp->config(); config->setGroup( "Diff" ); @@ -59,51 +59,51 @@ KDiffTextEdit::~KDiffTextEdit() config->writeEntry( "Highlight", _highlight ); } -QPopupMenu* KDiffTextEdit::createPopupMenu() +TQPopupMenu* KDiffTextEdit::createPopupMenu() { - return createPopupMenu( QPoint() ); + return createPopupMenu( TQPoint() ); } -QPopupMenu* KDiffTextEdit::createPopupMenu( const QPoint& p ) +TQPopupMenu* KDiffTextEdit::createPopupMenu( const TQPoint& p ) { - QPopupMenu* popup = QTextEdit::createPopupMenu( p ); + TQPopupMenu* popup = TQTextEdit::createPopupMenu( p ); if ( !popup ) - popup = new QPopupMenu( this ); + popup = new TQPopupMenu( this ); int i = 0; - for ( QStringList::Iterator it = extPartsTranslated.begin(); it != extPartsTranslated.end(); ++it ) { + for ( TQStringList::Iterator it = extPartsTranslated.begin(); it != extPartsTranslated.end(); ++it ) { popup->insertItem( i18n( "Show in %1" ).arg( *it ), i + POPUP_BASE, i ); i++; } if ( !extPartsTranslated.isEmpty() ) popup->insertSeparator( i ); - connect( popup, SIGNAL(activated(int)), this, SLOT(popupActivated(int)) ); + connect( popup, TQT_SIGNAL(activated(int)), this, TQT_SLOT(popupActivated(int)) ); - popup->insertItem( SmallIconSet( "filesaveas" ), i18n( "&Save As..." ), this, SLOT(saveAs()), CTRL + Key_S, POPUP_BASE - 2, 0 ); + popup->insertItem( SmallIconSet( "filesaveas" ), i18n( "&Save As..." ), this, TQT_SLOT(saveAs()), CTRL + Key_S, POPUP_BASE - 2, 0 ); popup->setItemEnabled( POPUP_BASE - 2, length() > 0 ); popup->insertSeparator( 1 ); - popup->insertItem( i18n( "Highlight Syntax" ), this, SLOT(toggleSyntaxHighlight()), 0, POPUP_BASE - 1, 2 ); + popup->insertItem( i18n( "Highlight Syntax" ), this, TQT_SLOT(toggleSyntaxHighlight()), 0, POPUP_BASE - 1, 2 ); popup->setItemChecked( POPUP_BASE - 1, _highlight ); popup->insertSeparator( 3 ); popup->insertSeparator(); - popup->insertItem( i18n("Hide view"), parent(), SLOT(hideView()) ); + popup->insertItem( i18n("Hide view"), parent(), TQT_SLOT(hideView()) ); return popup; } void KDiffTextEdit::saveAs() { - QString fName = KFileDialog::getSaveFileName(); + TQString fName = KFileDialog::getSaveFileName(); if ( fName.isEmpty() ) return; - QFile f( fName ); + TQFile f( fName ); if ( f.open( IO_WriteOnly ) ) { - QTextStream stream( &f ); + TQTextStream stream( &f ); int pCount = paragraphs(); for ( int i = 0; i < pCount; ++i ) stream << text( i ) << "\n"; @@ -125,15 +125,15 @@ void KDiffTextEdit::toggleSyntaxHighlight() void KDiffTextEdit::applySyntaxHighlight() { // the diff has been loaded so we apply a simple highlighting - static QColor cAdded( 190, 190, 237); - static QColor cRemoved( 190, 237, 190 ); + static TQColor cAdded( 190, 190, 237); + static TQColor cRemoved( 190, 237, 190 ); if ( !_highlight ) return; int paragCount = paragraphs(); for ( int i = 0; i < paragCount; ++i ) { - QString txt = text( i ); + TQString txt = text( i ); if ( txt.length() > 0 ) { if ( txt.startsWith( "+" ) || txt.startsWith( ">" ) ) { setParagraphBackgroundColor( i, cAdded ); @@ -180,19 +180,19 @@ void KDiffTextEdit::popupActivated( int id ) emit externalPartRequested( extParts[ id ] ); } -DiffWidget::DiffWidget( DiffPart * part, QWidget *parent, const char *name, WFlags f ): - QWidget( parent, name, f ), m_part( part ), tempFile( 0 ) +DiffWidget::DiffWidget( DiffPart * part, TQWidget *parent, const char *name, WFlags f ): + TQWidget( parent, name, f ), m_part( part ), tempFile( 0 ) { job = 0; extPart = 0; te = new KDiffTextEdit( this, "Main Diff Viewer" ); te->setReadOnly( true ); - te->setTextFormat( QTextEdit::PlainText ); + te->setTextFormat( TQTextEdit::PlainText ); // te->setMinimumSize( 300, 200 ); - connect( te, SIGNAL(externalPartRequested(const QString&)), this, SLOT(loadExtPart(const QString&)) ); + connect( te, TQT_SIGNAL(externalPartRequested(const TQString&)), this, TQT_SLOT(loadExtPart(const TQString&)) ); - QVBoxLayout* layout = new QVBoxLayout( this ); + TQVBoxLayout* layout = new TQVBoxLayout( this ); layout->addWidget( te ); } @@ -217,7 +217,7 @@ void DiffWidget::setExtPartVisible( bool visible ) } } -void DiffWidget::loadExtPart( const QString& partName ) +void DiffWidget::loadExtPart( const TQString& partName ) { if ( extPart ) { setExtPartVisible( false ); @@ -243,22 +243,22 @@ void DiffWidget::loadExtPart( const QString& partName ) void DiffWidget::slotClear() { - rawDiff = QString(); + rawDiff = TQString(); te->clear(); if ( extPart ) extPart->closeURL(); } // internally for the TextEdit only! -void DiffWidget::slotAppend( const QString& str ) +void DiffWidget::slotAppend( const TQString& str ) { te->append( str ); } // internally for the TextEdit only! -void DiffWidget::slotAppend( KIO::Job*, const QByteArray& ba ) +void DiffWidget::slotAppend( KIO::Job*, const TQByteArray& ba ) { - slotAppend( QString( ba ) ); + slotAppend( TQString( ba ) ); } void DiffWidget::populateExtPart() @@ -292,7 +292,7 @@ void DiffWidget::slotFinished() populateExtPart(); } -void DiffWidget::setDiff( const QString& diff ) +void DiffWidget::setDiff( const TQString& diff ) { slotClear(); rawDiff = diff; @@ -309,24 +309,24 @@ void DiffWidget::openURL( const KURL& url ) if ( !job ) return; - connect( job, SIGNAL(data( KIO::Job *, const QByteArray & )), - this, SLOT(slotAppend( KIO::Job*, const QByteArray& )) ); - connect( job, SIGNAL(result( KIO::Job * )), - this, SLOT(slotFinished()) ); + connect( job, TQT_SIGNAL(data( KIO::Job *, const TQByteArray & )), + this, TQT_SLOT(slotAppend( KIO::Job*, const TQByteArray& )) ); + connect( job, TQT_SIGNAL(result( KIO::Job * )), + this, TQT_SLOT(slotFinished()) ); } -void DiffWidget::contextMenuEvent( QContextMenuEvent* /* e */ ) +void DiffWidget::contextMenuEvent( TQContextMenuEvent* /* e */ ) { - QPopupMenu* popup = new QPopupMenu( this ); + TQPopupMenu* popup = new TQPopupMenu( this ); if ( !te->isVisible() ) { - popup->insertItem( i18n("Display &Raw Output"), this, SLOT(showTextEdit()) ); + popup->insertItem( i18n("Display &Raw Output"), this, TQT_SLOT(showTextEdit()) ); popup->insertSeparator(); - popup->insertItem( i18n("Hide view"), this, SLOT(hideView()) ); + popup->insertItem( i18n("Hide view"), this, TQT_SLOT(hideView()) ); } - popup->exec( QCursor::pos() ); + popup->exec( TQCursor::pos() ); delete popup; } |