Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 diffpdf (2.1.3.1-2.1) unstable; urgency=medium
 .
   * Non-maintainer upload.
   * Fix FTBFS with CMake 4. (Closes: #1112844)
Author: Adrian Bunk <bunk@debian.org>
Bug-Debian: https://bugs.debian.org/1112844

---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>
Last-Update: 2025-12-15

--- diffpdf-2.1.3.1.orig/CMakeLists.txt
+++ diffpdf-2.1.3.1/CMakeLists.txt
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5)
 set(DIFFPDF_VERSION 2.1.3.1)
 project(DiffPDF VERSION ${DIFFPDF_VERSION})
 
-set(QT_MIN_VERSION 5.7.0)
+set(QT_MIN_VERSION 6.9.0)
 set(CMAKE_CXX_STANDARD 14)
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 set(CMAKE_AUTOMOC ON)
@@ -24,14 +24,14 @@ include(ECMSetupVersion)
 include(FeatureSummary)
 include(GNUInstallDirs)
 
-find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS
+find_package(Qt6 ${QT_MIN_VERSION} REQUIRED COMPONENTS
     Core
     Gui
     LinguistTools
     PrintSupport
     Widgets)
 
-find_package(Poppler REQUIRED COMPONENTS Core Qt5)
+find_package(Poppler REQUIRED COMPONENTS Core Qt6)
 
 set(diffpdf_SRCS
     aboutform.cpp
@@ -53,17 +53,17 @@ ecm_setup_version(PROJECT
 configure_file(diffpdf.1.cmake diffpdf.1)
 
 file(GLOB diffpdf_TS *.ts)
-qt5_add_translation(diffpdf_QM ${diffpdf_TS})
+qt6_add_translation(diffpdf_QM ${diffpdf_TS})
 
 configure_file(resources.qrc.cmake resources.qrc)
-qt5_add_resources(diffpdf_SRCS ${CMAKE_BINARY_DIR}/resources.qrc)
+qt6_add_resources(diffpdf_SRCS ${CMAKE_BINARY_DIR}/resources.qrc)
 
 add_executable(diffpdf ${diffpdf_SRCS} ${diffpdf_QM})
 
 target_link_libraries(diffpdf
-    Poppler::Qt5
-    Qt5::PrintSupport
-    Qt5::Widgets)
+    Poppler::Qt6
+    Qt6::PrintSupport
+    Qt6::Widgets)
 
 target_compile_definitions(diffpdf PRIVATE -DPOPPLER_VERSION="${Poppler_VERSION}")
 
--- diffpdf-2.1.3.1.orig/diffpdf_cz.ts
+++ diffpdf-2.1.3.1/diffpdf_cz.ts
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
 <TS version="2.0" language="cs_CZ">
-<defaultcodec>UTF-8</defaultcodec>
 <context>
     <name>AboutForm</name>
     <message>
--- diffpdf-2.1.3.1.orig/diffpdf_de.ts
+++ diffpdf-2.1.3.1/diffpdf_de.ts
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
 <TS version="2.0" language="de_DE">
-<defaultcodec>UTF-8</defaultcodec>
 <context>
     <name>AboutForm</name>
     <message>
--- diffpdf-2.1.3.1.orig/diffpdf_es.ts
+++ diffpdf-2.1.3.1/diffpdf_es.ts
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
 <TS version="2.0" language="es_ES">
-<defaultcodec>UTF-8</defaultcodec>
 <context>
     <name>AboutForm</name>
     <message>
--- diffpdf-2.1.3.1.orig/diffpdf_fr.ts
+++ diffpdf-2.1.3.1/diffpdf_fr.ts
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
 <TS version="2.0">
-<defaultcodec>UTF-8</defaultcodec>
 <context>
     <name>AboutForm</name>
     <message>
--- diffpdf-2.1.3.1.orig/generic.cpp
+++ diffpdf-2.1.3.1/generic.cpp
@@ -75,11 +75,7 @@ QPixmap colorSwatch(const QColor &color)
 {
     QString key = QString("COLORSWATCH:%1").arg(color.name());
     QPixmap pixmap(SwatchSize);
-#if QT_VERSION >= 0x040600
     if (!QPixmapCache::find(key, &pixmap)) {
-#else
-    if (!QPixmapCache::find(key, pixmap)) {
-#endif
         pixmap.fill(Qt::transparent);
         {
             QPainter painter(&pixmap);
@@ -100,11 +96,7 @@ QPixmap brushSwatch(const Qt::BrushStyle
     QString key = QString("BRUSHSTYLESWATCH:%1:%2:%3")
         .arg(static_cast<int>(style)).arg(color.name()).arg(color.alpha());
     QPixmap pixmap(SwatchSize);
-#if QT_VERSION >= 0x040600
     if (!QPixmapCache::find(key, &pixmap)) {
-#else
-    if (!QPixmapCache::find(key, pixmap)) {
-#endif
         pixmap.fill(Qt::transparent);
         {
             QPainter painter(&pixmap);
@@ -125,11 +117,7 @@ QPixmap penStyleSwatch(const Qt::PenStyl
     QString key = QString("PENSTYLESWATCH:%1:%2")
         .arg(static_cast<int>(style)).arg(color.name());
     QPixmap pixmap(SwatchSize);
-#if QT_VERSION >= 0x040600
     if (!QPixmapCache::find(key, &pixmap)) {
-#else
-    if (!QPixmapCache::find(key, pixmap)) {
-#endif
         pixmap.fill(Qt::transparent);
         {
             QPainter painter(&pixmap);
@@ -145,19 +133,22 @@ QPixmap penStyleSwatch(const Qt::PenStyl
     return pixmap;
 }
 
-
 const TextBoxList getTextBoxes(PdfPage page, const QRectF &rect)
 {
     TextBoxList boxes;
-    foreach (Poppler::TextBox *box, page->textList()) {
-        PdfTextBox box_ptr(box);
-        if (rect.isEmpty() || rect.contains(box_ptr->boundingBox()))
-            boxes.append(box_ptr);
+    TextBoxList textList = page->textList();
+//    for (std::vector<std::unique_ptr<Poppler::TextBox>>::iterator it = textList.begin() ; it != textList.end(); ++it){
+    for (auto &box: textList) {
+//        PdfTextBox box_ptr = box;
+        if (rect.isEmpty() || rect.contains(box->boundingBox()))
+            boxes.push_back(std::move(box));
+//            boxes.push_back(box);
     }
     return boxes;
 }
 
 
+
 const QString strippedFilename(const QString &filename)
 {
     const QString FilePrefix("file://");
--- diffpdf-2.1.3.1.orig/generic.hpp
+++ diffpdf-2.1.3.1/generic.hpp
@@ -12,7 +12,7 @@
     for more details.
 */
 
-#include <poppler-qt5.h>
+#include <poppler-qt6.h>
 #include <QMetaType>
 #include <QPair>
 #include <QPixmap>
@@ -22,16 +22,10 @@ class QColor;
 class QMimeData;
 class QRectF;
 
-#if QT_VERSION >= 0x040600
-typedef QSharedPointer<Poppler::Document> PdfDocument;
-typedef QSharedPointer<Poppler::Page> PdfPage;
-typedef QSharedPointer<Poppler::TextBox> PdfTextBox;
-#else
-typedef std::tr1::shared_ptr<Poppler::Document> PdfDocument;
-typedef std::tr1::shared_ptr<Poppler::Page> PdfPage;
-typedef std::tr1::shared_ptr<Poppler::TextBox> PdfTextBox;
-#endif
-typedef QList<PdfTextBox> TextBoxList;
+typedef std::shared_ptr<Poppler::Document> PdfDocument;
+typedef std::shared_ptr<Poppler::Page> PdfPage;
+typedef std::unique_ptr<Poppler::TextBox> PdfTextBox;
+typedef std::vector<PdfTextBox> TextBoxList;
 
 enum InitialComparisonMode{CompareAppearance=0, CompareCharacters=1,
                            CompareWords=2};
@@ -50,9 +44,9 @@ struct PagePair
 
     bool isNull() { return left == -1 || right == -1; }
 
-    const int left;
-    const int right;
-    const bool hasVisualDifference;
+    int left;
+    int right;
+    bool hasVisualDifference;
 };
 Q_DECLARE_METATYPE(PagePair)
 
--- diffpdf-2.1.3.1.orig/helpform.cpp
+++ diffpdf-2.1.3.1/helpform.cpp
@@ -32,7 +32,7 @@ HelpForm::HelpForm(const QString &langua
     QFile file(filename);
     file.open(QIODevice::ReadOnly|QIODevice::Text);
     QTextStream in(&file);
-    in.setCodec("UTF-8");
+    in.setEncoding(QStringConverter::Utf8);
     viewer->setHtml(in.readAll());
     viewer->setReadOnly(true);
     setCentralWidget(viewer);
--- diffpdf-2.1.3.1.orig/main.cpp
+++ diffpdf-2.1.3.1/main.cpp
@@ -16,7 +16,6 @@
 #include <QLibraryInfo>
 #include <QLocale>
 #include <QSettings>
-#include <QTextCodec>
 #include <QTextStream>
 #include <QTranslator>
 
@@ -101,11 +100,13 @@ int main(int argc, char *argv[])
     }
 
     QTranslator qtTranslator;
-    qtTranslator.load("qt_" + language,
-        QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+    if(!qtTranslator.load("qt_" + language,
+        QLibraryInfo::path(QLibraryInfo::TranslationsPath)))
+        out << "cannot find '" << language << "' Qt translations in " << QLibraryInfo::TranslationsPath;
     app.installTranslator(&qtTranslator);
     QTranslator appTranslator;
-    appTranslator.load("diffpdf_" + language, ":/");
+    if(!appTranslator.load("diffpdf_" + language, ":/"))
+        out << "cannot load '" << language << "' diffpdf translations";
     app.installTranslator(&appTranslator);
 
     MainWindow window(debug, comparisonMode, filename1, filename2,
--- diffpdf-2.1.3.1.orig/mainwindow.cpp
+++ diffpdf-2.1.3.1/mainwindow.cpp
@@ -27,6 +27,7 @@
 #include <QComboBox>
 #include <QDir>
 #include <QDockWidget>
+#include <QElapsedTimer>
 #include <QEvent>
 #include <QFileDialog>
 #include <QGroupBox>
@@ -39,6 +40,7 @@
 #include <QPrinter>
 #include <QPushButton>
 #include <QRadioButton>
+#include <QRegularExpression>
 #include <QScrollArea>
 #include <QScrollBar>
 #include <QSettings>
@@ -203,14 +205,10 @@ void MainWindow::createWidgets(const QSt
     previousButton = new QPushButton(tr("Previo&us"));
     previousButton->setToolTip(
             "<p>Navigate to the previous pair of pages.");
-#if QT_VERSION >= 0x040600
     previousButton->setIcon(QIcon(":/left.png"));
-#endif
     nextButton = new QPushButton(tr("Ne&xt"));
     nextButton->setToolTip("<p>Navigate to the next pair of pages.");
-#if QT_VERSION >= 0x040600
     nextButton->setIcon(QIcon(":/right.png"));
-#endif
     zoomLabel = new QLabel(tr("&Zoom:"));
     zoomLabel->setToolTip(tr("<p>Determines the scale at which the "
                 "pages are shown."));
@@ -868,13 +866,8 @@ const QPair<QPixmap, QPixmap> MainWindow
 {
     QPixmap pixmap1;
     QPixmap pixmap2;
-#if QT_VERSION >= 0x040600
     if (!QPixmapCache::find(key1, &pixmap1) ||
         !QPixmapCache::find(key2, &pixmap2)) {
-#else
-    if (!QPixmapCache::find(key1, pixmap1) ||
-        !QPixmapCache::find(key2, pixmap2)) {
-#endif
         QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
         const int DPI = static_cast<int>(POINTS_PER_INCH *
                 (zoomSpinBox->value() / 100.0));
@@ -960,6 +953,7 @@ void MainWindow::computeTextHighlights(Q
     QRectF rect;
     if (marginsGroupBox->isChecked())
         rect = pointRectForMargins(page1->pageSize());
+
     const TextBoxList list1 = getTextBoxes(page1, rect);
     const TextBoxList list2 = getTextBoxes(page2, rect);
     TextItems items1 = ComparingWords ? getWords(list1)
@@ -1250,11 +1244,7 @@ PdfDocument MainWindow::getPdf(const QSt
     else if (pdf->isLocked()) {
         QMessageBox::warning(this, tr("DiffPDF — Error"),
                 tr("Cannot read a locked PDF ('%1').").arg(filename));
-#if QT_VERSION >= 0x040600
-        pdf.clear();
-#else
         pdf.reset();
-#endif
     }
     return pdf;
 }
@@ -1320,7 +1310,7 @@ QList<int> MainWindow::getPageList(int w
     bool error = false;
     QList<int> pages;
     QString page_string = pagesEdit->text();
-    page_string = page_string.replace(QRegExp("\\s+"), "");
+    page_string = page_string.replace(QRegularExpression("\\s+"), "");
     QStringList page_list = page_string.split(",");
     bool ok;
     foreach (const QString &page, page_list) {
@@ -1388,11 +1378,11 @@ void MainWindow::compare()
     }
 
     comparePrepareUi();
-    QTime time;
-    time.start();
+    QElapsedTimer timer;
+    timer.start();
     const QPair<int, int> pair = comparePages(filename1, pdf1, filename2,
                                               pdf2);
-    compareUpdateUi(pair, time.elapsed());
+    compareUpdateUi(pair, timer.elapsed());
 }
 
 
@@ -1532,9 +1522,9 @@ MainWindow::Difference MainWindow::getTh
         rect = pointRectForMargins(page1->pageSize());
     const TextBoxList list1 = getTextBoxes(page1, rect);
     const TextBoxList list2 = getTextBoxes(page2, rect);
-    if (list1.count() != list2.count())
+    if (list1.size() != list2.size())
         return TextualDifference;
-    for (int i = 0; i < list1.count(); ++i)
+    for (int i = 0; i < list1.size(); ++i)
         if (list1[i]->text() != list2[i]->text())
             return TextualDifference;
 
@@ -1708,8 +1698,8 @@ void MainWindow::saveAsPdf(const int sta
     printer.setOutputFormat(QPrinter::PdfFormat);
     printer.setColorMode(QPrinter::Color);
     printer.setCreator(tr("DiffPDF"));
-    printer.setOrientation(savePages == SaveBothPages
-            ? QPrinter::Landscape : QPrinter::Portrait);
+    printer.setPageOrientation(savePages == SaveBothPages
+            ? QPageLayout::Landscape : QPageLayout::Portrait);
     QPainter painter(&printer);
     painter.setRenderHints(QPainter::Antialiasing|
             QPainter::TextAntialiasing|QPainter::SmoothPixmapTransform);
@@ -1825,7 +1815,7 @@ void MainWindow::showZones()
 void MainWindow::showZones(const int Width, const TextBoxList &list,
                            QLabel *label)
 {
-    if (!label || !label->pixmap() || label->pixmap()->isNull())
+    if (!label || !label->pixmap() || label->pixmap().isNull())
         return;
     const bool ComparingWords = compareComboBox->currentIndex() ==
                                 CompareWords;
@@ -1838,7 +1828,7 @@ void MainWindow::showZones(const int Wid
             columnsSpinBox->value());
     const int DPI = static_cast<int>(POINTS_PER_INCH *
             (zoomSpinBox->value() / 100.0));
-    QPixmap pixmap = label->pixmap()->copy();
+    QPixmap pixmap = label->pixmap().copy();
     QPainter painter(&pixmap);
     painter.setPen(Qt::green);
     for (int i = 0; i < paths.count(); ++i) {
@@ -1867,11 +1857,11 @@ void MainWindow::showMargins()
 
 void MainWindow::showMargins(QLabel *label)
 {
-    if (!label || !label->pixmap() || label->pixmap()->isNull())
+    if (!label || !label->pixmap() || label->pixmap().isNull())
         return;
     const int DPI = static_cast<int>(POINTS_PER_INCH *
                 (zoomSpinBox->value() / 100.0));
-    QPixmap pixmap = label->pixmap()->copy();
+    QPixmap pixmap = label->pixmap().copy();
     QPainter painter(&pixmap);
     painter.setPen(Qt::cyan);
     int left = leftMarginSpinBox->value();
@@ -1904,11 +1894,11 @@ void MainWindow::showMargins(QLabel *lab
 void MainWindow::setAMargin(const QPoint &pos)
 {
     if (!marginsGroupBox->isChecked() || !page1Label->pixmap() ||
-        page1Label->pixmap()->isNull())
+        page1Label->pixmap().isNull())
         return;
     const int DPI = static_cast<int>(POINTS_PER_INCH *
                 (zoomSpinBox->value() / 100.0));
-    const QSize &size = page1Label->pixmap()->size();
+    const QSize &size = page1Label->pixmap().size();
     int x = pos.x();
     int y = pos.y();
     const int HorizontalMiddle = size.width() / 2;
--- diffpdf-2.1.3.1.orig/mainwindow.hpp
+++ diffpdf-2.1.3.1/mainwindow.hpp
@@ -14,12 +14,8 @@
 
 #include "generic.hpp"
 #include "saveform.hpp"
-#if QT_VERSION >= 0x040600
 #include <QSharedPointer>
-#else
-#include <tr1/memory>
-#endif
-#include <poppler-qt5.h>
+#include <poppler-qt6.h>
 #include <QBrush>
 #include <QList>
 #include <QMainWindow>
--- diffpdf-2.1.3.1.orig/sequence_matcher.cpp
+++ diffpdf-2.1.3.1/sequence_matcher.cpp
@@ -136,7 +136,7 @@ QList<Match> SequenceMatcher::get_matchi
                 offsets.append(Offsets(i + k, a_high, j + k, b_high));
         }
     }
-    qSort(matching_blocks.begin(), matching_blocks.end(), matchLessThan);
+    std::sort(matching_blocks.begin(), matching_blocks.end(), matchLessThan);
 
     int i1 = 0;
     int j1 = 0;
--- diffpdf-2.1.3.1.orig/textitem.cpp
+++ diffpdf-2.1.3.1/textitem.cpp
@@ -130,7 +130,7 @@ const QList<QPainterPath> TextItems::gen
         const int Column = ((Columns == 1) ? 0
             : (rect.width() > Span) ? Columns : rect.right() / Span);
         const int y = normalizedY(static_cast<int>(rect.y()), ToleranceY);
-        zonesForColumn.insertMulti(Key(Column, y, rect.x()), zone);
+        zonesForColumn.insert(Key(Column, y, rect.x()), zone);
     }
     return zonesForColumn.values();
 }
@@ -152,7 +152,7 @@ void TextItems::debug(const int page, co
                                 .arg(file.errorString())));
     }
     QTextStream out(&file);
-    out.setCodec("UTF-8");
+    out.setEncoding(QStringConverter::Utf8);
     out << "Page #" << page << ": "
         << (ComparingWords ? "Words" : "Characters") << " mode\n";
     for (int i = 0; i < items.count(); ++i) {
@@ -160,7 +160,7 @@ void TextItems::debug(const int page, co
         const QRect rect = item.toRect();
         out << item.text;
         if (!ComparingWords)
-            out << QString(" %1").arg(item.text.at(0).unicode(), 4, 16,
+            out << QString(" %1").arg(static_cast<unsigned int>(item.text.at(0).unicode()), 4, 16,
                                       QChar('0'));
         if (Yx) {
             const int y = normalizedY(static_cast<int>(item.rect.y()),
@@ -185,7 +185,7 @@ inline int normalizedY(const int y, cons
 const TextItems getWords(const TextBoxList &list)
 {
     TextItems items;
-    foreach (const PdfTextBox &box, list) {
+    for (auto &box: list) {
         QString word = box->text().trimmed();
         for (int i = 0; i < word.length(); ++i)
             word[i] = canonicalizedCharacter(word[i]);
@@ -200,9 +200,9 @@ const TextItems getWords(const TextBoxLi
 const TextItems getCharacters(const TextBoxList &list)
 {
     TextItems items;
-    foreach (const PdfTextBox &box, list) {
+    for (auto &box: list) {
         const QString word = box->text();
-        int limit = word.count() - 1;
+        int limit = word.length() - 1;
         for (int i = limit; i >= 0; --i)
             if (!word[i].isSpace())
                 break;
