Migrate diffpdf to Qt5

This commit is contained in:
Marek Kasik 2021-01-05 17:46:16 +01:00
parent 9a1172daeb
commit b35f1c730e
2 changed files with 139 additions and 4 deletions

View File

@ -1,7 +1,7 @@
%global _hardened_build 1
Name: diffpdf
Version: 2.1.3
Release: 20%{?dist}
Release: 21%{?dist}
Summary: PDF files comparator
License: GPLv2+
@ -10,7 +10,9 @@ Source0: http://www.qtrac.eu/%{name}-%{version}.tar.gz
Source1: %{name}.1
Source3: %{name}.desktop
BuildRequires: poppler-qt4-devel, desktop-file-utils, ImageMagick
Patch0: qt5.patch
BuildRequires: poppler-qt5-devel, desktop-file-utils, ImageMagick
# /usr/include/poppler/cpp/poppler-version.h
BuildRequires: poppler-cpp-devel
BuildRequires: make
@ -25,11 +27,12 @@ ranges.
%prep
%setup -q
%patch0 -p1 -b .qt5
%build
lrelease-qt4 diffpdf.pro
%{qmake_qt4}
lrelease-qt5 diffpdf.pro
%{qmake_qt5}
make %{?_smp_mflags}
@ -61,6 +64,9 @@ desktop-file-install \
%changelog
* Tue Jan 05 2021 Marek Kasik <mkasik@redhat.com> - 2.1.3-21
- Migrate diffpdf to Qt5
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

129
qt5.patch Normal file
View File

@ -0,0 +1,129 @@
--- diffpdf-2.1.3/diffpdf.pro
+++ diffpdf-2.1.3/diffpdf.pro
@@ -31,35 +31,41 @@ TRANSLATIONS += diffpdf_fr.ts
TRANSLATIONS += diffpdf_de.ts
TRANSLATIONS += diffpdf_es.ts
CODECFORTR = UTF-8
-LIBS += -lpoppler-qt4
+LIBS += -lpoppler-qt5 -lQt5Core -lQt5Widgets -lQt5Gui -lQt5PrintSupport
win32 {
CONFIG += release
}
exists($(HOME)/opt/poppler024/) {
message(Using locally built Poppler library)
INCLUDEPATH += $(HOME)/opt/poppler024/include/poppler/cpp
- INCLUDEPATH += $(HOME)/opt/poppler024/include/poppler/qt4
+ INCLUDEPATH += $(HOME)/opt/poppler024/include/poppler/qt5
LIBS += -Wl,-rpath -Wl,$(HOME)/opt/poppler024/lib -L$(HOME)/opt/poppler024/lib
} else {
exists(/poppler_lib) {
message(Using locally built Poppler library on Windows)
INCLUDEPATH += /c/poppler_lib/include/poppler/cpp
- INCLUDEPATH += /c/poppler_lib/include/poppler/qt4
+ INCLUDEPATH += /c/poppler_lib/include/poppler/qt5
LIBS += -Wl,-rpath -Wl,/c/poppler_lib/bin -Wl,-L/c/poppler_lib/bin
} else {
- exists(/usr/include/poppler/qt4) {
+ exists(/usr/include/poppler/qt5) {
INCLUDEPATH += /usr/include/poppler/cpp
- INCLUDEPATH += /usr/include/poppler/qt4
+ INCLUDEPATH += /usr/include/poppler/qt5
+ INCLUDEPATH += /usr/include/qt5/QtCore
+ INCLUDEPATH += /usr/include/qt5/QtWidgets
+ INCLUDEPATH += /usr/include/qt5/QtPrintSupport
} else {
INCLUDEPATH += /usr/local/include/poppler/cpp
- INCLUDEPATH += /usr/local/include/poppler/qt4
+ INCLUDEPATH += /usr/local/include/poppler/qt5
+ INCLUDEPATH += /usr/local/include/qt5/QtCore
+ INCLUDEPATH += /usr/local/include/qt5/QtWidgets
+ INCLUDEPATH += /usr/local/include/qt5/QtPrintSupport
}
}
}
#exists($(HOME)/opt/podofo09/) {
# message(Using locally built PoDoFo library)
# INCLUDEPATH += $(HOME)/opt/podofo09/include/poppler/cpp
-# INCLUDEPATH += $(HOME)/opt/podofo09/include/poppler/qt4
+# INCLUDEPATH += $(HOME)/opt/podofo09/include/poppler/qt5
# LIBS += -Wl,-rpath -Wl,$(HOME)/opt/podofo09/lib64 -Wl,-L$(HOME)/opt/podofo09/lib64
#} else {
# exists(/usr/include/podofo) {
--- diffpdf-2.1.3/generic.hpp
+++ diffpdf-2.1.3/generic.hpp
@@ -12,7 +12,7 @@
for more details.
*/
-#include <poppler-qt4.h>
+#include <poppler-qt5.h>
#include <QMetaType>
#include <QPair>
#include <QPixmap>
--- diffpdf-2.1.3/label.cpp
+++ diffpdf-2.1.3/label.cpp
@@ -15,6 +15,7 @@
#include <QDragEnterEvent>
#include <QDragEnterEvent>
#include <QMouseEvent>
+#include <QMimeData>
Label::Label(QWidget *parent) : QLabel(parent)
{
--- diffpdf-2.1.3/lineedit.cpp
+++ diffpdf-2.1.3/lineedit.cpp
@@ -14,6 +14,7 @@
#include "lineedit.hpp"
#include <QDragEnterEvent>
#include <QDragEnterEvent>
+#include <QMimeData>
LineEdit::LineEdit(QWidget *parent) : QLineEdit(parent)
--- diffpdf-2.1.3/main.cpp
+++ diffpdf-2.1.3/main.cpp
@@ -31,7 +31,6 @@ int main(int argc, char *argv[])
app.setOrganizationDomain("qtrac.eu");
app.setApplicationName("DiffPDF");
app.setWindowIcon(QIcon(":/icon.png"));
- QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QTextStream out(stdout);
QStringList args = app.arguments().mid(1);
--- diffpdf-2.1.3/mainwindow.hpp
+++ diffpdf-2.1.3/mainwindow.hpp
@@ -19,7 +19,7 @@
#else
#include <tr1/memory>
#endif
-#include <poppler-qt4.h>
+#include <poppler-qt5.h>
#include <QBrush>
#include <QList>
#include <QMainWindow>
--- diffpdf-2.1.3/optionsform.cpp
+++ diffpdf-2.1.3/optionsform.cpp
@@ -76,9 +76,9 @@ void OptionsForm::createWidgets()
<< qMakePair(tr("Diagonal \\"), Qt::FDiagPattern)
<< qMakePair(tr("Diagonal Cross"), Qt::DiagCrossPattern))
brushStyleComboBox->addItem(brushSwatch(pair.second, color),
- pair.first, pair.second);
+ pair.first, static_cast<int>(pair.second));
brushStyleComboBox->setCurrentIndex(brushStyleComboBox->findData(
- brush.style()));
+ static_cast<int>(brush.style())));
penStyleComboBox = new QComboBox;
typedef QPair<QString, Qt::PenStyle> PenPair;
@@ -90,9 +90,9 @@ void OptionsForm::createWidgets()
<< qMakePair(tr("Dash-Dotted"), Qt::DashDotLine)
<< qMakePair(tr("Dash-Dot-Dotted"), Qt::DashDotDotLine))
penStyleComboBox->addItem(penStyleSwatch(pair.second, color),
- pair.first, pair.second);
+ pair.first, static_cast<int>(pair.second));
penStyleComboBox->setCurrentIndex(penStyleComboBox->findData(
- pen.style()));
+ static_cast<int>(pen.style())));
alphaSpinBox = new QSpinBox;
alphaSpinBox->setRange(1, 100);