From f636ba5ba2df9d34d56b1c85f24c6598fa1cb645 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 27 Jun 2011 05:58:16 +0000 Subject: TQt4 port kdiff3 This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdiff3@1238464 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/diff.h | 92 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'src/diff.h') diff --git a/src/diff.h b/src/diff.h index 1101752..adb43b8 100644 --- a/src/diff.h +++ b/src/diff.h @@ -18,12 +18,12 @@ #ifndef DIFF_H #define DIFF_H -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -48,8 +48,8 @@ typedef std::list DiffList; struct LineData { - const QChar* pLine; - const QChar* pFirstNonWhiteChar; + const TQChar* pLine; + const TQChar* pFirstNonWhiteChar; int size; LineData(){ pLine=0; pFirstNonWhiteChar=0; size=0; /*occurances=0;*/ bContainsPureComment=false; } @@ -132,13 +132,13 @@ struct Diff3Line if ( src == 3 && lineC >= 0 ) return &m_pDiffBufferInfo->m_pLineDataC[lineC]; return 0; } - QString getString( int src ) const + TQString getString( int src ) const { const LineData* pld = getLineData(src); if ( pld ) - return QString( pld->pLine, pld->size); + return TQString( pld->pLine, pld->size); else - return QString(); + return TQString(); } int getLineInFile( int src ) const { @@ -169,10 +169,10 @@ public: typedef std::vector Diff3WrapLineVector; -class TotalDiffStatus +class TotalDifftqStatus { public: - TotalDiffStatus(){ reset(); } + TotalDifftqStatus(){ reset(); } void reset() {bBinaryAEqC=false; bBinaryBEqC=false; bBinaryAEqB=false; bTextAEqC=false; bTextBEqC=false; bTextAEqB=false; nofUnsolvedConflicts=0; nofSolvedConflicts=0; @@ -257,34 +257,34 @@ public: const LineData* getLineDataForDisplay() const; const LineData* getLineDataForDiff() const; - void setFilename(const QString& filename); + void setFilename(const TQString& filename); void setFileAccess( const FileAccess& fa ); //FileAccess& getFileAccess(); - QString getFilename(); - void setAliasName(const QString& a); - QString getAliasName(); + TQString getFilename(); + void setAliasName(const TQString& a); + TQString getAliasName(); bool isEmpty(); // File was set bool hasData(); // Data was readable bool isText(); // is it pure text (vs. binary data) bool isFromBuffer(); // was it set via setData() (vs. setFileAccess() or setFilename()) - void setData( const QString& data ); + void setData( const TQString& data ); bool isValid(); // Either no file is specified or reading was successful - void readAndPreprocess(QTextCodec* pEncoding, bool bAutoDetectUnicode ); - bool saveNormalDataAs( const QString& fileName ); + void readAndPreprocess(TQTextCodec* pEncoding, bool bAutoDetectUnicode ); + bool saveNormalDataAs( const TQString& fileName ); bool isBinaryEqualWith( const SourceData& other ) const; void reset(); - QTextCodec* getEncoding() const { return m_pEncoding; } + TQTextCodec* getEncoding() const { return m_pEncoding; } private: - QTextCodec* detectEncoding( const QString& fileName, QTextCodec* pFallbackCodec ); - QString m_aliasName; + TQTextCodec* detectEncoding( const TQString& fileName, TQTextCodec* pFallbackCodec ); + TQString m_aliasName; FileAccess m_fileAccess; OptionDialog* m_pOptionDialog; - QString m_tempInputFileName; + TQString m_tempInputFileName; struct FileData { @@ -293,19 +293,19 @@ private: const char* m_pBuf; int m_size; int m_vSize; // Nr of lines in m_pBuf1 and size of m_v1, m_dv12 and m_dv13 - QString m_unicodeBuf; + TQString m_tqunicodeBuf; std::vector m_v; bool m_bIsText; - bool readFile( const QString& filename ); - bool writeFile( const QString& filename ); - void preprocess(bool bPreserveCR, QTextCodec* pEncoding ); + bool readFile( const TQString& filename ); + bool writeFile( const TQString& filename ); + void preprocess(bool bPreserveCR, TQTextCodec* pEncoding ); void reset(); void removeComments(); void copyBufFrom( const FileData& src ); }; FileData m_normalData; FileData m_lmppData; - QTextCodec* m_pEncoding; + TQTextCodec* m_pEncoding; }; void calcDiff3LineListTrim( Diff3LineList& d3ll, const LineData* pldA, const LineData* pldB, const LineData* pldC, ManualDiffHelpList* pManualDiffHelpList ); @@ -315,7 +315,7 @@ void calcDiff3LineVector( Diff3LineList& d3ll, Diff3LineVector& d3lv ); void debugLineCheck( Diff3LineList& d3ll, int size, int idx ); -class QStatusBar; +class TQStatusBar; class Selection @@ -365,18 +365,18 @@ public: class OptionDialog; -QCString encodeString( const QString& s ); +TQCString encodeString( const TQString& s ); // Helper class that swaps left and right for some commands. -class MyPainter : public QPainter +class MyPainter : public TQPainter { int m_factor; int m_xOffset; int m_fontWidth; public: - MyPainter(const QPaintDevice* pd, bool bRTL, int width, int fontWidth) - : QPainter(pd) + MyPainter(const TQPaintDevice* pd, bool bRTL, int width, int fontWidth) + : TQPainter(const_cast(TQT_TQPAINTDEVICE_CONST(pd))) { if (bRTL) { @@ -392,23 +392,23 @@ public: } } - void fillRect( int x, int y, int w, int h, const QBrush& b ) + void fillRect( int x, int y, int w, int h, const TQBrush& b ) { if (m_factor==1) - QPainter::fillRect( m_xOffset + x , y, w, h, b ); + TQPainter::fillRect( m_xOffset + x , y, w, h, b ); else - QPainter::fillRect( m_xOffset - x - w, y, w, h, b ); + TQPainter::fillRect( m_xOffset - x - w, y, w, h, b ); } - void drawText( int x, int y, const QString& s, bool bAdapt=false ) + void drawText( int x, int y, const TQString& s, bool bAdapt=false ) { TextDirection td = (m_factor==1 || bAdapt == false) ? LTR : RTL; - QPainter::drawText( m_xOffset-m_fontWidth*s.length() + m_factor*x, y, s, -1, td ); + TQPainter::drawText( m_xOffset-m_fontWidth*s.length() + m_factor*x, y, s, -1, td ); } void drawLine( int x1, int y1, int x2, int y2 ) { - QPainter::drawLine( m_xOffset + m_factor*x1, y1, m_xOffset + m_factor*x2, y2 ); + TQPainter::drawLine( m_xOffset + m_factor*x1, y1, m_xOffset + m_factor*x2, y2 ); } }; @@ -426,7 +426,7 @@ bool equal( const LineData& l1, const LineData& l2, bool bStrict ); -inline bool isWhite( QChar c ) +inline bool isWhite( TQChar c ) { return c==' ' || c=='\t' || c=='\r'; } @@ -449,14 +449,14 @@ extern bool g_bIgnoreTrivialMatches; extern int g_bAutoSolve; // Cursor conversions that consider g_tabSize. -int convertToPosInText( const QString& s, int posOnScreen, int tabSize ); -int convertToPosOnScreen( const QString& s, int posInText, int tabSize ); +int convertToPosInText( const TQString& s, int posOnScreen, int tabSize ); +int convertToPosOnScreen( const TQString& s, int posInText, int tabSize ); enum e_CoordType { eFileCoords, eD3LLineCoords, eWrapCoords }; -void calcTokenPos( const QString&, int posOnScreen, int& pos1, int& pos2, int tabSize ); +void calcTokenPos( const TQString&, int posOnScreen, int& pos1, int& pos2, int tabSize ); -QString calcHistorySortKey( const QString& keyOrder, QRegExp& matchedRegExpr, const QStringList& parenthesesGroupList ); -bool findParenthesesGroups( const QString& s, QStringList& sl ); +TQString calcHistorySortKey( const TQString& keyOrder, TQRegExp& matchedRegExpr, const TQStringList& tqparenthesesGroupList ); +bool findParenthesesGroups( const TQString& s, TQStringList& sl ); #endif -- cgit v1.2.3