diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
commit | 87a016680e3677da3993f333561e79eb0cead7d5 (patch) | |
tree | cbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/textview.cpp | |
parent | 6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff) | |
download | ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.tar.gz ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.zip |
TQt4 port ktechlab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1238801 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/textview.cpp')
-rw-r--r-- | src/textview.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/src/textview.cpp b/src/textview.cpp index 49a1946..0bca8a8 100644 --- a/src/textview.cpp +++ b/src/textview.cpp @@ -33,10 +33,10 @@ #include <kpopupmenu.h> #include <kstandarddirs.h> -#include <qapplication.h> -#include <qcursor.h> -#include <qobjectlist.h> -#include <qtimer.h> +#include <tqapplication.h> +#include <tqcursor.h> +#include <tqobjectlist.h> +#include <tqtimer.h> //BEGIN class TextView @@ -60,24 +60,24 @@ TextView::TextView( TextDocument * textDocument, ViewContainer *viewContainer, u m->insertItem( KGlobal::iconLoader()->loadIcon( "convert_to_assembly", KIcon::Small ), i18n("Assembly"), TextDocument::AssemblyOutput ); m->insertItem( KGlobal::iconLoader()->loadIcon( "convert_to_hex", KIcon::Small ), i18n("Hex"), TextDocument::HexOutput ); m->insertItem( KGlobal::iconLoader()->loadIcon( "convert_to_pic", KIcon::Small ), i18n("PIC (upload)"), TextDocument::PICOutput ); - connect( m, SIGNAL(activated(int)), textDocument, SLOT(slotConvertTo(int)) ); + connect( m, TQT_SIGNAL(activated(int)), textDocument, TQT_SLOT(slotConvertTo(int)) ); m->setItemEnabled( TextDocument::MicrobeOutput, false ); //END Convert To * Actions - new KAction( i18n("Format Assembly Code"), "", Qt::Key_F12, textDocument, SLOT(formatAssembly()), ac, "format_asm" ); + new KAction( i18n("Format Assembly Code"), "", TQt::Key_F12, textDocument, TQT_SLOT(formatAssembly()), ac, "format_asm" ); #ifndef NO_GPSIM //BEGIN Debug Actions - new KAction( i18n("Set &Breakpoint"), 0, 0, this, SLOT(toggleBreakpoint()), ac, "debug_toggle_breakpoint" ); - new KAction( i18n("Run"), "dbgrun", 0, textDocument, SLOT(debugRun()), ac, "debug_run" ); - new KAction( i18n("Interrupt"), "player_pause", 0, textDocument, SLOT(debugInterrupt()), ac, "debug_interrupt" ); - new KAction( i18n("Stop"), "stop", 0, textDocument, SLOT(debugStop()), ac, "debug_stop" ); - new KAction( i18n("Step"), "dbgstep", Qt::CTRL|Qt::ALT|Qt::Key_Right, textDocument, SLOT(debugStep()), ac, "debug_step" ); - new KAction( i18n("Step Over"), "dbgnext", 0, textDocument, SLOT(debugStepOver()), ac, "debug_step_over" ); - new KAction( i18n("Step Out"), "dbgstepout", 0, textDocument, SLOT(debugStepOut()), ac, "debug_step_out" ); + new KAction( i18n("Set &Breakpoint"), 0, 0, TQT_TQOBJECT(this), TQT_SLOT(toggleBreakpoint()), ac, "debug_toggle_breakpoint" ); + new KAction( i18n("Run"), "dbgrun", 0, textDocument, TQT_SLOT(debugRun()), ac, "debug_run" ); + new KAction( i18n("Interrupt"), "player_pause", 0, textDocument, TQT_SLOT(debugInterrupt()), ac, "debug_interrupt" ); + new KAction( i18n("Stop"), "stop", 0, textDocument, TQT_SLOT(debugStop()), ac, "debug_stop" ); + new KAction( i18n("Step"), "dbgstep", TQt::CTRL|TQt::ALT|TQt::Key_Right, textDocument, TQT_SLOT(debugStep()), ac, "debug_step" ); + new KAction( i18n("Step Over"), "dbgnext", 0, textDocument, TQT_SLOT(debugStepOver()), ac, "debug_step_over" ); + new KAction( i18n("Step Out"), "dbgstepout", 0, textDocument, TQT_SLOT(debugStepOut()), ac, "debug_step_out" ); //END Debug Actions #endif @@ -93,10 +93,10 @@ TextView::TextView( TextDocument * textDocument, ViewContainer *viewContainer, u m_statusBar->insertItem( "", ViewStatusBar::LineCol ); - m_view->installPopup( static_cast<QPopupMenu*>( p_ktechlab->factory()->container( "ktexteditor_popup", p_ktechlab ) ) ); + m_view->installPopup( static_cast<TQPopupMenu*>( p_ktechlab->factory()->container( "ktexteditor_popup", p_ktechlab ) ) ); - connect( m_view, SIGNAL(cursorPositionChanged()), this, SLOT(slotCursorPositionChanged()) ); - connect( m_view, SIGNAL(gotFocus(Kate::View*)), this, SLOT(setFocused()) ); + connect( m_view, TQT_SIGNAL(cursorPositionChanged()), this, TQT_SLOT(slotCursorPositionChanged()) ); + connect( m_view, TQT_SIGNAL(gotFocus(Kate::View*)), this, TQT_SLOT(setFocused()) ); m_layout->insertWidget( 0, m_view ); @@ -109,10 +109,10 @@ TextView::TextView( TextDocument * textDocument, ViewContainer *viewContainer, u m_pTextViewLabel->hide(); TextViewEventFilter * eventFilter = new TextViewEventFilter( this ); - connect( eventFilter, SIGNAL(wordHoveredOver( const QString&, int, int )), this, SLOT(slotWordHoveredOver( const QString&, int, int )) ); - connect( eventFilter, SIGNAL(wordUnhovered()), this, SLOT(slotWordUnhovered()) ); + connect( eventFilter, TQT_SIGNAL(wordHoveredOver( const TQString&, int, int )), this, TQT_SLOT(slotWordHoveredOver( const TQString&, int, int )) ); + connect( eventFilter, TQT_SIGNAL(wordUnhovered()), this, TQT_SLOT(slotWordUnhovered()) ); - QObject * internalView = m_view->child( 0, "KateViewInternal" ); + TQObject * internalView = m_view->child( 0, "KateViewInternal" ); internalView->installEventFilter( eventFilter ); #endif } @@ -137,7 +137,7 @@ bool TextView::closeView() { if ( textDocument() ) { - const QString path = textDocument()->url().prettyURL(); + const TQString path = textDocument()->url().prettyURL(); if ( !path.isEmpty() ) fileMetaInfo()->grabMetaInfo( path, this ); } @@ -262,7 +262,7 @@ void TextView::slotCursorPositionChanged() uint line, column; m_view->cursorPosition( &line, &column ); - m_statusBar->changeItem( i18n(" Line: %1 Col: %2 ").arg(QString::number(line+1)).arg(QString::number(column+1)), ViewStatusBar::LineCol ); + m_statusBar->changeItem( i18n(" Line: %1 Col: %2 ").tqarg(TQString::number(line+1)).tqarg(TQString::number(column+1)), ViewStatusBar::LineCol ); slotUpdateMarksInfo(); } @@ -309,7 +309,7 @@ void TextView::toggleBreakpoint() } -void TextView::slotWordHoveredOver( const QString & word, int line, int col ) +void TextView::slotWordHoveredOver( const TQString & word, int line, int col ) { #ifndef NO_GPSIM // We're only interested in popping something up if we currently have a debugger running @@ -323,7 +323,7 @@ void TextView::slotWordHoveredOver( const QString & word, int line, int col ) // Find out if the word that we are hovering over is the operand data KTextEditor::EditInterface * e = (KTextEditor::EditInterface*)textDocument()->kateDocument()->qt_cast("KTextEditor::EditInterface"); InstructionParts parts( e->textLine( unsigned(line) ) ); - if ( !parts.operandData().contains( word ) ) + if ( !parts.operandData().tqcontains( word ) ) return; if ( RegisterInfo * info = gpsim->registerMemory()->fromName( word ) ) @@ -350,7 +350,7 @@ void TextView::slotWordHoveredOver( const QString & word, int line, int col ) } } - m_pTextViewLabel->move( mapFromGlobal( QCursor::pos() ) + QPoint( 0, 20 ) ); + m_pTextViewLabel->move( mapFromGlobal( TQCursor::pos() ) + TQPoint( 0, 20 ) ); m_pTextViewLabel->show(); #endif // !NO_GPSIM } @@ -369,37 +369,37 @@ void TextView::slotWordUnhovered() //BEGIN class TextViewEventFilter TextViewEventFilter::TextViewEventFilter( TextView * textView ) { - m_hoverStatus = Sleeping; + m_hovertqStatus = Sleeping; m_pTextView = textView; m_lastLine = m_lastCol = -1; ((KTextEditor::TextHintInterface*)textView->kateView()->qt_cast("KTextEditor::TextHintInterface"))->enableTextHints(0); - connect( textView->kateView(), SIGNAL(needTextHint(int, int, QString &)), this, SLOT(slotNeedTextHint( int, int, QString& )) ); + connect( textView->kateView(), TQT_SIGNAL(needTextHint(int, int, TQString &)), this, TQT_SLOT(slotNeedTextHint( int, int, TQString& )) ); - m_pHoverTimer = new QTimer( this ); - connect( m_pHoverTimer, SIGNAL(timeout()), this, SLOT(hoverTimeout()) ); + m_pHoverTimer = new TQTimer( this ); + connect( m_pHoverTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(hoverTimeout()) ); - m_pSleepTimer = new QTimer( this ); - connect( m_pSleepTimer, SIGNAL(timeout()), this, SLOT(gotoSleep()) ); + m_pSleepTimer = new TQTimer( this ); + connect( m_pSleepTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(gotoSleep()) ); - m_pNoWordTimer = new QTimer( this ); - connect( m_pNoWordTimer, SIGNAL(timeout()), this, SLOT(slotNoWordTimeout()) ); + m_pNoWordTimer = new TQTimer( this ); + connect( m_pNoWordTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotNoWordTimeout()) ); } -bool TextViewEventFilter::eventFilter( QObject *, QEvent * e ) +bool TextViewEventFilter::eventFilter( TQObject *, TQEvent * e ) { - if ( e->type() == QEvent::MouseMove ) + if ( e->type() == TQEvent::MouseMove ) { if ( !m_pNoWordTimer->isActive() ) m_pNoWordTimer->start( 10 ); return false; } - if ( e->type() == QEvent::FocusOut || e->type() == QEvent::FocusIn || e->type() == QEvent::MouseButtonPress || e->type() == QEvent::Leave || e->type() == QEvent::Wheel ) + if ( e->type() == TQEvent::FocusOut || e->type() == TQEvent::FocusIn || e->type() == TQEvent::MouseButtonPress || e->type() == TQEvent::Leave || e->type() == TQEvent::Wheel ) { // user moved focus somewhere - hide the tip and sleep - if ( ((QFocusEvent*)e)->reason() != QFocusEvent::Popup ) + if ( ((TQFocusEvent*)e)->reason() != TQFocusEvent::Popup ) updateHovering( 0, -1, -1 ); } @@ -410,15 +410,15 @@ bool TextViewEventFilter::eventFilter( QObject *, QEvent * e ) void TextViewEventFilter::hoverTimeout() { m_pSleepTimer->stop(); - m_hoverStatus = Active; + m_hovertqStatus = Active; emit wordHoveredOver( m_lastWord, m_lastLine, m_lastCol ); } void TextViewEventFilter::gotoSleep() { - m_hoverStatus = Sleeping; - m_lastWord = QString::null; + m_hovertqStatus = Sleeping; + m_lastWord = TQString(); emit wordUnhovered(); m_pHoverTimer->stop(); } @@ -430,7 +430,7 @@ void TextViewEventFilter::slotNoWordTimeout() } -void TextViewEventFilter::updateHovering( const QString & currentWord, int line, int col ) +void TextViewEventFilter::updateHovering( const TQString & currentWord, int line, int col ) { if ( (currentWord == m_lastWord) && (line == m_lastLine) ) return; @@ -441,8 +441,8 @@ void TextViewEventFilter::updateHovering( const QString & currentWord, int line, if ( currentWord.isEmpty() ) { - if ( m_hoverStatus == Active ) - m_hoverStatus = Hidden; + if ( m_hovertqStatus == Active ) + m_hovertqStatus = Hidden; emit wordUnhovered(); if ( !m_pSleepTimer->isActive() ) @@ -451,17 +451,17 @@ void TextViewEventFilter::updateHovering( const QString & currentWord, int line, return; } - if ( m_hoverStatus != Sleeping ) + if ( m_hovertqStatus != Sleeping ) emit wordHoveredOver( currentWord, line, col ); else m_pHoverTimer->start( 700, true ); } -static inline bool isWordLetter( const QString & s ) { return (s.length() == 1) && (s[0].isLetterOrNumber() || s[0] == '_'); } +static inline bool isWordLetter( const TQString & s ) { return (s.length() == 1) && (s[0].isLetterOrNumber() || s[0] == '_'); } -void TextViewEventFilter::slotNeedTextHint( int line, int col, QString & ) +void TextViewEventFilter::slotNeedTextHint( int line, int col, TQString & ) { m_pNoWordTimer->stop(); @@ -470,7 +470,7 @@ void TextViewEventFilter::slotNeedTextHint( int line, int col, QString & ) // Return if we aren't currently in a word if ( !isWordLetter( e->text( line, col, line, col+1 ) ) ) { - updateHovering( QString::null, line, col ); + updateHovering( TQString(), line, col ); return; } @@ -485,7 +485,7 @@ void TextViewEventFilter::slotNeedTextHint( int line, int col, QString & ) do wordEnd++; while ( isWordLetter( e->text( line, wordEnd, line, wordEnd+1 ) ) ); - QString t = e->text( line, wordStart, line, wordEnd ); + TQString t = e->text( line, wordStart, line, wordEnd ); updateHovering( t, line, col ); } |