mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
DocDiff application: finish display of differences
This commit is contained in:
@ -305,6 +305,8 @@ void DifferencesDrawInterface::drawPage(QPainter* painter,
|
||||
const pdf::PDFInteger leftPageIndex = m_mapper->getLeftPageIndex(pageIndex);
|
||||
const pdf::PDFInteger rightPageIndex = m_mapper->getRightPageIndex(pageIndex);
|
||||
|
||||
std::optional<size_t> pageMoveIndex;
|
||||
|
||||
if (leftPageIndex != -1)
|
||||
{
|
||||
for (size_t i = 0; i < differencesCount; ++i)
|
||||
@ -320,6 +322,11 @@ void DifferencesDrawInterface::drawPage(QPainter* painter,
|
||||
drawMarker(painter, pagePointToDevicePointMatrix, item.second, color, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_diffResult->isPageMoveAddRemoveDifference(i) && m_diffResult->getLeftPage(i) == leftPageIndex)
|
||||
{
|
||||
pageMoveIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,8 +345,41 @@ void DifferencesDrawInterface::drawPage(QPainter* painter,
|
||||
drawMarker(painter, pagePointToDevicePointMatrix, item.second, color, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_diffResult->isPageMoveAddRemoveDifference(i) && m_diffResult->getRightPage(i) == rightPageIndex)
|
||||
{
|
||||
pageMoveIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pageMoveIndex)
|
||||
{
|
||||
QString text;
|
||||
|
||||
switch (m_diffResult->getType(*pageMoveIndex))
|
||||
{
|
||||
case pdf::PDFDiffResult::Type::PageAdded:
|
||||
text = " + ";
|
||||
break;
|
||||
|
||||
case pdf::PDFDiffResult::Type::PageRemoved:
|
||||
text = " - ";
|
||||
break;
|
||||
|
||||
case pdf::PDFDiffResult::Type::PageMoved:
|
||||
text = QString("%1🠖%2").arg(m_diffResult->getLeftPage(*pageMoveIndex) + 1).arg(m_diffResult->getRightPage(*pageMoveIndex) + 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
|
||||
QColor color = getColorForIndex(*pageMoveIndex);
|
||||
QPointF targetPoint = pagePointToDevicePointMatrix.map(QPointF(5, 5));
|
||||
pdf::PDFPainterHelper::drawBubble(painter, targetPoint.toPoint(), color, text, Qt::AlignRight | Qt::AlignTop);
|
||||
}
|
||||
}
|
||||
|
||||
QColor DifferencesDrawInterface::getColorForIndex(size_t index) const
|
||||
|
Reference in New Issue
Block a user