summaryrefslogtreecommitdiffstats
path: root/src/difftextwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/difftextwindow.cpp')
-rw-r--r--src/difftextwindow.cpp318
1 files changed, 159 insertions, 159 deletions
diff --git a/src/difftextwindow.cpp b/src/difftextwindow.cpp
index 79d55ed..93a3770 100644
--- a/src/difftextwindow.cpp
+++ b/src/difftextwindow.cpp
@@ -17,23 +17,23 @@
#include "difftextwindow.h"
#include "merger.h"
-#include <qpainter.h>
+#include <tqpainter.h>
#include <assert.h>
-#include <qpixmap.h>
-#include <qstatusbar.h>
-#include <qapplication.h>
-#include <qtooltip.h>
-#include <qfont.h>
-#include <qstringlist.h>
-#include <qlineedit.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qtextcodec.h>
+#include <tqpixmap.h>
+#include <tqstatusbar.h>
+#include <tqapplication.h>
+#include <tqtooltip.h>
+#include <tqfont.h>
+#include <tqstringlist.h>
+#include <tqlineedit.h>
+#include <tqlabel.h>
+#include <tqpushbutton.h>
+#include <tqlayout.h>
+#include <tqtextcodec.h>
#include <optiondialog.h>
#include <math.h>
#include <cstdlib>
-#include <qdragobject.h>
+#include <tqdragobject.h>
#include <klocale.h>
#include <kfiledialog.h>
@@ -72,7 +72,7 @@ public:
bool m_bPaintingAllowed;
const LineData* m_pLineData;
int m_size;
- QString m_filename;
+ TQString m_filename;
bool m_bWordWrap;
int m_delayedDrawTimer;
@@ -81,10 +81,10 @@ public:
const ManualDiffHelpList* m_pManualDiffHelpList;
OptionDialog* m_pOptionDialog;
- QColor m_cThis;
- QColor m_cDiff1;
- QColor m_cDiff2;
- QColor m_cDiffBoth;
+ TQColor m_cThis;
+ TQColor m_cDiff1;
+ TQColor m_cDiff2;
+ TQColor m_cDiffBoth;
int m_fastSelectorLine1;
int m_fastSelectorNofLines;
@@ -103,19 +103,19 @@ public:
DiffList*& pFineDiff1, DiffList*& pFineDiff2, // return values
int& changed, int& changed2 );
- QString getString( int d3lIdx );
- QString getLineString( int line );
+ TQString getString( int d3lIdx );
+ TQString getLineString( int line );
void writeLine(
MyPainter& p, const LineData* pld,
const DiffList* pLineDiff1, const DiffList* pLineDiff2, int line,
int whatChanged, int whatChanged2, int srcLineIdx,
- int wrapLineOffset, int wrapLineLength, bool bWrapLine, const QRect& invalidRect, int deviceWidth
+ int wrapLineOffset, int wrapLineLength, bool bWrapLine, const TQRect& invalidRect, int deviceWidth
);
- void draw( MyPainter& p, const QRect& invalidRect, int deviceWidth, int beginLine, int endLine );
+ void draw( MyPainter& p, const TQRect& invalidRect, int deviceWidth, int beginLine, int endLine );
- QStatusBar* m_pStatusBar;
+ TQStatusBar* m_pStatusBar;
Selection m_selection;
@@ -129,26 +129,26 @@ public:
int convertLineOnScreenToLineInSource( int lineOnScreen, e_CoordType coordType, bool bFirstLine );
bool m_bSelectionInProgress;
- QPoint m_lastKnownMousePos;
+ TQPoint m_lastKnownMousePos;
};
DiffTextWindow::DiffTextWindow(
DiffTextWindowFrame* pParent,
- QStatusBar* pStatusBar,
+ TQStatusBar* pStatusBar,
OptionDialog* pOptionDialog,
int winIdx
)
- : QWidget(pParent, 0, Qt::WResizeNoErase | Qt::WRepaintNoErase)
+ : TQWidget(pParent, 0, TQt::WResizeNoErase | TQt::WRepaintNoErase)
{
d = new DiffTextWindowData(this);
d->m_pDiffTextWindowFrame = pParent;
- setFocusPolicy( ClickFocus );
+ setFocusPolicy( TQ_ClickFocus );
setAcceptDrops( true );
d->m_pOptionDialog = pOptionDialog;
init( 0, 0, 0, 0, 0, false );
- setMinimumSize(QSize(20,20));
+ setMinimumSize(TQSize(20,20));
d->m_pStatusBar = pStatusBar;
d->m_bPaintingAllowed = true;
@@ -164,7 +164,7 @@ DiffTextWindow::~DiffTextWindow()
}
void DiffTextWindow::init(
- const QString& filename,
+ const TQString& filename,
const LineData* pLineData,
int size,
const Diff3LineVector* pDiff3LineVector,
@@ -218,9 +218,9 @@ void DiffTextWindow::setPaintingAllowed( bool bAllowPainting )
}
}
-void DiffTextWindow::dragEnterEvent( QDragEnterEvent* e )
+void DiffTextWindow::dragEnterEvent( TQDragEnterEvent* e )
{
- e->accept( QUriDrag::canDecode(e) || QTextDrag::canDecode(e) );
+ e->accept( TQUriDrag::canDecode(e) || TQTextDrag::canDecode(e) );
// Note that the corresponding drop is handled in KDiff3App::eventFilter().
}
@@ -244,7 +244,7 @@ void DiffTextWindow::setFirstLine(int firstLine)
}
else
{
- QWidget::scroll( 0, deltaY );
+ TQWidget::scroll( 0, deltaY );
}
d->m_pDiffTextWindowFrame->setFirstLine( d->m_firstLine );
}
@@ -265,12 +265,12 @@ void DiffTextWindow::setFirstColumn(int firstCol)
d->m_firstColumn = newFirstColumn;
- QRect r( xOffset, 0, width()-xOffset, height() );
+ TQRect r( xOffset, 0, width()-xOffset, height() );
if ( d->m_pOptionDialog->m_bRightToLeftLanguage )
{
deltaX = -deltaX;
- r = QRect( width()-1-xOffset, 0, -(width()-xOffset), height() ).normalize();
+ r = TQRect( width()-1-xOffset, 0, -(width()-xOffset), height() ).normalize();
}
if ( d->m_bSelectionInProgress && d->m_selection.firstLine != -1 )
@@ -282,7 +282,7 @@ void DiffTextWindow::setFirstColumn(int firstCol)
}
else
{
- QWidget::scroll( deltaX, 0, r );
+ TQWidget::scroll( deltaX, 0, r );
}
}
@@ -378,7 +378,7 @@ void DiffTextWindow::showStatusLine(int line )
{
int l = pD3l->getLineInFile( d->m_winIdx );
- QString s;
+ TQString s;
if ( l!=-1 )
s.sprintf("File %s: Line %d", d->m_filename.ascii(), l+1 );
else
@@ -390,13 +390,13 @@ void DiffTextWindow::showStatusLine(int line )
}
}
-void DiffTextWindow::focusInEvent(QFocusEvent* e)
+void DiffTextWindow::focusInEvent(TQFocusEvent* e)
{
emit gotFocus();
- QWidget::focusInEvent(e);
+ TQWidget::focusInEvent(e);
}
-void DiffTextWindow::mousePressEvent ( QMouseEvent* e )
+void DiffTextWindow::mousePressEvent ( TQMouseEvent* e )
{
if ( e->button() == Qt::LeftButton )
{
@@ -421,15 +421,15 @@ void DiffTextWindow::mousePressEvent ( QMouseEvent* e )
}
}
-bool isCTokenChar( QChar c )
+bool isCTokenChar( TQChar c )
{
return (c=='_') ||
- ( c>='A' && c<='Z' ) || ( c>='a' && c<='z' ) ||
- (c>='0' && c<='9');
+ ( c.unicode()>='A' && c.unicode()<='Z' ) || ( c.unicode()>='a' && c.unicode()<='z' ) ||
+ (c.unicode()>='0' && c.unicode()<='9');
}
/// Calculate where a token starts and ends, given the x-position on screen.
-void calcTokenPos( const QString& s, int posOnScreen, int& pos1, int& pos2, int tabSize )
+void calcTokenPos( const TQString& s, int posOnScreen, int& pos1, int& pos2, int tabSize )
{
// Cursor conversions that consider g_tabSize
int pos = convertToPosInText( s, max2( 0, posOnScreen ), tabSize );
@@ -454,7 +454,7 @@ void calcTokenPos( const QString& s, int posOnScreen, int& pos1, int& pos2, int
}
}
-void DiffTextWindow::mouseDoubleClickEvent( QMouseEvent* e )
+void DiffTextWindow::mouseDoubleClickEvent( TQMouseEvent* e )
{
d->m_bSelectionInProgress = false;
d->m_lastKnownMousePos = e->pos();
@@ -465,7 +465,7 @@ void DiffTextWindow::mouseDoubleClickEvent( QMouseEvent* e )
convertToLinePos( e->x(), e->y(), line, pos );
// Get the string data of the current line
- QString s;
+ TQString s;
if ( d->m_bWordWrap )
{
if ( line<0 || line >= (int)d->m_diff3WrapLineVector.size() )
@@ -495,7 +495,7 @@ void DiffTextWindow::mouseDoubleClickEvent( QMouseEvent* e )
}
}
-void DiffTextWindow::mouseReleaseEvent ( QMouseEvent* e )
+void DiffTextWindow::mouseReleaseEvent ( TQMouseEvent* e )
{
d->m_bSelectionInProgress = false;
d->m_lastKnownMousePos = e->pos();
@@ -514,7 +514,7 @@ void DiffTextWindow::mouseReleaseEvent ( QMouseEvent* e )
inline int sqr(int x){return x*x;}
-void DiffTextWindow::mouseMoveEvent ( QMouseEvent * e )
+void DiffTextWindow::mouseMoveEvent ( TQMouseEvent * e )
{
int line;
int pos;
@@ -528,7 +528,7 @@ void DiffTextWindow::mouseMoveEvent ( QMouseEvent * e )
showStatusLine( line );
// Scroll because mouse moved out of the window
- const QFontMetrics& fm = fontMetrics();
+ const TQFontMetrics& fm = fontMetrics();
int fontWidth = fm.width('W');
int deltaX=0;
int deltaY=0;
@@ -569,7 +569,7 @@ void DiffTextWindowData::myUpdate(int afterMilliSecs)
m_delayedDrawTimer = m_pDiffTextWindow->startTimer( afterMilliSecs );
}
-void DiffTextWindow::timerEvent(QTimerEvent*)
+void DiffTextWindow::timerEvent(TQTimerEvent*)
{
killTimer(d->m_delayedDrawTimer);
d->m_delayedDrawTimer = 0;
@@ -597,7 +597,7 @@ void DiffTextWindow::timerEvent(QTimerEvent*)
if ( y1<height() && y2>0 )
{
- QRect invalidRect = QRect( 0, y1, width(), y2-y1 );
+ TQRect invalidRect = TQRect( 0, y1, width(), y2-y1 );
update( invalidRect );
}
}
@@ -622,7 +622,7 @@ void DiffTextWindow::resetSelection()
void DiffTextWindow::convertToLinePos( int x, int y, int& line, int& pos )
{
- const QFontMetrics& fm = fontMetrics();
+ const TQFontMetrics& fm = fontMetrics();
int fontHeight = fm.height();
int fontWidth = fm.width('W');
int xOffset = ( d->leftInfoWidth() - d->m_firstColumn ) * fontWidth;
@@ -715,14 +715,14 @@ void DiffTextWindowData::writeLine(
int wrapLineOffset,
int wrapLineLength,
bool bWrapLine,
- const QRect& invalidRect,
+ const TQRect& invalidRect,
int deviceWidth
)
{
- QFont normalFont = p.font();
- QFont diffFont = normalFont;
+ TQFont normalFont = p.font();
+ TQFont diffFont = normalFont;
diffFont.setItalic( m_pOptionDialog->m_bItalicForDeltas );
- const QFontMetrics& fm = p.fontMetrics();
+ const TQFontMetrics& fm = p.fontMetrics();
int fontHeight = fm.height();
int fontAscent = fm.ascent();
int fontDescent = fm.descent();
@@ -731,7 +731,7 @@ void DiffTextWindowData::writeLine(
int xOffset = (leftInfoWidth() - m_firstColumn)*fontWidth;
int yOffset = (line-m_firstLine) * fontHeight;
- QRect lineRect( 0, yOffset, deviceWidth, fontHeight );
+ TQRect lineRect( 0, yOffset, deviceWidth, fontHeight );
if ( ! invalidRect.intersects( lineRect ) )
{
return;
@@ -741,8 +741,8 @@ void DiffTextWindowData::writeLine(
int fastSelectorLine2 = m_pDiffTextWindow->convertDiff3LineIdxToLine(m_fastSelectorLine1+m_fastSelectorNofLines)-1;
bool bFastSelectionRange = (line>=fastSelectorLine1 && line<= fastSelectorLine2 );
- QColor bgColor = m_pOptionDialog->m_bgColor;
- QColor diffBgColor = m_pOptionDialog->m_diffBgColor;
+ TQColor bgColor = m_pOptionDialog->m_bgColor;
+ TQColor diffBgColor = m_pOptionDialog->m_diffBgColor;
if ( bFastSelectionRange )
{
@@ -757,7 +757,7 @@ void DiffTextWindowData::writeLine(
if ( pLineDiff1 != 0 ) changed |= 1;
if ( pLineDiff2 != 0 ) changed |= 2;
- QColor c = m_pOptionDialog->m_fgColor;
+ TQColor c = m_pOptionDialog->m_fgColor;
if ( changed == 2 ) {
c = m_cDiff2;
} else if ( changed == 1 ) {
@@ -787,11 +787,11 @@ void DiffTextWindowData::writeLine(
}
}
- QString s=" ";
+ TQString s=" ";
// Convert tabs
int outPos = 0;
- QString lineString( pld->pLine, pld->size );
+ TQString lineString( pld->pLine, pld->size );
int lineLength = m_bWordWrap ? wrapLineOffset+wrapLineLength : lineString.length();
for( i=wrapLineOffset; i<lineLength; ++i )
@@ -808,7 +808,7 @@ void DiffTextWindowData::writeLine(
s[0] = lineString[i];
}
- QColor c = m_pOptionDialog->m_fgColor;
+ TQColor c = m_pOptionDialog->m_fgColor;
int cchanged = charChanged[i] | whatChanged;
if ( cchanged == 2 ) {
@@ -825,9 +825,9 @@ void DiffTextWindowData::writeLine(
c = m_pOptionDialog->m_fgColor;
}
- QRect outRect( xOffset + fontWidth*outPos, yOffset, fontWidth*spaces, fontHeight );
+ TQRect outRect( xOffset + fontWidth*outPos, yOffset, fontWidth*spaces, fontHeight );
if ( m_pOptionDialog->m_bRightToLeftLanguage )
- outRect = QRect( deviceWidth-1-(xOffset + fontWidth*outPos), yOffset, -fontWidth*spaces, fontHeight ).normalize();
+ outRect = TQRect( deviceWidth-1-(xOffset + fontWidth*outPos), yOffset, -fontWidth*spaces, fontHeight ).normalize();
if ( invalidRect.intersects( outRect ) )
{
if( !m_selection.within( line, outPos ) )
@@ -835,7 +835,7 @@ void DiffTextWindowData::writeLine(
if( c!=m_pOptionDialog->m_fgColor )
{
- QColor lightc = diffBgColor;
+ TQColor lightc = diffBgColor;
p.fillRect( xOffset + fontWidth*outPos, yOffset,
fontWidth*spaces, fontHeight, lightc );
p.setFont(diffFont);
@@ -860,9 +860,9 @@ void DiffTextWindowData::writeLine(
else
{
p.fillRect( xOffset + fontWidth*outPos, yOffset,
- fontWidth*(spaces), fontHeight, m_pDiffTextWindow->colorGroup().highlight() );
+ fontWidth*(spaces), fontHeight, m_pDiffTextWindow->tqcolorGroup().highlight() );
- p.setPen( m_pDiffTextWindow->colorGroup().highlightedText() );
+ p.setPen( m_pDiffTextWindow->tqcolorGroup().highlightedText() );
p.drawText( xOffset + fontWidth*outPos, yOffset + fontAscent, s );
m_selection.bSelectionContainsData = true;
@@ -875,7 +875,7 @@ void DiffTextWindowData::writeLine(
if( m_selection.lineWithin( line ) && m_selection.lineWithin( line+1 ) )
{
p.fillRect( xOffset + fontWidth*outPos, yOffset,
- deviceWidth, fontHeight, m_pDiffTextWindow->colorGroup().highlight() );
+ deviceWidth, fontHeight, m_pDiffTextWindow->tqcolorGroup().highlight() );
}
}
@@ -888,16 +888,16 @@ void DiffTextWindowData::writeLine(
{
if ( m_pOptionDialog->m_bShowLineNumbers && !bWrapLine )
{
- QString num;
+ TQString num;
num.sprintf( "%0*d", m_lineNumberWidth, srcLineIdx+1);
p.drawText( 0, yOffset + fontAscent, num );
//p.drawLine( xLeft -1, yOffset, xLeft -1, yOffset+fontHeight-1 );
}
if ( !bWrapLine || wrapLineLength>0 )
{
- p.setPen( QPen( m_pOptionDialog->m_fgColor, 0, bWrapLine ? Qt::DotLine : Qt::SolidLine) );
+ p.setPen( TQPen( m_pOptionDialog->m_fgColor, 0, bWrapLine ? TQt::DotLine : TQt::SolidLine) );
p.drawLine( xOffset +1, yOffset, xOffset +1, yOffset+fontHeight-1 );
- p.setPen( QPen( m_pOptionDialog->m_fgColor, 0, Qt::SolidLine) );
+ p.setPen( TQPen( m_pOptionDialog->m_fgColor, 0, TQt::SolidLine) );
}
}
if ( c!=m_pOptionDialog->m_fgColor && whatChanged2==0 )//&& whatChanged==0 )
@@ -905,7 +905,7 @@ void DiffTextWindowData::writeLine(
if ( m_pOptionDialog->m_bShowWhiteSpace )
{
p.setBrushOrigin(0,0);
- p.fillRect( xLeft, yOffset, fontWidth*2-1, fontHeight, QBrush(c,Qt::Dense5Pattern) );
+ p.fillRect( xLeft, yOffset, fontWidth*2-1, fontHeight, TQBrush(c,TQt::Dense5Pattern) );
}
}
else
@@ -936,13 +936,13 @@ void DiffTextWindowData::writeLine(
}
}
-void DiffTextWindow::paintEvent( QPaintEvent* e )
+void DiffTextWindow::paintEvent( TQPaintEvent* e )
{
if ( d->m_pDiff3LineVector==0 || ! d->m_bPaintingAllowed ||
( d->m_diff3WrapLineVector.empty() && d->m_bWordWrap ) )
return;
- QRect invalidRect = e->rect();
+ TQRect invalidRect = e->rect();
if ( invalidRect.isEmpty() )
return;
@@ -952,28 +952,28 @@ void DiffTextWindow::paintEvent( QPaintEvent* e )
int endLine = min2( d->m_firstLine + getNofVisibleLines()+2, getNofLines() );
//if ( invalidRect.size()==size() )
- { // double buffering, obsolete with Qt4
- QPainter painter(this); // Remove for Qt4
- QPixmap pixmap( invalidRect.size() );// Remove for Qt4
+ { // double buffering, obsolete with TQt4
+ TQPainter painter(this); // Remove for TQt4
+ TQPixmap pixmap( invalidRect.size() );// Remove for TQt4
- MyPainter p( &pixmap, d->m_pOptionDialog->m_bRightToLeftLanguage, width(), fontMetrics().width('W') ); // For Qt4 change pixmap to this
+ MyPainter p( TQT_TQPAINTDEVICE(&pixmap), d->m_pOptionDialog->m_bRightToLeftLanguage, width(), fontMetrics().width('W') ); // For TQt4 change pixmap to this
- p.translate( -invalidRect.x(), -invalidRect.y() );// Remove for Qt4
+ p.translate( -invalidRect.x(), -invalidRect.y() );// Remove for TQt4
p.setFont( font() );
- p.QPainter::fillRect( invalidRect, d->m_pOptionDialog->m_bgColor );
+ p.TQPainter::fillRect( invalidRect, d->m_pOptionDialog->m_bgColor );
d->draw( p, invalidRect, width(), d->m_firstLine, endLine );
// p.drawLine( m_invalidRect.x(), m_invalidRect.y(), m_invalidRect.right(), m_invalidRect.bottom() ); // For test only
p.end();
- painter.drawPixmap( invalidRect.x(), invalidRect.y(), pixmap );// Remove for Qt4
+ painter.drawPixmap( invalidRect.x(), invalidRect.y(), pixmap );// Remove for TQt4
}
// else
// { // no double buffering
// MyPainter p( this, d->m_pOptionDialog->m_bRightToLeftLanguage, width(), fontMetrics().width('W') );
// p.setFont( font() );
-// p.QPainter::fillRect( invalidRect, d->m_pOptionDialog->m_bgColor );
+// p.TQPainter::fillRect( invalidRect, d->m_pOptionDialog->m_bgColor );
// d->draw( p, invalidRect, width(), d->m_firstLine, endLine );
// }
@@ -988,7 +988,7 @@ void DiffTextWindow::paintEvent( QPaintEvent* e )
emit newSelection();
}
-void DiffTextWindow::print( MyPainter& p, const QRect&, int firstLine, int nofLinesPerPage )
+void DiffTextWindow::print( MyPainter& p, const TQRect&, int firstLine, int nofLinesPerPage )
{
if ( d->m_pDiff3LineVector==0 || ! d->m_bPaintingAllowed ||
( d->m_diff3WrapLineVector.empty() && d->m_bWordWrap ) )
@@ -997,15 +997,15 @@ void DiffTextWindow::print( MyPainter& p, const QRect&, int firstLine, int nofLi
// MyPainter p( this, d->m_pOptionDialog->m_bRightToLeftLanguage, width(), fontMetrics().width('W') );
int oldFirstLine = d->m_firstLine;
d->m_firstLine = firstLine;
- QRect invalidRect = QRect(0,0,QCOORD_MAX,QCOORD_MAX);
- QColor bgColor = d->m_pOptionDialog->m_bgColor;
- d->m_pOptionDialog->m_bgColor = Qt::white;
+ TQRect invalidRect = TQRect(0,0,TQCOORD_MAX,TQCOORD_MAX);
+ TQColor bgColor = d->m_pOptionDialog->m_bgColor;
+ d->m_pOptionDialog->m_bgColor = TQt::white;
d->draw( p, invalidRect, p.window().width(), firstLine, min2(firstLine+nofLinesPerPage,getNofLines()) );
d->m_pOptionDialog->m_bgColor = bgColor;
d->m_firstLine = oldFirstLine;
}
-void DiffTextWindowData::draw( MyPainter& p, const QRect& invalidRect, int deviceWidth, int beginLine, int endLine )
+void DiffTextWindowData::draw( MyPainter& p, const TQRect& invalidRect, int deviceWidth, int beginLine, int endLine )
{
m_lineNumberWidth = m_pOptionDialog->m_bShowLineNumbers ? (int)log10((double)m_size)+1 : 0;
@@ -1058,7 +1058,7 @@ void DiffTextWindowData::draw( MyPainter& p, const QRect& invalidRect, int devic
getLineInfo( *d3l, srcLineIdx, pFineDiff1, pFineDiff2, changed, changed2 );
writeLine(
- p, // QPainter
+ p, // TQPainter
srcLineIdx == -1 ? 0 : &m_pLineData[srcLineIdx], // Text in this line
pFineDiff1,
pFineDiff2,
@@ -1075,10 +1075,10 @@ void DiffTextWindowData::draw( MyPainter& p, const QRect& invalidRect, int devic
}
}
-QString DiffTextWindowData::getString( int d3lIdx )
+TQString DiffTextWindowData::getString( int d3lIdx )
{
if ( d3lIdx<0 || d3lIdx>=(int)m_pDiff3LineVector->size() )
- return QString();
+ return TQString();
const Diff3Line* d3l = (*m_pDiff3LineVector)[d3lIdx];
DiffList* pFineDiff1;
DiffList* pFineDiff2;
@@ -1087,16 +1087,16 @@ QString DiffTextWindowData::getString( int d3lIdx )
int lineIdx;
getLineInfo( *d3l, lineIdx, pFineDiff1, pFineDiff2, changed, changed2 );
- if (lineIdx==-1) return QString();
+ if (lineIdx==-1) return TQString();
else
{
const LineData* ld = &m_pLineData[lineIdx];
- return QString( ld->pLine, ld->size );
+ return TQString( ld->pLine, ld->size );
}
- return QString();
+ return TQString();
}
-QString DiffTextWindowData::getLineString( int line )
+TQString DiffTextWindowData::getLineString( int line )
{
if ( m_bWordWrap )
{
@@ -1150,19 +1150,19 @@ void DiffTextWindowData::getLineInfo(
-void DiffTextWindow::resizeEvent( QResizeEvent* e )
+void DiffTextWindow::resizeEvent( TQResizeEvent* e )
{
- QSize s = e->size();
- QFontMetrics fm = fontMetrics();
+ TQSize s = e->size();
+ TQFontMetrics fm = fontMetrics();
int visibleLines = s.height()/fm.height()-2;
int visibleColumns = s.width()/fm.width('W') - d->leftInfoWidth();
emit resizeSignal( visibleColumns, visibleLines );
- QWidget::resizeEvent(e);
+ TQWidget::resizeEvent(e);
}
int DiffTextWindow::getNofVisibleLines()
{
- QFontMetrics fm = fontMetrics();
+ TQFontMetrics fm = fontMetrics();
int fmh = fm.height();
int h = height();
return h/fmh -1;//height()/fm.height()-2;
@@ -1170,13 +1170,13 @@ int DiffTextWindow::getNofVisibleLines()
int DiffTextWindow::getNofVisibleColumns()
{
- QFontMetrics fm = fontMetrics();
+ TQFontMetrics fm = fontMetrics();
return width()/fm.width('W') - d->leftInfoWidth();
}
-QString DiffTextWindow::getSelection()
+TQString DiffTextWindow::getSelection()
{
- QString selectionString;
+ TQString selectionString;
int line=0;
int lineIdx=0;
@@ -1193,9 +1193,9 @@ QString DiffTextWindow::getSelection()
if( lineIdx != -1 )
{
- const QChar* pLine = d->m_pLineData[lineIdx].pLine;
+ const TQChar* pLine = d->m_pLineData[lineIdx].pLine;
int size = d->m_pLineData[lineIdx].size;
- QString lineString = QString( pLine, size );
+ TQString lineString = TQString( pLine, size );
if ( d->m_bWordWrap )
{
@@ -1238,7 +1238,7 @@ QString DiffTextWindow::getSelection()
return selectionString;
}
-bool DiffTextWindow::findString( const QString& s, int& d3vLine, int& posInLine, bool bDirDown, bool bCaseSensitive )
+bool DiffTextWindow::findString( const TQString& s, int& d3vLine, int& posInLine, bool bDirDown, bool bCaseSensitive )
{
int it = d3vLine;
int endIt = bDirDown ? (int)d->m_pDiff3LineVector->size() : -1;
@@ -1247,10 +1247,10 @@ bool DiffTextWindow::findString( const QString& s, int& d3vLine, int& posInLine,
for( ; it!=endIt; it+=step )
{
- QString line = d->getString( it );
+ TQString line = d->getString( it );
if ( !line.isEmpty() )
{
- int pos = line.find( s, startPos, bCaseSensitive );
+ int pos = line.tqfind( s, startPos, bCaseSensitive );
if ( pos != -1 )
{
d3vLine = it;
@@ -1324,7 +1324,7 @@ void DiffTextWindow::setSelection( int firstLine, int startPos, int lastLine, in
if ( d->m_bWordWrap && d->m_pDiff3LineVector!=0 )
{
- QString s1 = d->getString(firstLine);
+ TQString s1 = d->getString(firstLine);
int firstWrapLine = convertDiff3LineIdxToLine(firstLine);
int wrapStartPos = startPos;
while ( wrapStartPos > d->m_diff3WrapLineVector[firstWrapLine].wrapLineLength )
@@ -1334,7 +1334,7 @@ void DiffTextWindow::setSelection( int firstLine, int startPos, int lastLine, in
++firstWrapLine;
}
- QString s2 = d->getString(lastLine);
+ TQString s2 = d->getString(lastLine);
int lastWrapLine = convertDiff3LineIdxToLine(lastLine);
int wrapEndPos = endPos;
while ( wrapEndPos > d->m_diff3WrapLineVector[lastWrapLine].wrapLineLength )
@@ -1396,7 +1396,7 @@ void DiffTextWindow::getSelectionRange( int* pFirstLine, int* pLastLine, e_Coord
// Returns the number of wrapped lines
// if pWrappedLines != 0 then the stringlist will contain the wrapped lines.
-int wordWrap( const QString& origLine, int nofColumns, Diff3WrapLine* pDiff3WrapLine )
+int wordWrap( const TQString& origLine, int nofColumns, Diff3WrapLine* pDiff3WrapLine )
{
if (nofColumns<=0)
nofColumns = 1;
@@ -1427,7 +1427,7 @@ int wordWrap( const QString& origLine, int nofColumns, Diff3WrapLine* pDiff3Wrap
}
else
{
- int wsPos = max2( origLine.findRev( ' ', wrapPos ), origLine.findRev( '\t', wrapPos ) );
+ int wsPos = max2( origLine.tqfindRev( ' ', wrapPos ), origLine.tqfindRev( '\t', wrapPos ) );
if ( wsPos > pos )
{
@@ -1460,7 +1460,7 @@ void DiffTextWindow::convertSelectionToD3LCoords()
// convert the d->m_selection to unwrapped coordinates: Later restore to new coords
int firstD3LIdx, firstD3LPos;
- QString s = d->getLineString( d->m_selection.beginLine() );
+ TQString s = d->getLineString( d->m_selection.beginLine() );
int firstPosInText = convertToPosInText( s, d->m_selection.beginPos(), d->m_pOptionDialog->m_tabSize );
convertLineCoordsToD3LCoords( d->m_selection.beginLine(), firstPosInText, firstD3LIdx, firstD3LPos );
@@ -1498,7 +1498,7 @@ void DiffTextWindow::recalcWordWrap( bool bWordWrap, int wrapLineVectorSize, int
int size = d->m_pDiff3LineVector->size();
for( i=0; i<size; ++i )
{
- QString s = d->getString( i );
+ TQString s = d->getString( i );
int linesNeeded = wordWrap( s, nofVisibleColumns, wrapLineVectorSize==0 ? 0 : &d->m_diff3WrapLineVector[wrapLineIdx] );
Diff3Line& d3l = *(*d->m_pDiff3LineVector)[i];
if ( d3l.linesNeededForDisplay<linesNeeded )
@@ -1561,31 +1561,31 @@ class DiffTextWindowFrameData
{
public:
DiffTextWindow* m_pDiffTextWindow;
- QLineEdit* m_pFileSelection;
- QPushButton* m_pBrowseButton;
+ TQLineEdit* m_pFileSelection;
+ TQPushButton* m_pBrowseButton;
OptionDialog* m_pOptionDialog;
- QLabel* m_pLabel;
- QLabel* m_pTopLine;
- QWidget* m_pTopLineWidget;
+ TQLabel* m_pLabel;
+ TQLabel* m_pTopLine;
+ TQWidget* m_pTopLineWidget;
};
-DiffTextWindowFrame::DiffTextWindowFrame( QWidget* pParent, QStatusBar* pStatusBar, OptionDialog* pOptionDialog, int winIdx )
- : QWidget( pParent )
+DiffTextWindowFrame::DiffTextWindowFrame( TQWidget* pParent, TQStatusBar* pStatusBar, OptionDialog* pOptionDialog, int winIdx )
+ : TQWidget( pParent )
{
d = new DiffTextWindowFrameData;
d->m_pOptionDialog = pOptionDialog;
- d->m_pTopLineWidget = new QWidget(this);
- d->m_pFileSelection = new QLineEdit(d->m_pTopLineWidget);
- d->m_pBrowseButton = new QPushButton( "...",d->m_pTopLineWidget );
+ d->m_pTopLineWidget = new TQWidget(this);
+ d->m_pFileSelection = new TQLineEdit(d->m_pTopLineWidget);
+ d->m_pBrowseButton = new TQPushButton( "...",d->m_pTopLineWidget );
d->m_pBrowseButton->setFixedWidth( 30 );
- connect(d->m_pBrowseButton,SIGNAL(clicked()), this, SLOT(slotBrowseButtonClicked()));
- connect(d->m_pFileSelection,SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));
+ connect(d->m_pBrowseButton,TQT_SIGNAL(clicked()), this, TQT_SLOT(slotBrowseButtonClicked()));
+ connect(d->m_pFileSelection,TQT_SIGNAL(returnPressed()), this, TQT_SLOT(slotReturnPressed()));
- d->m_pLabel = new QLabel("A:",d->m_pTopLineWidget);
- d->m_pTopLine = new QLabel(d->m_pTopLineWidget);
+ d->m_pLabel = new TQLabel("A:",d->m_pTopLineWidget);
+ d->m_pTopLine = new TQLabel(d->m_pTopLineWidget);
d->m_pDiffTextWindow = 0;
d->m_pDiffTextWindow = new DiffTextWindow( this, pStatusBar, pOptionDialog, winIdx );
- QHBoxLayout* pHL = new QHBoxLayout(d->m_pTopLineWidget);
+ TQHBoxLayout* pHL = new TQHBoxLayout(d->m_pTopLineWidget);
pHL->setMargin(2);
pHL->setSpacing(2);
@@ -1594,7 +1594,7 @@ DiffTextWindowFrame::DiffTextWindowFrame( QWidget* pParent, QStatusBar* pStatusB
pHL->addWidget( d->m_pBrowseButton, 0 );
pHL->addWidget( d->m_pTopLine, 0 );
- QVBoxLayout* pVL = new QVBoxLayout( this, 0, 0 );
+ TQVBoxLayout* pVL = new TQVBoxLayout( this, 0, 0 );
pVL->addWidget( d->m_pTopLineWidget, 0 );
pVL->addWidget( d->m_pDiffTextWindow, 1 );
@@ -1614,9 +1614,9 @@ void DiffTextWindowFrame::init()
DiffTextWindow* pDTW = d->m_pDiffTextWindow;
if ( pDTW )
{
- QString s = pDTW->d->m_filename ;
- d->m_pFileSelection->setText( QDir::convertSeparators(s) );
- QString winId = pDTW->d->m_winIdx==1 ?
+ TQString s = pDTW->d->m_filename ;
+ d->m_pFileSelection->setText( TQDir::convertSeparators(s) );
+ TQString winId = pDTW->d->m_winIdx==1 ?
( pDTW->d->m_bTriple?"A (Base)":"A") :
( pDTW->d->m_winIdx==2 ? "B" : "C" );
d->m_pLabel->setText( winId + ":" );
@@ -1641,22 +1641,22 @@ void DiffTextWindowFrame::setFirstLine( int firstLine )
DiffTextWindow* pDTW = d->m_pDiffTextWindow;
if ( pDTW && pDTW->d->m_pDiff3LineVector )
{
- QString s= i18n("Top line");
+ TQString s= i18n("Top line");
int lineNumberWidth = (int)log10((double)pDTW->d->m_size)+1;
int l=pDTW->calcTopLineInFile(firstLine);
int w = d->m_pTopLine->fontMetrics().width(
- s+" "+QString().fill('0',lineNumberWidth));
+ s+" "+TQString().fill('0',lineNumberWidth));
d->m_pTopLine->setMinimumWidth( w );
if (l==-1)
s = i18n("End");
else
- s += " " + QString::number( l+1 );
+ s += " " + TQString::number( l+1 );
d->m_pTopLine->setText( s );
- d->m_pTopLine->repaint();
+ d->m_pTopLine->tqrepaint();
}
}
@@ -1665,51 +1665,51 @@ DiffTextWindow* DiffTextWindowFrame::getDiffTextWindow()
return d->m_pDiffTextWindow;
}
-bool DiffTextWindowFrame::eventFilter( QObject* o, QEvent* e )
+bool DiffTextWindowFrame::eventFilter( TQObject* o, TQEvent* e )
{
DiffTextWindow* pDTW = d->m_pDiffTextWindow;
- if ( e->type()==QEvent::FocusIn || e->type()==QEvent::FocusOut )
+ if ( e->type()==TQEvent::FocusIn || e->type()==TQEvent::FocusOut )
{
- QColor c1 = d->m_pOptionDialog->m_bgColor;
- QColor c2 = pDTW->d->m_cThis;
- QPalette p = d->m_pTopLineWidget->palette();
- if ( e->type()==QEvent::FocusOut )
+ TQColor c1 = d->m_pOptionDialog->m_bgColor;
+ TQColor c2 = pDTW->d->m_cThis;
+ TQPalette p = d->m_pTopLineWidget->palette();
+ if ( e->type()==TQEvent::FocusOut )
std::swap(c1,c2);
- p.setColor(QColorGroup::Background, c2);
+ p.setColor(TQColorGroup::Background, c2);
d->m_pTopLineWidget->setPalette( p );
d->m_pBrowseButton->setPalette( p );
d->m_pFileSelection->setPalette( p );
- p.setColor(QColorGroup::Foreground, c1);
+ p.setColor(TQColorGroup::Foreground, c1);
d->m_pLabel->setPalette( p );
d->m_pTopLine->setPalette( p );
}
- if (o == d->m_pFileSelection && e->type()==QEvent::Drop)
+ if (TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(d->m_pFileSelection) && e->type()==TQEvent::Drop)
{
- QDropEvent* d = static_cast<QDropEvent*>(e);
+ TQDropEvent* d = static_cast<TQDropEvent*>(e);
- if ( QUriDrag::canDecode( d ) )
+ if ( TQUriDrag::canDecode( d ) )
{
- QStringList lst;
- QUriDrag::decodeLocalFiles( d, lst );
+ TQStringList lst;
+ TQUriDrag::decodeLocalFiles( d, lst );
if ( lst.count() > 0 )
{
- static_cast<QLineEdit*>(o)->setText( lst[0] );
- static_cast<QLineEdit*>(o)->setFocus();
+ static_cast<TQLineEdit*>(TQT_TQWIDGET(o))->setText( lst[0] );
+ static_cast<TQLineEdit*>(TQT_TQWIDGET(o))->setFocus();
emit fileNameChanged( lst[0], pDTW->d->m_winIdx );
return true;
}
}
- /* The following lines work for Qt>4.1 but not for 4.0.x*/
+ /* The following lines work for TQt>4.1 but not for 4.0.x*/
/*if ( d->mimeData()->hasUrls() )
{
- QList<QUrl> lst = d->mimeData()->urls();
+ TQList<TQUrl> lst = d->mimeData()->urls();
if ( !lst.empty() )
{
- static_cast<QLineEdit*>(o)->setText( lst[0].toLocalFile() );
- static_cast<QLineEdit*>(o)->setFocus();
+ static_cast<TQLineEdit*>(o)->setText( lst[0].toLocalFile() );
+ static_cast<TQLineEdit*>(o)->setFocus();
emit fileNameChanged( lst[0], pDTW->d->m_winIdx );
return true;
}
@@ -1729,7 +1729,7 @@ void DiffTextWindowFrame::slotReturnPressed()
void DiffTextWindowFrame::slotBrowseButtonClicked()
{
- QString current = d->m_pFileSelection->text();
+ TQString current = d->m_pFileSelection->text();
KURL newURL = KFileDialog::getOpenURL( current, 0, this);
if ( !newURL.isEmpty() )
@@ -1739,13 +1739,13 @@ void DiffTextWindowFrame::slotBrowseButtonClicked()
}
}
-QCString encodeString( const QString& s )
+TQCString encodeString( const TQString& s )
{
- QTextCodec* c = QTextCodec::codecForLocale();
+ TQTextCodec* c = TQTextCodec::codecForLocale();
if (c!=0)
return c->fromUnicode( s );
else
- return QCString( s.latin1() );
+ return TQCString( s.latin1() );
}
#include "difftextwindow.moc"