Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 706e3427 authored by Joachim Eibl's avatar Joachim Eibl

Development: Use QTextLayout for displaying text.

parent e4ee65f6
......@@ -1629,7 +1629,7 @@ void correctManualDiffAlignment( Diff3LineList& d3ll, ManualDiffHelpList* pManua
for( iMDHL = pManualDiffHelpList->begin(); iMDHL != pManualDiffHelpList->end(); ++iMDHL )
{
Diff3LineList::iterator i3 = d3ll.begin();
int winIdxPreferred = 0;
//int winIdxPreferred = 0;
int missingWinIdx = 0;
int alignedSum = (iMDHL->lineA1<0?0:1) + (iMDHL->lineB1<0?0:1) + (iMDHL->lineC1<0?0:1);
if (alignedSum==2)
......@@ -1638,7 +1638,7 @@ void correctManualDiffAlignment( Diff3LineList& d3ll, ManualDiffHelpList* pManua
// If only A & C are aligned then let B rather be aligned with A
// If only B & C are aligned then let A rather be aligned with B
missingWinIdx = iMDHL->lineA1<0 ? 1 : (iMDHL->lineB1<0 ? 2 : 3 );
winIdxPreferred = missingWinIdx == 1 ? 2 : 1;
//winIdxPreferred = missingWinIdx == 1 ? 2 : 1;
}
else if (alignedSum<=1)
{
......@@ -1788,7 +1788,7 @@ void calcDiff3LineListTrim(
)
{
const Diff3Line d3l_empty;
d3ll.remove( d3l_empty );
d3ll.removeAll( d3l_empty );
Diff3LineList::iterator i3 = d3ll.begin();
Diff3LineList::iterator i3A = d3ll.begin();
......@@ -1996,7 +1996,7 @@ void calcDiff3LineListTrim(
}
}
d3ll.remove( d3l_empty );
d3ll.removeAll( d3l_empty );
/*
......
......@@ -19,8 +19,8 @@
#define DIFF_H
#include <QPainter>
#include <list>
#include <vector>
#include <QLinkedList>
#include <QVector>
#include <assert.h>
#include "common.h"
#include "fileaccess.h"
......@@ -145,10 +145,10 @@ struct Diff3Line
};
class Diff3LineList : public std::list<Diff3Line>
class Diff3LineList : public QLinkedList<Diff3Line>
{
};
class Diff3LineVector : public std::vector<Diff3Line*>
class Diff3LineVector : public QVector<Diff3Line*>
{
};
......@@ -161,7 +161,7 @@ public:
int wrapLineLength;
};
typedef std::vector<Diff3WrapLine> Diff3WrapLineVector;
typedef QVector<Diff3WrapLine> Diff3WrapLineVector;
class TotalDiffStatus
......
This diff is collapsed.
......@@ -58,10 +58,10 @@ public:
int getFirstLine();
int calcTopLineInFile( int firstLine );
int getNofColumns();
int getMaxTextWidth();
int getNofLines();
int getNofVisibleLines();
int getNofVisibleColumns();
int getVisibleTextWidth();
int convertLineToDiff3LineIdx( int line );
int convertDiff3LineIdxToLine( int d3lIdx );
......@@ -89,7 +89,7 @@ signals:
public slots:
void setFirstLine( int line );
void setFirstColumn( int col );
void setHorizScrollOffset( int horizScrollOffset );
void resetSelection();
void setFastSelectorRange( int line1, int nofLines );
......
......@@ -798,7 +798,7 @@ GnuDiff::change* GnuDiff::diff_2_files (struct comparison *cmp)
int f;
//struct change *e, *p;
struct change *script;
int changes;
//int changes;
read_files (cmp->file, files_can_be_treated_as_binary);
......@@ -856,7 +856,7 @@ GnuDiff::change* GnuDiff::diff_2_files (struct comparison *cmp)
script = build_script (cmp->file);
changes = (script != 0);
//changes = (script != 0);
free (cmp->file[0].undiscarded);
......
This diff is collapsed.
......@@ -26,6 +26,7 @@
#include <QStatusBar>
class QPainter;
class QTextLayout;
class Overview : public QWidget
{
......@@ -119,9 +120,9 @@ public:
void choose(int selector);
void chooseGlobal(int selector, bool bConflictsOnly, bool bWhiteSpaceOnly );
int getNofColumns();
int getMaxTextWidth(); // width of longest text line
int getNofLines();
int getNofVisibleColumns();
int getVisibleTextWidth(); // area width - border
int getNofVisibleLines();
QString getSelection();
void resetSelection();
......@@ -139,7 +140,7 @@ public:
Overview::e_OverviewMode getOverviewMode();
public slots:
void setFirstLine(int firstLine);
void setFirstColumn(int firstCol);
void setHorizScrollOffset(int horizScrollOffset);
void slotGoCurrent();
void slotGoTop();
......@@ -234,7 +235,7 @@ private:
void pop_back() { ds(-1); BASE::pop_back(); }
iterator erase( iterator i ) { ds(-1); return BASE::erase(i); }
iterator insert( iterator i, const MergeEditLine& m ) { ds(+1); return BASE::insert(i,m); }
int size(){ if (!m_pTotalSize) m_size = BASE::size(); return m_size; }
int size(){ if (!m_pTotalSize) m_size = (int) BASE::size(); return m_size; }
iterator begin(){return BASE::begin();}
iterator end(){return BASE::end();}
reverse_iterator rbegin(){return BASE::rbegin();}
......@@ -368,7 +369,8 @@ private:
virtual void paintEvent( QPaintEvent* e );
int getTextXOffset();
QVector<QTextLayout::FormatRange> getTextLayoutForLine(int line, const QString& s, QTextLayout& textLayout );
void myUpdate(int afterMilliSecs);
virtual void timerEvent(QTimerEvent*);
void writeLine(
......@@ -389,7 +391,7 @@ private:
QPixmap m_pixmap;
int m_firstLine;
int m_firstColumn;
int m_horizScrollOffset;
int m_nofColumns;
int m_nofLines;
int m_totalSize; //Same as m_nofLines, but calculated differently
......@@ -401,6 +403,7 @@ private:
int m_scrollDeltaX;
int m_scrollDeltaY;
int m_cursorXPos;
int m_cursorXPixelPos;
int m_cursorYPos;
int m_cursorOldXPos;
bool m_bCursorOn; // blinking on and off each second
......
......@@ -115,12 +115,12 @@ void KDiff3App::init( bool bAuto, TotalDiffStatus* pTotalDiffStatus, bool bLoadF
if (pTotalDiffStatus==0)
pTotalDiffStatus = &m_totalDiffStatus;
bool bPreserveCarriageReturn = m_pOptions->m_bPreserveCarriageReturn;
//bool bPreserveCarriageReturn = m_pOptions->m_bPreserveCarriageReturn;
bool bVisibleMergeResultWindow = ! m_outputFilename.isEmpty();
if ( bVisibleMergeResultWindow && bGUI )
{
bPreserveCarriageReturn = false;
//bPreserveCarriageReturn = false;
QString msg;
......@@ -486,16 +486,16 @@ void KDiff3App::init( bool bAuto, TotalDiffStatus* pTotalDiffStatus, bool bLoadF
void KDiff3App::setHScrollBarRange()
{
int w1 = m_pDiffTextWindow1!=0 && m_pDiffTextWindow1->isVisible() ? m_pDiffTextWindow1->getNofColumns() : 0;
int w2 = m_pDiffTextWindow2!=0 && m_pDiffTextWindow2->isVisible() ? m_pDiffTextWindow2->getNofColumns() : 0;
int w3 = m_pDiffTextWindow3!=0 && m_pDiffTextWindow3->isVisible() ? m_pDiffTextWindow3->getNofColumns() : 0;
int w1 = m_pDiffTextWindow1!=0 && m_pDiffTextWindow1->isVisible() ? m_pDiffTextWindow1->getMaxTextWidth() : 0;
int w2 = m_pDiffTextWindow2!=0 && m_pDiffTextWindow2->isVisible() ? m_pDiffTextWindow2->getMaxTextWidth() : 0;
int w3 = m_pDiffTextWindow3!=0 && m_pDiffTextWindow3->isVisible() ? m_pDiffTextWindow3->getMaxTextWidth() : 0;
int wm = m_pMergeResultWindow!=0 && m_pMergeResultWindow->isVisible() ? m_pMergeResultWindow->getNofColumns() : 0;
int wm = m_pMergeResultWindow!=0 && m_pMergeResultWindow->isVisible() ? m_pMergeResultWindow->getMaxTextWidth() : 0;
int v1 = m_pDiffTextWindow1!=0 && m_pDiffTextWindow1->isVisible() ? m_pDiffTextWindow1->getNofVisibleColumns() : 0;
int v2 = m_pDiffTextWindow2!=0 && m_pDiffTextWindow2->isVisible() ? m_pDiffTextWindow2->getNofVisibleColumns() : 0;
int v3 = m_pDiffTextWindow3!=0 && m_pDiffTextWindow3->isVisible() ? m_pDiffTextWindow3->getNofVisibleColumns() : 0;
int vm = m_pMergeResultWindow!=0 && m_pMergeResultWindow->isVisible() ? m_pMergeResultWindow->getNofVisibleColumns() : 0;
int v1 = m_pDiffTextWindow1!=0 && m_pDiffTextWindow1->isVisible() ? m_pDiffTextWindow1->getVisibleTextWidth() : 0;
int v2 = m_pDiffTextWindow2!=0 && m_pDiffTextWindow2->isVisible() ? m_pDiffTextWindow2->getVisibleTextWidth() : 0;
int v3 = m_pDiffTextWindow3!=0 && m_pDiffTextWindow3->isVisible() ? m_pDiffTextWindow3->getVisibleTextWidth() : 0;
int vm = m_pMergeResultWindow!=0 && m_pMergeResultWindow->isVisible() ? m_pMergeResultWindow->getVisibleTextWidth() : 0;
// Find the minimum, but don't consider 0.
int pageStep = 0;
......@@ -709,21 +709,21 @@ void KDiff3App::initView()
connect( m_pDiffVScrollBar, SIGNAL(valueChanged(int)), m_pOverview, SLOT(setFirstLine(int)));
connect( m_pDiffVScrollBar, SIGNAL(valueChanged(int)), m_pDiffTextWindow1, SLOT(setFirstLine(int)));
connect( m_pHScrollBar, SIGNAL(valueChanged2(int)), m_pDiffTextWindow1, SLOT(setFirstColumn(int)));
connect( m_pHScrollBar, SIGNAL(valueChanged2(int)), m_pDiffTextWindow1, SLOT(setHorizScrollOffset(int)));
connect( m_pDiffTextWindow1, SIGNAL(newSelection()), this, SLOT(slotSelectionStart()));
connect( m_pDiffTextWindow1, SIGNAL(selectionEnd()), this, SLOT(slotSelectionEnd()));
connect( m_pDiffTextWindow1, SIGNAL(scroll(int,int)), this, SLOT(scrollDiffTextWindow(int,int)));
m_pDiffTextWindow1->installEventFilter( this );
connect( m_pDiffVScrollBar, SIGNAL(valueChanged(int)), m_pDiffTextWindow2, SLOT(setFirstLine(int)));
connect( m_pHScrollBar, SIGNAL(valueChanged2(int)), m_pDiffTextWindow2, SLOT(setFirstColumn(int)));
connect( m_pHScrollBar, SIGNAL(valueChanged2(int)), m_pDiffTextWindow2, SLOT(setHorizScrollOffset(int)));
connect( m_pDiffTextWindow2, SIGNAL(newSelection()), this, SLOT(slotSelectionStart()));
connect( m_pDiffTextWindow2, SIGNAL(selectionEnd()), this, SLOT(slotSelectionEnd()));
connect( m_pDiffTextWindow2, SIGNAL(scroll(int,int)), this, SLOT(scrollDiffTextWindow(int,int)));
m_pDiffTextWindow2->installEventFilter( this );
connect( m_pDiffVScrollBar, SIGNAL(valueChanged(int)), m_pDiffTextWindow3, SLOT(setFirstLine(int)));
connect( m_pHScrollBar, SIGNAL(valueChanged2(int)), m_pDiffTextWindow3, SLOT(setFirstColumn(int)));
connect( m_pHScrollBar, SIGNAL(valueChanged2(int)), m_pDiffTextWindow3, SLOT(setHorizScrollOffset(int)));
connect( m_pDiffTextWindow3, SIGNAL(newSelection()), this, SLOT(slotSelectionStart()));
connect( m_pDiffTextWindow3, SIGNAL(selectionEnd()), this, SLOT(slotSelectionEnd()));
connect( m_pDiffTextWindow3, SIGNAL(scroll(int,int)), this, SLOT(scrollDiffTextWindow(int,int)));
......@@ -733,7 +733,7 @@ void KDiff3App::initView()
MergeResultWindow* p = m_pMergeResultWindow;
connect( m_pMergeVScrollBar, SIGNAL(valueChanged(int)), p, SLOT(setFirstLine(int)));
connect( m_pHScrollBar, SIGNAL(valueChanged2(int)), p, SLOT(setFirstColumn(int)));
connect( m_pHScrollBar, SIGNAL(valueChanged2(int)), p, SLOT(setHorizScrollOffset(int)));
connect( p, SIGNAL(scroll(int,int)), this, SLOT(scrollMergeResultWindow(int,int)));
connect( p, SIGNAL(sourceMask(int,int)), this, SLOT(sourceMask(int,int)));
connect( p, SIGNAL( resizeSignal() ),this, SLOT(resizeMergeResultWindow()));
......@@ -773,7 +773,7 @@ void KDiff3App::initView()
static int calcManualDiffFirstDiff3LineIdx( const Diff3LineVector& d3lv, const ManualDiffHelpEntry& mdhe )
{
unsigned int i;
int i;
for( i = 0; i<d3lv.size(); ++i )
{
const Diff3Line& d3l = *d3lv[i];
......
......@@ -233,7 +233,7 @@ void ProgressDialog::recalc( bool bUpdate )
}
else
{
std::list<ProgressLevelData>::iterator i = m_progressStack.begin();
QList<ProgressLevelData>::iterator i = m_progressStack.begin();
m_pProgressBar->setValue( int( 1000.0 * ( i->m_dCurrent * (i->m_dRangeMax - i->m_dRangeMin) + i->m_dRangeMin ) ) );
++i;
if ( i!=m_progressStack.end() )
......
......@@ -13,7 +13,7 @@
#include <QDialog>
#include <QTime>
#include <list>
#include <QList>
class KJob;
class QEventLoop;
......@@ -66,10 +66,10 @@ private:
double m_dSubRangeMax;
double m_dSubRangeMin;
};
std::list<ProgressLevelData> m_progressStack;
QList<ProgressLevelData> m_progressStack;
int m_progressDelayTimer;
std::list<QEventLoop*> m_eventLoopStack;
QList<QEventLoop*> m_eventLoopStack;
QProgressBar* m_pProgressBar;
QProgressBar* m_pSubProgressBar;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment