mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-02-25 07:57:48 +01:00
DocDiff application: line ending renormalization
This commit is contained in:
parent
3b6784b8e4
commit
5cdb6cdab6
@ -1,58 +1,58 @@
|
||||
# Copyright (C) 2021 Jakub Melka
|
||||
#
|
||||
# This file is part of PDF4QT.
|
||||
#
|
||||
# PDF4QT is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# with the written consent of the copyright owner, any later version.
|
||||
#
|
||||
# PDF4QT is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
QT += core gui widgets winextras
|
||||
|
||||
TARGET = Pdf4QtDocDiff
|
||||
TEMPLATE = app
|
||||
|
||||
VERSION = 1.0.0
|
||||
|
||||
RC_ICONS = $$PWD/app-icon.ico
|
||||
|
||||
QMAKE_TARGET_DESCRIPTION = "PDF Document Diff"
|
||||
QMAKE_TARGET_COPYRIGHT = "(c) Jakub Melka 2018-2021"
|
||||
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
QMAKE_CXXFLAGS += /std:c++latest /utf-8
|
||||
|
||||
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources
|
||||
DESTDIR = $$OUT_PWD/..
|
||||
LIBS += -L$$OUT_PWD/..
|
||||
LIBS += -lPDF4QtLib
|
||||
CONFIG += force_debug_info no_check_exist
|
||||
|
||||
application.files = $$DESTDIR/Pdf4QtDocDiff.exe
|
||||
application.path = $$DESTDIR/install
|
||||
application.CONFIG += no_check_exist
|
||||
INSTALLS += application
|
||||
|
||||
SOURCES += \
|
||||
aboutdialog.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp
|
||||
|
||||
FORMS += \
|
||||
aboutdialog.ui \
|
||||
mainwindow.ui
|
||||
|
||||
HEADERS += \
|
||||
aboutdialog.h \
|
||||
mainwindow.h
|
||||
|
||||
RESOURCES += \
|
||||
resources.qrc
|
||||
# Copyright (C) 2021 Jakub Melka
|
||||
#
|
||||
# This file is part of PDF4QT.
|
||||
#
|
||||
# PDF4QT is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# with the written consent of the copyright owner, any later version.
|
||||
#
|
||||
# PDF4QT is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
QT += core gui widgets winextras
|
||||
|
||||
TARGET = Pdf4QtDocDiff
|
||||
TEMPLATE = app
|
||||
|
||||
VERSION = 1.0.0
|
||||
|
||||
RC_ICONS = $$PWD/app-icon.ico
|
||||
|
||||
QMAKE_TARGET_DESCRIPTION = "PDF Document Diff"
|
||||
QMAKE_TARGET_COPYRIGHT = "(c) Jakub Melka 2018-2021"
|
||||
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
QMAKE_CXXFLAGS += /std:c++latest /utf-8
|
||||
|
||||
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources
|
||||
DESTDIR = $$OUT_PWD/..
|
||||
LIBS += -L$$OUT_PWD/..
|
||||
LIBS += -lPDF4QtLib
|
||||
CONFIG += force_debug_info no_check_exist
|
||||
|
||||
application.files = $$DESTDIR/Pdf4QtDocDiff.exe
|
||||
application.path = $$DESTDIR/install
|
||||
application.CONFIG += no_check_exist
|
||||
INSTALLS += application
|
||||
|
||||
SOURCES += \
|
||||
aboutdialog.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp
|
||||
|
||||
FORMS += \
|
||||
aboutdialog.ui \
|
||||
mainwindow.ui
|
||||
|
||||
HEADERS += \
|
||||
aboutdialog.h \
|
||||
mainwindow.h
|
||||
|
||||
RESOURCES += \
|
||||
resources.qrc
|
||||
|
@ -1,64 +1,64 @@
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "aboutdialog.h"
|
||||
#include "ui_aboutdialog.h"
|
||||
|
||||
#include "pdfutils.h"
|
||||
#include "pdfwidgetutils.h"
|
||||
|
||||
namespace pdfdocdiff
|
||||
{
|
||||
|
||||
PDFAboutDialog::PDFAboutDialog(QWidget* parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::PDFAboutDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QString html = ui->copyrightLabel->text();
|
||||
html.replace("PdfForQtViewer", QApplication::applicationDisplayName());
|
||||
ui->copyrightLabel->setText(html);
|
||||
|
||||
std::vector<pdf::PDFDependentLibraryInfo> infos = pdf::PDFDependentLibraryInfo::getLibraryInfo();
|
||||
|
||||
ui->tableWidget->setColumnCount(4);
|
||||
ui->tableWidget->setRowCount(static_cast<int>(infos.size()));
|
||||
ui->tableWidget->setHorizontalHeaderLabels(QStringList() << tr("Library") << tr("Version") << tr("License") << tr("URL"));
|
||||
ui->tableWidget->setEditTriggers(QTableWidget::NoEditTriggers);
|
||||
ui->tableWidget->setSelectionMode(QTableView::SingleSelection);
|
||||
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
|
||||
for (int i = 0; i < infos.size(); ++i)
|
||||
{
|
||||
const pdf::PDFDependentLibraryInfo& info = infos[i];
|
||||
ui->tableWidget->setItem(i, 0, new QTableWidgetItem(info.library));
|
||||
ui->tableWidget->setItem(i, 1, new QTableWidgetItem(info.version));
|
||||
ui->tableWidget->setItem(i, 2, new QTableWidgetItem(info.license));
|
||||
ui->tableWidget->setItem(i, 3, new QTableWidgetItem(info.url));
|
||||
}
|
||||
|
||||
pdf::PDFWidgetUtils::scaleWidget(this, QSize(750, 600));
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
PDFAboutDialog::~PDFAboutDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
} // namespace pdfdocdiff
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "aboutdialog.h"
|
||||
#include "ui_aboutdialog.h"
|
||||
|
||||
#include "pdfutils.h"
|
||||
#include "pdfwidgetutils.h"
|
||||
|
||||
namespace pdfdocdiff
|
||||
{
|
||||
|
||||
PDFAboutDialog::PDFAboutDialog(QWidget* parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::PDFAboutDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QString html = ui->copyrightLabel->text();
|
||||
html.replace("PdfForQtViewer", QApplication::applicationDisplayName());
|
||||
ui->copyrightLabel->setText(html);
|
||||
|
||||
std::vector<pdf::PDFDependentLibraryInfo> infos = pdf::PDFDependentLibraryInfo::getLibraryInfo();
|
||||
|
||||
ui->tableWidget->setColumnCount(4);
|
||||
ui->tableWidget->setRowCount(static_cast<int>(infos.size()));
|
||||
ui->tableWidget->setHorizontalHeaderLabels(QStringList() << tr("Library") << tr("Version") << tr("License") << tr("URL"));
|
||||
ui->tableWidget->setEditTriggers(QTableWidget::NoEditTriggers);
|
||||
ui->tableWidget->setSelectionMode(QTableView::SingleSelection);
|
||||
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
|
||||
for (int i = 0; i < infos.size(); ++i)
|
||||
{
|
||||
const pdf::PDFDependentLibraryInfo& info = infos[i];
|
||||
ui->tableWidget->setItem(i, 0, new QTableWidgetItem(info.library));
|
||||
ui->tableWidget->setItem(i, 1, new QTableWidgetItem(info.version));
|
||||
ui->tableWidget->setItem(i, 2, new QTableWidgetItem(info.license));
|
||||
ui->tableWidget->setItem(i, 3, new QTableWidgetItem(info.url));
|
||||
}
|
||||
|
||||
pdf::PDFWidgetUtils::scaleWidget(this, QSize(750, 600));
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
PDFAboutDialog::~PDFAboutDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
} // namespace pdfdocdiff
|
||||
|
@ -1,45 +1,45 @@
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef PDFDOCDIFF_PDFABOUTDIALOG_H
|
||||
#define PDFDOCDIFF_PDFABOUTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PDFAboutDialog;
|
||||
}
|
||||
|
||||
namespace pdfdocdiff
|
||||
{
|
||||
|
||||
class PDFAboutDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PDFAboutDialog(QWidget* parent);
|
||||
virtual ~PDFAboutDialog() override;
|
||||
|
||||
private:
|
||||
Ui::PDFAboutDialog* ui;
|
||||
};
|
||||
|
||||
} // namespace pdfdocdiff
|
||||
|
||||
#endif // PDFDOCDIFF_PDFABOUTDIALOG_H
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef PDFDOCDIFF_PDFABOUTDIALOG_H
|
||||
#define PDFDOCDIFF_PDFABOUTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PDFAboutDialog;
|
||||
}
|
||||
|
||||
namespace pdfdocdiff
|
||||
{
|
||||
|
||||
class PDFAboutDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PDFAboutDialog(QWidget* parent);
|
||||
virtual ~PDFAboutDialog() override;
|
||||
|
||||
private:
|
||||
Ui::PDFAboutDialog* ui;
|
||||
};
|
||||
|
||||
} // namespace pdfdocdiff
|
||||
|
||||
#endif // PDFDOCDIFF_PDFABOUTDIALOG_H
|
||||
|
@ -1,269 +1,269 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PDFAboutDialog</class>
|
||||
<widget class="QDialog" name="PDFAboutDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>900</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>900</width>
|
||||
<height>600</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="copyrightLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">PdfForQtViewer</span></p><p>Copyright 2018-2021 Jakub Melka. All rights reserved.</p><p>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:7.875pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> GNU LESSER GENERAL PUBLIC LICENSE</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Version 3, 29 June 2007</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Copyright (C) 2007 Free Software Foundation, Inc. &lt;https://fsf.org/&gt;</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Everyone is permitted to copy and distribute verbatim copies</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> of this license document, but changing it is not allowed.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> This version of the GNU Lesser General Public License incorporates</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">the terms and conditions of version 3 of the GNU General Public</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">License, supplemented by the additional permissions listed below.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 0. Additional Definitions.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> As used herein, &quot;this License&quot; refers to version 3 of the GNU Lesser</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">General Public License, and the &quot;GNU GPL&quot; refers to version 3 of the GNU</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">General Public License.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> &quot;The Library&quot; refers to a covered work governed by this License,</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">other than an Application or a Combined Work as defined below.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> An &quot;Application&quot; is any work that makes use of an interface provided</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">by the Library, but which is not otherwise based on the Library.</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Defining a subclass of a class defined by the Library is deemed a mode</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">of using an interface provided by the Library.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> A &quot;Combined Work&quot; is a work produced by combining or linking an</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Application with the Library. The particular version of the Library</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">with which the Combined Work was made is also called the &quot;Linked</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Version&quot;.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> The &quot;Minimal Corresponding Source&quot; for a Combined Work means the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Corresponding Source for the Combined Work, excluding any source code</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">for portions of the Combined Work that, considered in isolation, are</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">based on the Application, and not on the Linked Version.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> The &quot;Corresponding Application Code&quot; for a Combined Work means the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">object code and/or source code for the Application, including any data</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">and utility programs needed for reproducing the Combined Work from the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Application, but excluding the System Libraries of the Combined Work.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 1. Exception to Section 3 of the GNU GPL.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> You may convey a covered work under sections 3 and 4 of this License</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">without being bound by section 3 of the GNU GPL.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 2. Conveying Modified Versions.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> If you modify a copy of the Library, and, in your modifications, a</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">facility refers to a function or data to be supplied by an Application</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">that uses the facility (other than as an argument passed when the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">facility is invoked), then you may convey a copy of the modified</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">version:</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> a) under this License, provided that you make a good faith effort to</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> ensure that, in the event an Application does not supply the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> function or data, the facility still operates, and performs</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> whatever part of its purpose remains meaningful, or</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> b) under the GNU GPL, with none of the additional permissions of</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> this License applicable to that copy.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 3. Object Code Incorporating Material from Library Header Files.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> The object code form of an Application may incorporate material from</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">a header file that is part of the Library. You may convey such object</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">code under terms of your choice, provided that, if the incorporated</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">material is not limited to numerical parameters, data structure</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">layouts and accessors, or small macros, inline functions and templates</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(ten or fewer lines in length), you do both of the following:</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> a) Give prominent notice with each copy of the object code that the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Library is used in it and that the Library and its use are</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> covered by this License.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> b) Accompany the object code with a copy of the GNU GPL and this license</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> document.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 4. Combined Works.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> You may convey a Combined Work under terms of your choice that,</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">taken together, effectively do not restrict modification of the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">portions of the Library contained in the Combined Work and reverse</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">engineering for debugging such modifications, if you also do each of</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">the following:</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> a) Give prominent notice with each copy of the Combined Work that</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> the Library is used in it and that the Library and its use are</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> covered by this License.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> b) Accompany the Combined Work with a copy of the GNU GPL and this license</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> document.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> c) For a Combined Work that displays copyright notices during</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> execution, include the copyright notice for the Library among</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> these notices, as well as a reference directing the user to the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> copies of the GNU GPL and this license document.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> d) Do one of the following:</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 0) Convey the Minimal Corresponding Source under the terms of this</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> License, and the Corresponding Application Code in a form</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> suitable for, and under terms that permit, the user to</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> recombine or relink the Application with a modified version of</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> the Linked Version to produce a modified Combined Work, in the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> manner specified by section 6 of the GNU GPL for conveying</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Corresponding Source.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 1) Use a suitable shared library mechanism for linking with the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Library. A suitable mechanism is one that (a) uses at run time</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> a copy of the Library already present on the user's computer</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> system, and (b) will operate properly with a modified version</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> of the Library that is interface-compatible with the Linked</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Version.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> e) Provide Installation Information, but only if you would otherwise</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> be required to provide such information under section 6 of the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> GNU GPL, and only to the extent that such information is</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> necessary to install and execute a modified version of the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Combined Work produced by recombining or relinking the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Application with a modified version of the Linked Version. (If</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> you use option 4d0, the Installation Information must accompany</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> the Minimal Corresponding Source and Corresponding Application</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Code. If you use option 4d1, you must provide the Installation</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Information in the manner specified by section 6 of the GNU GPL</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> for conveying Corresponding Source.)</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 5. Combined Libraries.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> You may place library facilities that are a work based on the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Library side by side in a single library together with other library</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">facilities that are not Applications and are not covered by this</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">License, and convey such a combined library under terms of your</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">choice, if you do both of the following:</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> a) Accompany the combined library with a copy of the same work based</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> on the Library, uncombined with any other library facilities,</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> conveyed under the terms of this License.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> b) Give prominent notice with the combined library that part of it</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> is a work based on the Library, and explaining where to find the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> accompanying uncombined form of the same work.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 6. Revised Versions of the GNU Lesser General Public License.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> The Free Software Foundation may publish revised and/or new versions</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">of the GNU Lesser General Public License from time to time. Such new</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">versions will be similar in spirit to the present version, but may</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">differ in detail to address new problems or concerns.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Each version is given a distinguishing version number. If the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Library as you received it specifies that a certain numbered version</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">of the GNU Lesser General Public License &quot;or any later version&quot;</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">applies to it, you have the option of following the terms and</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">conditions either of that published version or of any later version</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">published by the Free Software Foundation. If the Library as you</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">received it does not specify a version number of the GNU Lesser</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">General Public License, you may choose any version of the GNU Lesser</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">General Public License ever published by the Free Software Foundation.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> If the Library as you received it specifies that a proxy can decide</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">whether future versions of the GNU Lesser General Public License shall</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">apply, that proxy's public statement of acceptance of any version is</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">permanent authorization for you to choose that version for the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Library.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="usedLibrariesLabel">
|
||||
<property name="text">
|
||||
<string>Used libraries</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>PDFAboutDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>PDFAboutDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PDFAboutDialog</class>
|
||||
<widget class="QDialog" name="PDFAboutDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>900</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>900</width>
|
||||
<height>600</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="copyrightLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">PdfForQtViewer</span></p><p>Copyright 2018-2021 Jakub Melka. All rights reserved.</p><p>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:7.875pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> GNU LESSER GENERAL PUBLIC LICENSE</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Version 3, 29 June 2007</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Copyright (C) 2007 Free Software Foundation, Inc. &lt;https://fsf.org/&gt;</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Everyone is permitted to copy and distribute verbatim copies</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> of this license document, but changing it is not allowed.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> This version of the GNU Lesser General Public License incorporates</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">the terms and conditions of version 3 of the GNU General Public</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">License, supplemented by the additional permissions listed below.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 0. Additional Definitions.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> As used herein, &quot;this License&quot; refers to version 3 of the GNU Lesser</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">General Public License, and the &quot;GNU GPL&quot; refers to version 3 of the GNU</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">General Public License.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> &quot;The Library&quot; refers to a covered work governed by this License,</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">other than an Application or a Combined Work as defined below.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> An &quot;Application&quot; is any work that makes use of an interface provided</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">by the Library, but which is not otherwise based on the Library.</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Defining a subclass of a class defined by the Library is deemed a mode</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">of using an interface provided by the Library.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> A &quot;Combined Work&quot; is a work produced by combining or linking an</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Application with the Library. The particular version of the Library</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">with which the Combined Work was made is also called the &quot;Linked</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Version&quot;.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> The &quot;Minimal Corresponding Source&quot; for a Combined Work means the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Corresponding Source for the Combined Work, excluding any source code</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">for portions of the Combined Work that, considered in isolation, are</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">based on the Application, and not on the Linked Version.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> The &quot;Corresponding Application Code&quot; for a Combined Work means the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">object code and/or source code for the Application, including any data</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">and utility programs needed for reproducing the Combined Work from the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Application, but excluding the System Libraries of the Combined Work.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 1. Exception to Section 3 of the GNU GPL.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> You may convey a covered work under sections 3 and 4 of this License</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">without being bound by section 3 of the GNU GPL.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 2. Conveying Modified Versions.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> If you modify a copy of the Library, and, in your modifications, a</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">facility refers to a function or data to be supplied by an Application</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">that uses the facility (other than as an argument passed when the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">facility is invoked), then you may convey a copy of the modified</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">version:</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> a) under this License, provided that you make a good faith effort to</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> ensure that, in the event an Application does not supply the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> function or data, the facility still operates, and performs</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> whatever part of its purpose remains meaningful, or</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> b) under the GNU GPL, with none of the additional permissions of</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> this License applicable to that copy.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 3. Object Code Incorporating Material from Library Header Files.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> The object code form of an Application may incorporate material from</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">a header file that is part of the Library. You may convey such object</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">code under terms of your choice, provided that, if the incorporated</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">material is not limited to numerical parameters, data structure</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">layouts and accessors, or small macros, inline functions and templates</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">(ten or fewer lines in length), you do both of the following:</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> a) Give prominent notice with each copy of the object code that the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Library is used in it and that the Library and its use are</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> covered by this License.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> b) Accompany the object code with a copy of the GNU GPL and this license</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> document.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 4. Combined Works.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> You may convey a Combined Work under terms of your choice that,</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">taken together, effectively do not restrict modification of the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">portions of the Library contained in the Combined Work and reverse</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">engineering for debugging such modifications, if you also do each of</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">the following:</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> a) Give prominent notice with each copy of the Combined Work that</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> the Library is used in it and that the Library and its use are</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> covered by this License.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> b) Accompany the Combined Work with a copy of the GNU GPL and this license</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> document.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> c) For a Combined Work that displays copyright notices during</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> execution, include the copyright notice for the Library among</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> these notices, as well as a reference directing the user to the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> copies of the GNU GPL and this license document.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> d) Do one of the following:</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 0) Convey the Minimal Corresponding Source under the terms of this</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> License, and the Corresponding Application Code in a form</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> suitable for, and under terms that permit, the user to</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> recombine or relink the Application with a modified version of</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> the Linked Version to produce a modified Combined Work, in the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> manner specified by section 6 of the GNU GPL for conveying</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Corresponding Source.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 1) Use a suitable shared library mechanism for linking with the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Library. A suitable mechanism is one that (a) uses at run time</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> a copy of the Library already present on the user's computer</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> system, and (b) will operate properly with a modified version</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> of the Library that is interface-compatible with the Linked</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Version.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> e) Provide Installation Information, but only if you would otherwise</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> be required to provide such information under section 6 of the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> GNU GPL, and only to the extent that such information is</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> necessary to install and execute a modified version of the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Combined Work produced by recombining or relinking the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Application with a modified version of the Linked Version. (If</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> you use option 4d0, the Installation Information must accompany</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> the Minimal Corresponding Source and Corresponding Application</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Code. If you use option 4d1, you must provide the Installation</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Information in the manner specified by section 6 of the GNU GPL</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> for conveying Corresponding Source.)</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 5. Combined Libraries.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> You may place library facilities that are a work based on the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Library side by side in a single library together with other library</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">facilities that are not Applications and are not covered by this</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">License, and convey such a combined library under terms of your</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">choice, if you do both of the following:</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> a) Accompany the combined library with a copy of the same work based</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> on the Library, uncombined with any other library facilities,</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> conveyed under the terms of this License.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> b) Give prominent notice with the combined library that part of it</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> is a work based on the Library, and explaining where to find the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> accompanying uncombined form of the same work.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 6. Revised Versions of the GNU Lesser General Public License.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> The Free Software Foundation may publish revised and/or new versions</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">of the GNU Lesser General Public License from time to time. Such new</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">versions will be similar in spirit to the present version, but may</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">differ in detail to address new problems or concerns.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Each version is given a distinguishing version number. If the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Library as you received it specifies that a certain numbered version</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">of the GNU Lesser General Public License &quot;or any later version&quot;</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">applies to it, you have the option of following the terms and</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">conditions either of that published version or of any later version</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">published by the Free Software Foundation. If the Library as you</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">received it does not specify a version number of the GNU Lesser</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">General Public License, you may choose any version of the GNU Lesser</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">General Public License ever published by the Free Software Foundation.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> If the Library as you received it specifies that a proxy can decide</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">whether future versions of the GNU Lesser General Public License shall</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">apply, that proxy's public statement of acceptance of any version is</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">permanent authorization for you to choose that version for the</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Library.</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="usedLibrariesLabel">
|
||||
<property name="text">
|
||||
<string>Used libraries</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>PDFAboutDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>PDFAboutDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
@ -1,47 +1,47 @@
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfconstants.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
|
||||
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
|
||||
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
|
||||
QApplication application(argc, argv);
|
||||
|
||||
QCoreApplication::setOrganizationName("MelkaJ");
|
||||
QCoreApplication::setApplicationName("PDF4QT Document Diff");
|
||||
QCoreApplication::setApplicationVersion(pdf::PDF_LIBRARY_VERSION);
|
||||
QApplication::setApplicationDisplayName(QApplication::translate("Application", "PDF4QT Document Diff"));
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(QCoreApplication::applicationName());
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addPositionalArgument("file1", "The PDF file to be compared.");
|
||||
parser.addPositionalArgument("file2", "The PDF file to be compared.");
|
||||
parser.process(application);
|
||||
|
||||
pdfdocdiff::MainWindow mainWindow(nullptr);
|
||||
mainWindow.show();
|
||||
|
||||
return application.exec();
|
||||
}
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfconstants.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
|
||||
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
|
||||
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
|
||||
QApplication application(argc, argv);
|
||||
|
||||
QCoreApplication::setOrganizationName("MelkaJ");
|
||||
QCoreApplication::setApplicationName("PDF4QT Document Diff");
|
||||
QCoreApplication::setApplicationVersion(pdf::PDF_LIBRARY_VERSION);
|
||||
QApplication::setApplicationDisplayName(QApplication::translate("Application", "PDF4QT Document Diff"));
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(QCoreApplication::applicationName());
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addPositionalArgument("file1", "The PDF file to be compared.");
|
||||
parser.addPositionalArgument("file2", "The PDF file to be compared.");
|
||||
parser.process(application);
|
||||
|
||||
pdfdocdiff::MainWindow mainWindow(nullptr);
|
||||
mainWindow.show();
|
||||
|
||||
return application.exec();
|
||||
}
|
||||
|
@ -1,386 +1,386 @@
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include "aboutdialog.h"
|
||||
|
||||
#include "pdfwidgetutils.h"
|
||||
#include "pdfdocumentreader.h"
|
||||
|
||||
#include <QToolBar>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QFileDialog>
|
||||
|
||||
namespace pdfdocdiff
|
||||
{
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow),
|
||||
m_progress(new pdf::PDFProgress(this)),
|
||||
m_taskbarButton(new QWinTaskbarButton(this)),
|
||||
m_progressTaskbarIndicator(nullptr),
|
||||
m_diff(nullptr),
|
||||
m_isChangingProgressStep(false),
|
||||
m_dontDisplayErrorMessage(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(800, 600)));
|
||||
|
||||
// Initialize task bar progress
|
||||
m_progressTaskbarIndicator = m_taskbarButton->progress();
|
||||
|
||||
ui->actionGet_Source->setData(int(Operation::GetSource));
|
||||
ui->actionAbout->setData(int(Operation::About));
|
||||
ui->actionOpen_Left->setData(int(Operation::OpenLeft));
|
||||
ui->actionOpen_Right->setData(int(Operation::OpenRight));
|
||||
ui->actionCompare->setData(int(Operation::Compare));
|
||||
ui->actionClose->setData(int(Operation::Close));
|
||||
|
||||
QToolBar* mainToolbar = addToolBar(tr("Main"));
|
||||
mainToolbar->setObjectName("main_toolbar");
|
||||
mainToolbar->addActions({ ui->actionOpen_Left, ui->actionOpen_Right });
|
||||
mainToolbar->addSeparator();
|
||||
mainToolbar->addAction(ui->actionCompare);
|
||||
|
||||
QSize iconSize = pdf::PDFWidgetUtils::scaleDPI(this, QSize(24, 24));
|
||||
auto toolbars = findChildren<QToolBar*>();
|
||||
for (QToolBar* toolbar : toolbars)
|
||||
{
|
||||
toolbar->setIconSize(iconSize);
|
||||
ui->menuToolbars->addAction(toolbar->toggleViewAction());
|
||||
}
|
||||
|
||||
connect(&m_mapper, QOverload<int>::of(&QSignalMapper::mapped), this, &MainWindow::onMappedActionTriggered);
|
||||
|
||||
QList<QAction*> actions = findChildren<QAction*>();
|
||||
for (QAction* action : actions)
|
||||
{
|
||||
QVariant actionData = action->data();
|
||||
if (actionData.isValid())
|
||||
{
|
||||
connect(action, &QAction::triggered, &m_mapper, QOverload<>::of(&QSignalMapper::map));
|
||||
m_mapper.setMapping(action, actionData.toInt());
|
||||
}
|
||||
}
|
||||
|
||||
connect(m_progress, &pdf::PDFProgress::progressStarted, this, &MainWindow::onProgressStarted);
|
||||
connect(m_progress, &pdf::PDFProgress::progressStep, this, &MainWindow::onProgressStep);
|
||||
connect(m_progress, &pdf::PDFProgress::progressFinished, this, &MainWindow::onProgressFinished);
|
||||
|
||||
m_diff.setProgress(m_progress);
|
||||
m_diff.setOption(pdf::PDFDiff::Asynchronous, true);
|
||||
connect(&m_diff, &pdf::PDFDiff::comparationFinished, this, &MainWindow::onComparationFinished);
|
||||
|
||||
m_diff.setLeftDocument(&m_leftDocument);
|
||||
m_diff.setRightDocument(&m_rightDocument);
|
||||
|
||||
loadSettings();
|
||||
updateActions();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
saveSettings();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::showEvent(QShowEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
m_taskbarButton->setWindow(windowHandle());
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
BaseClass::closeEvent(event);
|
||||
m_diff.stop();
|
||||
}
|
||||
|
||||
void MainWindow::onMappedActionTriggered(int actionId)
|
||||
{
|
||||
performOperation(static_cast<Operation>(actionId));
|
||||
}
|
||||
|
||||
void MainWindow::onComparationFinished()
|
||||
{
|
||||
auto result = m_diff.getResult().getResult();
|
||||
if (!result && !m_dontDisplayErrorMessage)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), result.getErrorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateActions()
|
||||
{
|
||||
QList<QAction*> actions = findChildren<QAction*>();
|
||||
for (QAction* action : actions)
|
||||
{
|
||||
QVariant actionData = action->data();
|
||||
if (actionData.isValid())
|
||||
{
|
||||
action->setEnabled(canPerformOperation(static_cast<Operation>(actionData.toInt())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::loadSettings()
|
||||
{
|
||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName());
|
||||
settings.beginGroup("MainWindow");
|
||||
QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
|
||||
if (geometry.isEmpty())
|
||||
{
|
||||
QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
|
||||
QRect windowRect(0, 0, availableGeometry.width() / 2, availableGeometry.height() / 2);
|
||||
windowRect = windowRect.translated(availableGeometry.center() - windowRect.center());
|
||||
setGeometry(windowRect);
|
||||
}
|
||||
else
|
||||
{
|
||||
restoreGeometry(geometry);
|
||||
}
|
||||
|
||||
QByteArray state = settings.value("windowState", QByteArray()).toByteArray();
|
||||
if (!state.isEmpty())
|
||||
{
|
||||
restoreState(state);
|
||||
}
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("Settings");
|
||||
m_settings.directory = settings.value("directory").toString();
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
void MainWindow::saveSettings()
|
||||
{
|
||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName());
|
||||
settings.beginGroup("MainWindow");
|
||||
settings.setValue("geometry", saveGeometry());
|
||||
settings.setValue("windowState", saveState());
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("Settings");
|
||||
settings.setValue("directory", m_settings.directory);
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
bool MainWindow::canPerformOperation(Operation operation) const
|
||||
{
|
||||
switch (operation)
|
||||
{
|
||||
case Operation::OpenLeft:
|
||||
case Operation::OpenRight:
|
||||
case Operation::Compare:
|
||||
case Operation::Close:
|
||||
case Operation::GetSource:
|
||||
case Operation::About:
|
||||
return true;
|
||||
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainWindow::performOperation(Operation operation)
|
||||
{
|
||||
switch (operation)
|
||||
{
|
||||
case Operation::OpenLeft:
|
||||
{
|
||||
pdf::PDFTemporaryValueChange guard(&m_dontDisplayErrorMessage, true);
|
||||
m_diff.stop();
|
||||
|
||||
std::optional<pdf::PDFDocument> document = openDocument();
|
||||
if (document)
|
||||
{
|
||||
m_leftDocument = std::move(*document);
|
||||
|
||||
const size_t pageCount = m_leftDocument.getCatalog()->getPageCount();
|
||||
if (pageCount > 1)
|
||||
{
|
||||
ui->leftPageSelectionEdit->setText(QString("1-%2").arg(pageCount));
|
||||
}
|
||||
else if (pageCount == 1)
|
||||
{
|
||||
ui->leftPageSelectionEdit->setText("1");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->leftPageSelectionEdit->clear();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case Operation::OpenRight:
|
||||
{
|
||||
pdf::PDFTemporaryValueChange guard(&m_dontDisplayErrorMessage, true);
|
||||
m_diff.stop();
|
||||
|
||||
std::optional<pdf::PDFDocument> document = openDocument();
|
||||
if (document)
|
||||
{
|
||||
m_rightDocument = std::move(*document);
|
||||
|
||||
const size_t pageCount = m_rightDocument.getCatalog()->getPageCount();
|
||||
if (pageCount > 1)
|
||||
{
|
||||
ui->rightPageSelectionEdit->setText(QString("1-%2").arg(pageCount));
|
||||
}
|
||||
else if (pageCount == 1)
|
||||
{
|
||||
ui->rightPageSelectionEdit->setText("1");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->rightPageSelectionEdit->clear();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case Operation::Compare:
|
||||
{
|
||||
pdf::PDFTemporaryValueChange guard(&m_dontDisplayErrorMessage, true);
|
||||
m_diff.stop();
|
||||
|
||||
QString errorMessage;
|
||||
|
||||
pdf::PDFClosedIntervalSet rightPageIndices;
|
||||
pdf::PDFClosedIntervalSet leftPageIndices = pdf::PDFClosedIntervalSet::parse(1, qMax<pdf::PDFInteger>(1, m_leftDocument.getCatalog()->getPageCount()), ui->leftPageSelectionEdit->text(), &errorMessage);
|
||||
|
||||
if (errorMessage.isEmpty())
|
||||
{
|
||||
rightPageIndices = pdf::PDFClosedIntervalSet::parse(1, qMax<pdf::PDFInteger>(1, m_rightDocument.getCatalog()->getPageCount()), ui->rightPageSelectionEdit->text(), &errorMessage);
|
||||
}
|
||||
|
||||
// Check if pages are succesfully parsed
|
||||
if (!errorMessage.isEmpty())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), errorMessage);
|
||||
break;
|
||||
}
|
||||
|
||||
leftPageIndices.translate(-1);
|
||||
rightPageIndices.translate(-1);
|
||||
|
||||
m_diff.setPagesForLeftDocument(std::move(leftPageIndices));
|
||||
m_diff.setPagesForRightDocument(std::move(rightPageIndices));
|
||||
|
||||
m_diff.start();
|
||||
break;
|
||||
}
|
||||
|
||||
case Operation::Close:
|
||||
{
|
||||
close();
|
||||
break;
|
||||
}
|
||||
|
||||
case Operation::GetSource:
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("https://github.com/JakubMelka/PDF4QT"));
|
||||
break;
|
||||
}
|
||||
|
||||
case Operation::About:
|
||||
{
|
||||
PDFAboutDialog aboutDialog(this);
|
||||
aboutDialog.exec();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
updateActions();
|
||||
}
|
||||
|
||||
std::optional<pdf::PDFDocument> MainWindow::openDocument()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select PDF document"), m_settings.directory, tr("PDF document (*.pdf)"));
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto queryPassword = [this](bool* ok)
|
||||
{
|
||||
*ok = false;
|
||||
return QInputDialog::getText(this, tr("Encrypted document"), tr("Enter password to access document content"), QLineEdit::Password, QString(), ok);
|
||||
};
|
||||
|
||||
// Mark current directory as this
|
||||
QFileInfo fileInfo(fileName);
|
||||
m_settings.directory = fileInfo.dir().absolutePath();
|
||||
|
||||
// Try to open a new document
|
||||
pdf::PDFDocumentReader reader(nullptr, qMove(queryPassword), true, false);
|
||||
pdf::PDFDocument document = reader.readFromFile(fileName);
|
||||
|
||||
QString errorMessage = reader.getErrorMessage();
|
||||
pdf::PDFDocumentReader::Result result = reader.getReadingResult();
|
||||
if (result == pdf::PDFDocumentReader::Result::OK)
|
||||
{
|
||||
return document;
|
||||
}
|
||||
else if (result == pdf::PDFDocumentReader::Result::Failed)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), errorMessage);
|
||||
}
|
||||
|
||||
return pdf::PDFDocument();
|
||||
}
|
||||
|
||||
void MainWindow::onProgressStarted(pdf::ProgressStartupInfo info)
|
||||
{
|
||||
m_progressTaskbarIndicator->setRange(0, 100);
|
||||
m_progressTaskbarIndicator->reset();
|
||||
m_progressTaskbarIndicator->show();
|
||||
}
|
||||
|
||||
void MainWindow::onProgressStep(int percentage)
|
||||
{
|
||||
if (m_isChangingProgressStep)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pdf::PDFTemporaryValueChange guard(&m_isChangingProgressStep, true);
|
||||
m_progressTaskbarIndicator->setValue(percentage);
|
||||
}
|
||||
|
||||
void MainWindow::onProgressFinished()
|
||||
{
|
||||
m_progressTaskbarIndicator->hide();
|
||||
}
|
||||
|
||||
} // namespace pdfdocdiff
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include "aboutdialog.h"
|
||||
|
||||
#include "pdfwidgetutils.h"
|
||||
#include "pdfdocumentreader.h"
|
||||
|
||||
#include <QToolBar>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QFileDialog>
|
||||
|
||||
namespace pdfdocdiff
|
||||
{
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow),
|
||||
m_progress(new pdf::PDFProgress(this)),
|
||||
m_taskbarButton(new QWinTaskbarButton(this)),
|
||||
m_progressTaskbarIndicator(nullptr),
|
||||
m_diff(nullptr),
|
||||
m_isChangingProgressStep(false),
|
||||
m_dontDisplayErrorMessage(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(800, 600)));
|
||||
|
||||
// Initialize task bar progress
|
||||
m_progressTaskbarIndicator = m_taskbarButton->progress();
|
||||
|
||||
ui->actionGet_Source->setData(int(Operation::GetSource));
|
||||
ui->actionAbout->setData(int(Operation::About));
|
||||
ui->actionOpen_Left->setData(int(Operation::OpenLeft));
|
||||
ui->actionOpen_Right->setData(int(Operation::OpenRight));
|
||||
ui->actionCompare->setData(int(Operation::Compare));
|
||||
ui->actionClose->setData(int(Operation::Close));
|
||||
|
||||
QToolBar* mainToolbar = addToolBar(tr("Main"));
|
||||
mainToolbar->setObjectName("main_toolbar");
|
||||
mainToolbar->addActions({ ui->actionOpen_Left, ui->actionOpen_Right });
|
||||
mainToolbar->addSeparator();
|
||||
mainToolbar->addAction(ui->actionCompare);
|
||||
|
||||
QSize iconSize = pdf::PDFWidgetUtils::scaleDPI(this, QSize(24, 24));
|
||||
auto toolbars = findChildren<QToolBar*>();
|
||||
for (QToolBar* toolbar : toolbars)
|
||||
{
|
||||
toolbar->setIconSize(iconSize);
|
||||
ui->menuToolbars->addAction(toolbar->toggleViewAction());
|
||||
}
|
||||
|
||||
connect(&m_mapper, QOverload<int>::of(&QSignalMapper::mapped), this, &MainWindow::onMappedActionTriggered);
|
||||
|
||||
QList<QAction*> actions = findChildren<QAction*>();
|
||||
for (QAction* action : actions)
|
||||
{
|
||||
QVariant actionData = action->data();
|
||||
if (actionData.isValid())
|
||||
{
|
||||
connect(action, &QAction::triggered, &m_mapper, QOverload<>::of(&QSignalMapper::map));
|
||||
m_mapper.setMapping(action, actionData.toInt());
|
||||
}
|
||||
}
|
||||
|
||||
connect(m_progress, &pdf::PDFProgress::progressStarted, this, &MainWindow::onProgressStarted);
|
||||
connect(m_progress, &pdf::PDFProgress::progressStep, this, &MainWindow::onProgressStep);
|
||||
connect(m_progress, &pdf::PDFProgress::progressFinished, this, &MainWindow::onProgressFinished);
|
||||
|
||||
m_diff.setProgress(m_progress);
|
||||
m_diff.setOption(pdf::PDFDiff::Asynchronous, true);
|
||||
connect(&m_diff, &pdf::PDFDiff::comparationFinished, this, &MainWindow::onComparationFinished);
|
||||
|
||||
m_diff.setLeftDocument(&m_leftDocument);
|
||||
m_diff.setRightDocument(&m_rightDocument);
|
||||
|
||||
loadSettings();
|
||||
updateActions();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
saveSettings();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::showEvent(QShowEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
m_taskbarButton->setWindow(windowHandle());
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
BaseClass::closeEvent(event);
|
||||
m_diff.stop();
|
||||
}
|
||||
|
||||
void MainWindow::onMappedActionTriggered(int actionId)
|
||||
{
|
||||
performOperation(static_cast<Operation>(actionId));
|
||||
}
|
||||
|
||||
void MainWindow::onComparationFinished()
|
||||
{
|
||||
auto result = m_diff.getResult().getResult();
|
||||
if (!result && !m_dontDisplayErrorMessage)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), result.getErrorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateActions()
|
||||
{
|
||||
QList<QAction*> actions = findChildren<QAction*>();
|
||||
for (QAction* action : actions)
|
||||
{
|
||||
QVariant actionData = action->data();
|
||||
if (actionData.isValid())
|
||||
{
|
||||
action->setEnabled(canPerformOperation(static_cast<Operation>(actionData.toInt())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::loadSettings()
|
||||
{
|
||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName());
|
||||
settings.beginGroup("MainWindow");
|
||||
QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
|
||||
if (geometry.isEmpty())
|
||||
{
|
||||
QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
|
||||
QRect windowRect(0, 0, availableGeometry.width() / 2, availableGeometry.height() / 2);
|
||||
windowRect = windowRect.translated(availableGeometry.center() - windowRect.center());
|
||||
setGeometry(windowRect);
|
||||
}
|
||||
else
|
||||
{
|
||||
restoreGeometry(geometry);
|
||||
}
|
||||
|
||||
QByteArray state = settings.value("windowState", QByteArray()).toByteArray();
|
||||
if (!state.isEmpty())
|
||||
{
|
||||
restoreState(state);
|
||||
}
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("Settings");
|
||||
m_settings.directory = settings.value("directory").toString();
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
void MainWindow::saveSettings()
|
||||
{
|
||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName());
|
||||
settings.beginGroup("MainWindow");
|
||||
settings.setValue("geometry", saveGeometry());
|
||||
settings.setValue("windowState", saveState());
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("Settings");
|
||||
settings.setValue("directory", m_settings.directory);
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
bool MainWindow::canPerformOperation(Operation operation) const
|
||||
{
|
||||
switch (operation)
|
||||
{
|
||||
case Operation::OpenLeft:
|
||||
case Operation::OpenRight:
|
||||
case Operation::Compare:
|
||||
case Operation::Close:
|
||||
case Operation::GetSource:
|
||||
case Operation::About:
|
||||
return true;
|
||||
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainWindow::performOperation(Operation operation)
|
||||
{
|
||||
switch (operation)
|
||||
{
|
||||
case Operation::OpenLeft:
|
||||
{
|
||||
pdf::PDFTemporaryValueChange guard(&m_dontDisplayErrorMessage, true);
|
||||
m_diff.stop();
|
||||
|
||||
std::optional<pdf::PDFDocument> document = openDocument();
|
||||
if (document)
|
||||
{
|
||||
m_leftDocument = std::move(*document);
|
||||
|
||||
const size_t pageCount = m_leftDocument.getCatalog()->getPageCount();
|
||||
if (pageCount > 1)
|
||||
{
|
||||
ui->leftPageSelectionEdit->setText(QString("1-%2").arg(pageCount));
|
||||
}
|
||||
else if (pageCount == 1)
|
||||
{
|
||||
ui->leftPageSelectionEdit->setText("1");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->leftPageSelectionEdit->clear();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case Operation::OpenRight:
|
||||
{
|
||||
pdf::PDFTemporaryValueChange guard(&m_dontDisplayErrorMessage, true);
|
||||
m_diff.stop();
|
||||
|
||||
std::optional<pdf::PDFDocument> document = openDocument();
|
||||
if (document)
|
||||
{
|
||||
m_rightDocument = std::move(*document);
|
||||
|
||||
const size_t pageCount = m_rightDocument.getCatalog()->getPageCount();
|
||||
if (pageCount > 1)
|
||||
{
|
||||
ui->rightPageSelectionEdit->setText(QString("1-%2").arg(pageCount));
|
||||
}
|
||||
else if (pageCount == 1)
|
||||
{
|
||||
ui->rightPageSelectionEdit->setText("1");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->rightPageSelectionEdit->clear();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case Operation::Compare:
|
||||
{
|
||||
pdf::PDFTemporaryValueChange guard(&m_dontDisplayErrorMessage, true);
|
||||
m_diff.stop();
|
||||
|
||||
QString errorMessage;
|
||||
|
||||
pdf::PDFClosedIntervalSet rightPageIndices;
|
||||
pdf::PDFClosedIntervalSet leftPageIndices = pdf::PDFClosedIntervalSet::parse(1, qMax<pdf::PDFInteger>(1, m_leftDocument.getCatalog()->getPageCount()), ui->leftPageSelectionEdit->text(), &errorMessage);
|
||||
|
||||
if (errorMessage.isEmpty())
|
||||
{
|
||||
rightPageIndices = pdf::PDFClosedIntervalSet::parse(1, qMax<pdf::PDFInteger>(1, m_rightDocument.getCatalog()->getPageCount()), ui->rightPageSelectionEdit->text(), &errorMessage);
|
||||
}
|
||||
|
||||
// Check if pages are succesfully parsed
|
||||
if (!errorMessage.isEmpty())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), errorMessage);
|
||||
break;
|
||||
}
|
||||
|
||||
leftPageIndices.translate(-1);
|
||||
rightPageIndices.translate(-1);
|
||||
|
||||
m_diff.setPagesForLeftDocument(std::move(leftPageIndices));
|
||||
m_diff.setPagesForRightDocument(std::move(rightPageIndices));
|
||||
|
||||
m_diff.start();
|
||||
break;
|
||||
}
|
||||
|
||||
case Operation::Close:
|
||||
{
|
||||
close();
|
||||
break;
|
||||
}
|
||||
|
||||
case Operation::GetSource:
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("https://github.com/JakubMelka/PDF4QT"));
|
||||
break;
|
||||
}
|
||||
|
||||
case Operation::About:
|
||||
{
|
||||
PDFAboutDialog aboutDialog(this);
|
||||
aboutDialog.exec();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Q_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
updateActions();
|
||||
}
|
||||
|
||||
std::optional<pdf::PDFDocument> MainWindow::openDocument()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select PDF document"), m_settings.directory, tr("PDF document (*.pdf)"));
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto queryPassword = [this](bool* ok)
|
||||
{
|
||||
*ok = false;
|
||||
return QInputDialog::getText(this, tr("Encrypted document"), tr("Enter password to access document content"), QLineEdit::Password, QString(), ok);
|
||||
};
|
||||
|
||||
// Mark current directory as this
|
||||
QFileInfo fileInfo(fileName);
|
||||
m_settings.directory = fileInfo.dir().absolutePath();
|
||||
|
||||
// Try to open a new document
|
||||
pdf::PDFDocumentReader reader(nullptr, qMove(queryPassword), true, false);
|
||||
pdf::PDFDocument document = reader.readFromFile(fileName);
|
||||
|
||||
QString errorMessage = reader.getErrorMessage();
|
||||
pdf::PDFDocumentReader::Result result = reader.getReadingResult();
|
||||
if (result == pdf::PDFDocumentReader::Result::OK)
|
||||
{
|
||||
return document;
|
||||
}
|
||||
else if (result == pdf::PDFDocumentReader::Result::Failed)
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), errorMessage);
|
||||
}
|
||||
|
||||
return pdf::PDFDocument();
|
||||
}
|
||||
|
||||
void MainWindow::onProgressStarted(pdf::ProgressStartupInfo info)
|
||||
{
|
||||
m_progressTaskbarIndicator->setRange(0, 100);
|
||||
m_progressTaskbarIndicator->reset();
|
||||
m_progressTaskbarIndicator->show();
|
||||
}
|
||||
|
||||
void MainWindow::onProgressStep(int percentage)
|
||||
{
|
||||
if (m_isChangingProgressStep)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pdf::PDFTemporaryValueChange guard(&m_isChangingProgressStep, true);
|
||||
m_progressTaskbarIndicator->setValue(percentage);
|
||||
}
|
||||
|
||||
void MainWindow::onProgressFinished()
|
||||
{
|
||||
m_progressTaskbarIndicator->hide();
|
||||
}
|
||||
|
||||
} // namespace pdfdocdiff
|
||||
|
@ -1,103 +1,103 @@
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef PDFDOCDIFF_MAINWINDOW_H
|
||||
#define PDFDOCDIFF_MAINWINDOW_H
|
||||
|
||||
#include "pdfdocument.h"
|
||||
#include "pdfdiff.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QSignalMapper>
|
||||
#include <QWinTaskbarButton>
|
||||
#include <QWinTaskbarProgress>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
namespace pdfdocdiff
|
||||
{
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
using BaseClass = QMainWindow;
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget* parent);
|
||||
virtual ~MainWindow() override;
|
||||
|
||||
enum class Operation
|
||||
{
|
||||
OpenLeft,
|
||||
OpenRight,
|
||||
Compare,
|
||||
Close,
|
||||
GetSource,
|
||||
About
|
||||
};
|
||||
|
||||
virtual void showEvent(QShowEvent* event) override;
|
||||
virtual void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
private slots:
|
||||
void updateActions();
|
||||
|
||||
private:
|
||||
void onMappedActionTriggered(int actionId);
|
||||
void onComparationFinished();
|
||||
|
||||
void onProgressStarted(pdf::ProgressStartupInfo info);
|
||||
void onProgressStep(int percentage);
|
||||
void onProgressFinished();
|
||||
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
|
||||
bool canPerformOperation(Operation operation) const;
|
||||
void performOperation(Operation operation);
|
||||
|
||||
std::optional<pdf::PDFDocument> openDocument();
|
||||
|
||||
struct Settings
|
||||
{
|
||||
QString directory;
|
||||
};
|
||||
|
||||
Ui::MainWindow* ui;
|
||||
|
||||
pdf::PDFProgress* m_progress;
|
||||
QWinTaskbarButton* m_taskbarButton;
|
||||
QWinTaskbarProgress* m_progressTaskbarIndicator;
|
||||
|
||||
Settings m_settings;
|
||||
QSignalMapper m_mapper;
|
||||
pdf::PDFDiff m_diff;
|
||||
bool m_isChangingProgressStep;
|
||||
bool m_dontDisplayErrorMessage;
|
||||
|
||||
pdf::PDFDocument m_leftDocument;
|
||||
pdf::PDFDocument m_rightDocument;
|
||||
};
|
||||
|
||||
} // namespace pdfdocdiff
|
||||
|
||||
#endif // PDFDOCDIFF_MAINWINDOW_H
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef PDFDOCDIFF_MAINWINDOW_H
|
||||
#define PDFDOCDIFF_MAINWINDOW_H
|
||||
|
||||
#include "pdfdocument.h"
|
||||
#include "pdfdiff.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QSignalMapper>
|
||||
#include <QWinTaskbarButton>
|
||||
#include <QWinTaskbarProgress>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
namespace pdfdocdiff
|
||||
{
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
using BaseClass = QMainWindow;
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget* parent);
|
||||
virtual ~MainWindow() override;
|
||||
|
||||
enum class Operation
|
||||
{
|
||||
OpenLeft,
|
||||
OpenRight,
|
||||
Compare,
|
||||
Close,
|
||||
GetSource,
|
||||
About
|
||||
};
|
||||
|
||||
virtual void showEvent(QShowEvent* event) override;
|
||||
virtual void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
private slots:
|
||||
void updateActions();
|
||||
|
||||
private:
|
||||
void onMappedActionTriggered(int actionId);
|
||||
void onComparationFinished();
|
||||
|
||||
void onProgressStarted(pdf::ProgressStartupInfo info);
|
||||
void onProgressStep(int percentage);
|
||||
void onProgressFinished();
|
||||
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
|
||||
bool canPerformOperation(Operation operation) const;
|
||||
void performOperation(Operation operation);
|
||||
|
||||
std::optional<pdf::PDFDocument> openDocument();
|
||||
|
||||
struct Settings
|
||||
{
|
||||
QString directory;
|
||||
};
|
||||
|
||||
Ui::MainWindow* ui;
|
||||
|
||||
pdf::PDFProgress* m_progress;
|
||||
QWinTaskbarButton* m_taskbarButton;
|
||||
QWinTaskbarProgress* m_progressTaskbarIndicator;
|
||||
|
||||
Settings m_settings;
|
||||
QSignalMapper m_mapper;
|
||||
pdf::PDFDiff m_diff;
|
||||
bool m_isChangingProgressStep;
|
||||
bool m_dontDisplayErrorMessage;
|
||||
|
||||
pdf::PDFDocument m_leftDocument;
|
||||
pdf::PDFDocument m_rightDocument;
|
||||
};
|
||||
|
||||
} // namespace pdfdocdiff
|
||||
|
||||
#endif // PDFDOCDIFF_MAINWINDOW_H
|
||||
|
@ -1,180 +1,180 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>864</width>
|
||||
<height>638</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Workspace</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="leftDocumentSettingsGroupBox">
|
||||
<property name="title">
|
||||
<string>Left</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="leftPageSelectionLabel">
|
||||
<property name="text">
|
||||
<string>Page Selection:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leftPageSelectionEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="rightDocumentSettingsGroupBox">
|
||||
<property name="title">
|
||||
<string>Right</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="rightPageSelectionLabel">
|
||||
<property name="text">
|
||||
<string>Page Selection:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="rightPageSelectionEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>864</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionOpen_Left"/>
|
||||
<addaction name="actionOpen_Right"/>
|
||||
<addaction name="actionClose"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionGet_Source"/>
|
||||
<addaction name="actionAbout"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuToolbars">
|
||||
<property name="title">
|
||||
<string>Toolbars</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuCompare">
|
||||
<property name="title">
|
||||
<string>Compare</string>
|
||||
</property>
|
||||
<addaction name="actionCompare"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuCompare"/>
|
||||
<addaction name="menuToolbars"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="actionGet_Source">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/pdfdocdiff/resources/get-source.svg</normaloff>:/pdfdocdiff/resources/get-source.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Get Source</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/pdfdocdiff/resources/about.svg</normaloff>:/pdfdocdiff/resources/about.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F1</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_Left">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/pdfdocdiff/resources/open-left.svg</normaloff>:/pdfdocdiff/resources/open-left.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Left</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_Right">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/pdfdocdiff/resources/open-right.svg</normaloff>:/pdfdocdiff/resources/open-right.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Right</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCompare">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/pdfdocdiff/resources/compare.svg</normaloff>:/pdfdocdiff/resources/compare.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Compare</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F5</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClose">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/pdfdocdiff/resources/close.svg</normaloff>:/pdfdocdiff/resources/close.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+F4</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>864</width>
|
||||
<height>638</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Workspace</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="leftDocumentSettingsGroupBox">
|
||||
<property name="title">
|
||||
<string>Left</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="leftPageSelectionLabel">
|
||||
<property name="text">
|
||||
<string>Page Selection:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leftPageSelectionEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="rightDocumentSettingsGroupBox">
|
||||
<property name="title">
|
||||
<string>Right</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="rightPageSelectionLabel">
|
||||
<property name="text">
|
||||
<string>Page Selection:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="rightPageSelectionEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>864</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionOpen_Left"/>
|
||||
<addaction name="actionOpen_Right"/>
|
||||
<addaction name="actionClose"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionGet_Source"/>
|
||||
<addaction name="actionAbout"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuToolbars">
|
||||
<property name="title">
|
||||
<string>Toolbars</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuCompare">
|
||||
<property name="title">
|
||||
<string>Compare</string>
|
||||
</property>
|
||||
<addaction name="actionCompare"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuCompare"/>
|
||||
<addaction name="menuToolbars"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="actionGet_Source">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/pdfdocdiff/resources/get-source.svg</normaloff>:/pdfdocdiff/resources/get-source.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Get Source</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/pdfdocdiff/resources/about.svg</normaloff>:/pdfdocdiff/resources/about.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F1</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_Left">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/pdfdocdiff/resources/open-left.svg</normaloff>:/pdfdocdiff/resources/open-left.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Left</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_Right">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/pdfdocdiff/resources/open-right.svg</normaloff>:/pdfdocdiff/resources/open-right.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Right</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCompare">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/pdfdocdiff/resources/compare.svg</normaloff>:/pdfdocdiff/resources/compare.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Compare</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F5</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClose">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/pdfdocdiff/resources/close.svg</normaloff>:/pdfdocdiff/resources/close.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+F4</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -1,10 +1,10 @@
|
||||
<RCC>
|
||||
<qresource prefix="/pdfdocdiff">
|
||||
<file>resources/about.svg</file>
|
||||
<file>resources/close.svg</file>
|
||||
<file>resources/compare.svg</file>
|
||||
<file>resources/get-source.svg</file>
|
||||
<file>resources/open-left.svg</file>
|
||||
<file>resources/open-right.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
<RCC>
|
||||
<qresource prefix="/pdfdocdiff">
|
||||
<file>resources/about.svg</file>
|
||||
<file>resources/close.svg</file>
|
||||
<file>resources/compare.svg</file>
|
||||
<file>resources/get-source.svg</file>
|
||||
<file>resources/open-left.svg</file>
|
||||
<file>resources/open-right.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -1,177 +1,177 @@
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfalgorithmlcs.h"
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
void PDFAlgorithmLongestCommonSubsequenceBase::markSequence(Sequence& sequence,
|
||||
const std::vector<size_t>& movedItemsLeft,
|
||||
const std::vector<size_t>& movedItemsRight)
|
||||
{
|
||||
Sequence updatedSequence;
|
||||
|
||||
Q_ASSERT(std::is_sorted(movedItemsLeft.cbegin(), movedItemsLeft.cend()));
|
||||
Q_ASSERT(std::is_sorted(movedItemsRight.cbegin(), movedItemsRight.cend()));
|
||||
|
||||
for (auto it = sequence.cbegin(); it != sequence.cend();)
|
||||
{
|
||||
if (it->isMatch())
|
||||
{
|
||||
updatedSequence.push_back(*it);
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
|
||||
Sequence leftItems;
|
||||
Sequence rightItems;
|
||||
|
||||
for (; it != sequence.cend() && !it->isMatch(); ++it)
|
||||
{
|
||||
const SequenceItem& currentItem = *it;
|
||||
Q_ASSERT(currentItem.isLeft() || currentItem.isRight());
|
||||
|
||||
if (currentItem.isLeft())
|
||||
{
|
||||
if (std::binary_search(movedItemsLeft.cbegin(), movedItemsLeft.cend(), currentItem.index1))
|
||||
{
|
||||
SequenceItem item = *it;
|
||||
item.markMovedLeft();
|
||||
updatedSequence.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
leftItems.push_back(currentItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentItem.isRight())
|
||||
{
|
||||
if (std::binary_search(movedItemsRight.cbegin(), movedItemsRight.cend(), currentItem.index2))
|
||||
{
|
||||
SequenceItem item = *it;
|
||||
item.markMovedRight();
|
||||
updatedSequence.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
rightItems.push_back(currentItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::reverse(leftItems.begin(), leftItems.end());
|
||||
std::reverse(rightItems.begin(), rightItems.end());
|
||||
|
||||
bool isReplaced = !leftItems.empty() && !rightItems.empty();
|
||||
|
||||
while (!leftItems.empty() && !rightItems.empty())
|
||||
{
|
||||
SequenceItem item;
|
||||
item.index1 = leftItems.back().index1;
|
||||
item.index2 = rightItems.back().index2;
|
||||
item.markReplaced();
|
||||
updatedSequence.push_back(item);
|
||||
|
||||
leftItems.pop_back();
|
||||
rightItems.pop_back();
|
||||
}
|
||||
|
||||
while (!leftItems.empty())
|
||||
{
|
||||
SequenceItem item = leftItems.back();
|
||||
item.markRemoved();
|
||||
|
||||
if (isReplaced)
|
||||
{
|
||||
item.markReplaced();
|
||||
}
|
||||
|
||||
updatedSequence.push_back(item);
|
||||
leftItems.pop_back();
|
||||
}
|
||||
|
||||
while (!rightItems.empty())
|
||||
{
|
||||
SequenceItem item = rightItems.back();
|
||||
item.markAdded();
|
||||
|
||||
if (isReplaced)
|
||||
{
|
||||
item.markReplaced();
|
||||
}
|
||||
|
||||
updatedSequence.push_back(item);
|
||||
rightItems.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
for (SequenceItem& item : updatedSequence)
|
||||
{
|
||||
if (item.isMatch() && !item.isRemoved() && !item.isReplaced() && !item.isAdded() && item.index1 != item.index2)
|
||||
{
|
||||
item.markMoved();
|
||||
}
|
||||
}
|
||||
|
||||
sequence = qMove(updatedSequence);
|
||||
}
|
||||
|
||||
PDFAlgorithmLongestCommonSubsequenceBase::SequenceItemRanges PDFAlgorithmLongestCommonSubsequenceBase::getModifiedRanges(Sequence& sequence)
|
||||
{
|
||||
SequenceItemRanges result;
|
||||
|
||||
for (auto it = sequence.begin(); it != sequence.end();)
|
||||
{
|
||||
const SequenceItem& item = *it;
|
||||
if (!item.isModified())
|
||||
{
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Jakub Melka: now, we have iterator pointing on item,
|
||||
// which has been modified. We will search for modification
|
||||
// range.
|
||||
|
||||
auto itEnd = it;
|
||||
while (itEnd != sequence.end() && itEnd->isModified())
|
||||
{
|
||||
++itEnd;
|
||||
}
|
||||
|
||||
result.emplace_back(it, itEnd);
|
||||
it = itEnd;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PDFAlgorithmLongestCommonSubsequenceBase::SequenceItemFlags PDFAlgorithmLongestCommonSubsequenceBase::collectFlags(const SequenceItemRange& range)
|
||||
{
|
||||
SequenceItemFlags flags = 0;
|
||||
|
||||
for (auto it = range.first; it != range.second; ++it)
|
||||
{
|
||||
flags |= it->flags;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
} // namespace pdf
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfalgorithmlcs.h"
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
void PDFAlgorithmLongestCommonSubsequenceBase::markSequence(Sequence& sequence,
|
||||
const std::vector<size_t>& movedItemsLeft,
|
||||
const std::vector<size_t>& movedItemsRight)
|
||||
{
|
||||
Sequence updatedSequence;
|
||||
|
||||
Q_ASSERT(std::is_sorted(movedItemsLeft.cbegin(), movedItemsLeft.cend()));
|
||||
Q_ASSERT(std::is_sorted(movedItemsRight.cbegin(), movedItemsRight.cend()));
|
||||
|
||||
for (auto it = sequence.cbegin(); it != sequence.cend();)
|
||||
{
|
||||
if (it->isMatch())
|
||||
{
|
||||
updatedSequence.push_back(*it);
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
|
||||
Sequence leftItems;
|
||||
Sequence rightItems;
|
||||
|
||||
for (; it != sequence.cend() && !it->isMatch(); ++it)
|
||||
{
|
||||
const SequenceItem& currentItem = *it;
|
||||
Q_ASSERT(currentItem.isLeft() || currentItem.isRight());
|
||||
|
||||
if (currentItem.isLeft())
|
||||
{
|
||||
if (std::binary_search(movedItemsLeft.cbegin(), movedItemsLeft.cend(), currentItem.index1))
|
||||
{
|
||||
SequenceItem item = *it;
|
||||
item.markMovedLeft();
|
||||
updatedSequence.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
leftItems.push_back(currentItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentItem.isRight())
|
||||
{
|
||||
if (std::binary_search(movedItemsRight.cbegin(), movedItemsRight.cend(), currentItem.index2))
|
||||
{
|
||||
SequenceItem item = *it;
|
||||
item.markMovedRight();
|
||||
updatedSequence.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
rightItems.push_back(currentItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::reverse(leftItems.begin(), leftItems.end());
|
||||
std::reverse(rightItems.begin(), rightItems.end());
|
||||
|
||||
bool isReplaced = !leftItems.empty() && !rightItems.empty();
|
||||
|
||||
while (!leftItems.empty() && !rightItems.empty())
|
||||
{
|
||||
SequenceItem item;
|
||||
item.index1 = leftItems.back().index1;
|
||||
item.index2 = rightItems.back().index2;
|
||||
item.markReplaced();
|
||||
updatedSequence.push_back(item);
|
||||
|
||||
leftItems.pop_back();
|
||||
rightItems.pop_back();
|
||||
}
|
||||
|
||||
while (!leftItems.empty())
|
||||
{
|
||||
SequenceItem item = leftItems.back();
|
||||
item.markRemoved();
|
||||
|
||||
if (isReplaced)
|
||||
{
|
||||
item.markReplaced();
|
||||
}
|
||||
|
||||
updatedSequence.push_back(item);
|
||||
leftItems.pop_back();
|
||||
}
|
||||
|
||||
while (!rightItems.empty())
|
||||
{
|
||||
SequenceItem item = rightItems.back();
|
||||
item.markAdded();
|
||||
|
||||
if (isReplaced)
|
||||
{
|
||||
item.markReplaced();
|
||||
}
|
||||
|
||||
updatedSequence.push_back(item);
|
||||
rightItems.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
for (SequenceItem& item : updatedSequence)
|
||||
{
|
||||
if (item.isMatch() && !item.isRemoved() && !item.isReplaced() && !item.isAdded() && item.index1 != item.index2)
|
||||
{
|
||||
item.markMoved();
|
||||
}
|
||||
}
|
||||
|
||||
sequence = qMove(updatedSequence);
|
||||
}
|
||||
|
||||
PDFAlgorithmLongestCommonSubsequenceBase::SequenceItemRanges PDFAlgorithmLongestCommonSubsequenceBase::getModifiedRanges(Sequence& sequence)
|
||||
{
|
||||
SequenceItemRanges result;
|
||||
|
||||
for (auto it = sequence.begin(); it != sequence.end();)
|
||||
{
|
||||
const SequenceItem& item = *it;
|
||||
if (!item.isModified())
|
||||
{
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Jakub Melka: now, we have iterator pointing on item,
|
||||
// which has been modified. We will search for modification
|
||||
// range.
|
||||
|
||||
auto itEnd = it;
|
||||
while (itEnd != sequence.end() && itEnd->isModified())
|
||||
{
|
||||
++itEnd;
|
||||
}
|
||||
|
||||
result.emplace_back(it, itEnd);
|
||||
it = itEnd;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PDFAlgorithmLongestCommonSubsequenceBase::SequenceItemFlags PDFAlgorithmLongestCommonSubsequenceBase::collectFlags(const SequenceItemRange& range)
|
||||
{
|
||||
SequenceItemFlags flags = 0;
|
||||
|
||||
for (auto it = range.first; it != range.second; ++it)
|
||||
{
|
||||
flags |= it->flags;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
} // namespace pdf
|
||||
|
@ -1,260 +1,260 @@
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef PDFALGORITHMLCS_H
|
||||
#define PDFALGORITHMLCS_H
|
||||
|
||||
#include "pdfglobal.h"
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
class PDFAlgorithmLongestCommonSubsequenceBase
|
||||
{
|
||||
public:
|
||||
|
||||
enum SequenceItemFlag
|
||||
{
|
||||
None = 0x0000,
|
||||
MovedLeft = 0x0001, ///< Item has been moved from this position (is present in a sequence no. 1)
|
||||
MovedRight = 0x0002, ///< Item has been moved to this position (is present in a sequence no. 2)
|
||||
Moved = 0x0004, ///< Index of item has been changed
|
||||
Added = 0x0008, ///< Item has been added to a sequence no. 2
|
||||
Removed = 0x0010, ///< Item has been removed from a sequence no. 1
|
||||
Replaced = 0x0020, ///< Item has been replaced (or sequence of items has been replaced)
|
||||
};
|
||||
Q_DECLARE_FLAGS(SequenceItemFlags, SequenceItemFlag)
|
||||
|
||||
struct SequenceItem
|
||||
{
|
||||
size_t index1 = std::numeric_limits<size_t>::max();
|
||||
size_t index2 = std::numeric_limits<size_t>::max();
|
||||
SequenceItemFlags flags = None;
|
||||
|
||||
bool isLeftValid() const { return index1 != std::numeric_limits<size_t>::max(); }
|
||||
bool isRightValid() const { return index2 != std::numeric_limits<size_t>::max(); }
|
||||
bool isLeft() const { return isLeftValid() && !isRightValid(); }
|
||||
bool isRight() const { return isRightValid() && !isLeftValid(); }
|
||||
bool isMatch() const { return isLeftValid() && isRightValid(); }
|
||||
bool isMovedLeft() const { return flags.testFlag(MovedLeft); }
|
||||
bool isMovedRight() const { return flags.testFlag(MovedRight); }
|
||||
bool isMoved() const { return flags.testFlag(Moved); }
|
||||
bool isAdded() const { return flags.testFlag(Added); }
|
||||
bool isRemoved() const { return flags.testFlag(Removed); }
|
||||
bool isReplaced() const { return flags.testFlag(Replaced); }
|
||||
bool isModified() const { return isAdded() || isRemoved() || isReplaced(); }
|
||||
|
||||
void markMovedLeft() { flags.setFlag(MovedLeft); }
|
||||
void markMovedRight() { flags.setFlag(MovedRight); }
|
||||
void markMoved() { flags.setFlag(Moved); }
|
||||
void markAdded() { flags.setFlag(Added); }
|
||||
void markRemoved() { flags.setFlag(Removed); }
|
||||
void markReplaced() { flags.setFlag(Replaced); }
|
||||
};
|
||||
|
||||
using Sequence = typename std::vector<SequenceItem>;
|
||||
using SequenceIterator = typename Sequence::iterator;
|
||||
using SequenceItemRange = typename std::pair<SequenceIterator, SequenceIterator>;
|
||||
using SequenceItemRanges = typename std::vector<SequenceItemRange>;
|
||||
|
||||
/// Marks a sequence with set of flags representing added/removed/replaced/moved
|
||||
/// items. Moved items sequences must be sorted.
|
||||
/// \param sequence Sequence to be marked
|
||||
/// \param movedItemsLeft Sorted sequence of left indices, which have been moved
|
||||
/// \param movedItemsRight sorted sequence of right indices, which have been moved
|
||||
static void markSequence(Sequence& sequence,
|
||||
const std::vector<size_t>& movedItemsLeft,
|
||||
const std::vector<size_t>& movedItemsRight);
|
||||
|
||||
/// Returns item ranges, which should be checked - for example,
|
||||
/// for text modification.
|
||||
/// \param sequence Sequence
|
||||
static SequenceItemRanges getModifiedRanges(Sequence& sequence);
|
||||
|
||||
/// Collect flags from given item range
|
||||
/// \param range Range
|
||||
static SequenceItemFlags collectFlags(const SequenceItemRange& range);
|
||||
};
|
||||
|
||||
/// Algorithm for computing longest common subsequence, on two sequences
|
||||
/// of objects, which are implementing operator "==" (equal operator).
|
||||
/// Constructor takes bidirectional iterators to the sequence. So, iterators
|
||||
/// are requred to be bidirectional.
|
||||
template<typename Iterator, typename Comparator>
|
||||
class PDFAlgorithmLongestCommonSubsequence : public PDFAlgorithmLongestCommonSubsequenceBase
|
||||
{
|
||||
public:
|
||||
PDFAlgorithmLongestCommonSubsequence(Iterator it1,
|
||||
Iterator it1End,
|
||||
Iterator it2,
|
||||
Iterator it2End,
|
||||
Comparator comparator);
|
||||
|
||||
|
||||
void perform();
|
||||
|
||||
const Sequence& getSequence() const { return m_sequence; }
|
||||
|
||||
private:
|
||||
Iterator m_it1;
|
||||
Iterator m_it1End;
|
||||
Iterator m_it2;
|
||||
Iterator m_it2End;
|
||||
|
||||
size_t m_size1;
|
||||
size_t m_size2;
|
||||
size_t m_matrixSize;
|
||||
|
||||
Comparator m_comparator;
|
||||
|
||||
std::vector<bool> m_backtrackData;
|
||||
Sequence m_sequence;
|
||||
};
|
||||
|
||||
template<typename Iterator, typename Comparator>
|
||||
PDFAlgorithmLongestCommonSubsequence<Iterator, Comparator>::PDFAlgorithmLongestCommonSubsequence(Iterator it1,
|
||||
Iterator it1End,
|
||||
Iterator it2,
|
||||
Iterator it2End,
|
||||
Comparator comparator) :
|
||||
m_it1(std::move(it1)),
|
||||
m_it1End(std::move(it1End)),
|
||||
m_it2(std::move(it2)),
|
||||
m_it2End(std::move(it2End)),
|
||||
m_size1(0),
|
||||
m_size2(0),
|
||||
m_matrixSize(0),
|
||||
m_comparator(std::move(comparator))
|
||||
{
|
||||
m_size1 = std::distance(m_it1, m_it1End) + 1;
|
||||
m_size2 = std::distance(m_it2, m_it2End) + 1;
|
||||
m_matrixSize = m_size1 * m_size2;
|
||||
}
|
||||
|
||||
template<typename Iterator, typename Comparator>
|
||||
void PDFAlgorithmLongestCommonSubsequence<Iterator, Comparator>::perform()
|
||||
{
|
||||
m_backtrackData.resize(m_matrixSize);
|
||||
m_sequence.clear();
|
||||
|
||||
std::vector<size_t> rowTop(m_size1, size_t());
|
||||
std::vector<size_t> rowBottom(m_size1, size_t());
|
||||
|
||||
// Jakub Melka: we will have columns consisting of it1...it1End
|
||||
// and rows consisting of it2...it2End. We iterate trough rows,
|
||||
// and for each row, we update longest common subsequence data.
|
||||
|
||||
auto it2 = m_it2;
|
||||
for (size_t i2 = 1; i2 < m_size2; ++i2, ++it2)
|
||||
{
|
||||
auto it1 = m_it1;
|
||||
for (size_t i1 = 1; i1 < m_size1; ++i1, ++it1)
|
||||
{
|
||||
if (m_comparator(*it1, *it2))
|
||||
{
|
||||
// We have match
|
||||
rowBottom[i1] = rowTop[i1 - 1] + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
const size_t leftCellValue = rowBottom[i1 - 1];
|
||||
const size_t upperCellValue = rowTop[i1];
|
||||
bool isLeftBigger = leftCellValue > upperCellValue;
|
||||
|
||||
if (isLeftBigger)
|
||||
{
|
||||
rowBottom[i1] = leftCellValue;
|
||||
m_backtrackData[i2 * m_size1 + i1] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
rowBottom[i1] = upperCellValue;
|
||||
m_backtrackData[i2 * m_size1 + i1] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bottom row will become top row
|
||||
std::swap(rowTop, rowBottom);
|
||||
}
|
||||
|
||||
size_t i1 = m_size1 - 1;
|
||||
size_t i2 = m_size2 - 1;
|
||||
|
||||
while (i1 > 0 && i2 > 0)
|
||||
{
|
||||
SequenceItem item;
|
||||
|
||||
const size_t index1 = i1 - 1;
|
||||
const size_t index2 = i2 - 1;
|
||||
|
||||
auto it1 = std::next(m_it1, index1);
|
||||
auto it2 = std::next(m_it2, index2);
|
||||
|
||||
if (m_comparator(*it1, *it2))
|
||||
{
|
||||
item.index1 = index1;
|
||||
item.index2 = index2;
|
||||
|
||||
--i1;
|
||||
--i2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_backtrackData[i2 * m_size1 + i1])
|
||||
{
|
||||
item.index1 = index1;
|
||||
--i1;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.index2 = index2;
|
||||
--i2;
|
||||
}
|
||||
}
|
||||
|
||||
m_sequence.push_back(item);
|
||||
}
|
||||
|
||||
while (i1 > 0)
|
||||
{
|
||||
SequenceItem item;
|
||||
|
||||
const size_t index1 = i1 - 1;
|
||||
item.index1 = index1;
|
||||
--i1;
|
||||
|
||||
m_sequence.push_back(item);
|
||||
}
|
||||
|
||||
while (i2 > 0)
|
||||
{
|
||||
SequenceItem item;
|
||||
|
||||
const size_t index2 = i2 - 1;
|
||||
item.index2 = index2;
|
||||
--i2;
|
||||
|
||||
m_sequence.push_back(item);
|
||||
}
|
||||
|
||||
std::reverse(m_sequence.begin(), m_sequence.end());
|
||||
}
|
||||
|
||||
} // namespace pdf
|
||||
|
||||
#endif // PDFALGORITHMLCS_H
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef PDFALGORITHMLCS_H
|
||||
#define PDFALGORITHMLCS_H
|
||||
|
||||
#include "pdfglobal.h"
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
class PDFAlgorithmLongestCommonSubsequenceBase
|
||||
{
|
||||
public:
|
||||
|
||||
enum SequenceItemFlag
|
||||
{
|
||||
None = 0x0000,
|
||||
MovedLeft = 0x0001, ///< Item has been moved from this position (is present in a sequence no. 1)
|
||||
MovedRight = 0x0002, ///< Item has been moved to this position (is present in a sequence no. 2)
|
||||
Moved = 0x0004, ///< Index of item has been changed
|
||||
Added = 0x0008, ///< Item has been added to a sequence no. 2
|
||||
Removed = 0x0010, ///< Item has been removed from a sequence no. 1
|
||||
Replaced = 0x0020, ///< Item has been replaced (or sequence of items has been replaced)
|
||||
};
|
||||
Q_DECLARE_FLAGS(SequenceItemFlags, SequenceItemFlag)
|
||||
|
||||
struct SequenceItem
|
||||
{
|
||||
size_t index1 = std::numeric_limits<size_t>::max();
|
||||
size_t index2 = std::numeric_limits<size_t>::max();
|
||||
SequenceItemFlags flags = None;
|
||||
|
||||
bool isLeftValid() const { return index1 != std::numeric_limits<size_t>::max(); }
|
||||
bool isRightValid() const { return index2 != std::numeric_limits<size_t>::max(); }
|
||||
bool isLeft() const { return isLeftValid() && !isRightValid(); }
|
||||
bool isRight() const { return isRightValid() && !isLeftValid(); }
|
||||
bool isMatch() const { return isLeftValid() && isRightValid(); }
|
||||
bool isMovedLeft() const { return flags.testFlag(MovedLeft); }
|
||||
bool isMovedRight() const { return flags.testFlag(MovedRight); }
|
||||
bool isMoved() const { return flags.testFlag(Moved); }
|
||||
bool isAdded() const { return flags.testFlag(Added); }
|
||||
bool isRemoved() const { return flags.testFlag(Removed); }
|
||||
bool isReplaced() const { return flags.testFlag(Replaced); }
|
||||
bool isModified() const { return isAdded() || isRemoved() || isReplaced(); }
|
||||
|
||||
void markMovedLeft() { flags.setFlag(MovedLeft); }
|
||||
void markMovedRight() { flags.setFlag(MovedRight); }
|
||||
void markMoved() { flags.setFlag(Moved); }
|
||||
void markAdded() { flags.setFlag(Added); }
|
||||
void markRemoved() { flags.setFlag(Removed); }
|
||||
void markReplaced() { flags.setFlag(Replaced); }
|
||||
};
|
||||
|
||||
using Sequence = typename std::vector<SequenceItem>;
|
||||
using SequenceIterator = typename Sequence::iterator;
|
||||
using SequenceItemRange = typename std::pair<SequenceIterator, SequenceIterator>;
|
||||
using SequenceItemRanges = typename std::vector<SequenceItemRange>;
|
||||
|
||||
/// Marks a sequence with set of flags representing added/removed/replaced/moved
|
||||
/// items. Moved items sequences must be sorted.
|
||||
/// \param sequence Sequence to be marked
|
||||
/// \param movedItemsLeft Sorted sequence of left indices, which have been moved
|
||||
/// \param movedItemsRight sorted sequence of right indices, which have been moved
|
||||
static void markSequence(Sequence& sequence,
|
||||
const std::vector<size_t>& movedItemsLeft,
|
||||
const std::vector<size_t>& movedItemsRight);
|
||||
|
||||
/// Returns item ranges, which should be checked - for example,
|
||||
/// for text modification.
|
||||
/// \param sequence Sequence
|
||||
static SequenceItemRanges getModifiedRanges(Sequence& sequence);
|
||||
|
||||
/// Collect flags from given item range
|
||||
/// \param range Range
|
||||
static SequenceItemFlags collectFlags(const SequenceItemRange& range);
|
||||
};
|
||||
|
||||
/// Algorithm for computing longest common subsequence, on two sequences
|
||||
/// of objects, which are implementing operator "==" (equal operator).
|
||||
/// Constructor takes bidirectional iterators to the sequence. So, iterators
|
||||
/// are requred to be bidirectional.
|
||||
template<typename Iterator, typename Comparator>
|
||||
class PDFAlgorithmLongestCommonSubsequence : public PDFAlgorithmLongestCommonSubsequenceBase
|
||||
{
|
||||
public:
|
||||
PDFAlgorithmLongestCommonSubsequence(Iterator it1,
|
||||
Iterator it1End,
|
||||
Iterator it2,
|
||||
Iterator it2End,
|
||||
Comparator comparator);
|
||||
|
||||
|
||||
void perform();
|
||||
|
||||
const Sequence& getSequence() const { return m_sequence; }
|
||||
|
||||
private:
|
||||
Iterator m_it1;
|
||||
Iterator m_it1End;
|
||||
Iterator m_it2;
|
||||
Iterator m_it2End;
|
||||
|
||||
size_t m_size1;
|
||||
size_t m_size2;
|
||||
size_t m_matrixSize;
|
||||
|
||||
Comparator m_comparator;
|
||||
|
||||
std::vector<bool> m_backtrackData;
|
||||
Sequence m_sequence;
|
||||
};
|
||||
|
||||
template<typename Iterator, typename Comparator>
|
||||
PDFAlgorithmLongestCommonSubsequence<Iterator, Comparator>::PDFAlgorithmLongestCommonSubsequence(Iterator it1,
|
||||
Iterator it1End,
|
||||
Iterator it2,
|
||||
Iterator it2End,
|
||||
Comparator comparator) :
|
||||
m_it1(std::move(it1)),
|
||||
m_it1End(std::move(it1End)),
|
||||
m_it2(std::move(it2)),
|
||||
m_it2End(std::move(it2End)),
|
||||
m_size1(0),
|
||||
m_size2(0),
|
||||
m_matrixSize(0),
|
||||
m_comparator(std::move(comparator))
|
||||
{
|
||||
m_size1 = std::distance(m_it1, m_it1End) + 1;
|
||||
m_size2 = std::distance(m_it2, m_it2End) + 1;
|
||||
m_matrixSize = m_size1 * m_size2;
|
||||
}
|
||||
|
||||
template<typename Iterator, typename Comparator>
|
||||
void PDFAlgorithmLongestCommonSubsequence<Iterator, Comparator>::perform()
|
||||
{
|
||||
m_backtrackData.resize(m_matrixSize);
|
||||
m_sequence.clear();
|
||||
|
||||
std::vector<size_t> rowTop(m_size1, size_t());
|
||||
std::vector<size_t> rowBottom(m_size1, size_t());
|
||||
|
||||
// Jakub Melka: we will have columns consisting of it1...it1End
|
||||
// and rows consisting of it2...it2End. We iterate trough rows,
|
||||
// and for each row, we update longest common subsequence data.
|
||||
|
||||
auto it2 = m_it2;
|
||||
for (size_t i2 = 1; i2 < m_size2; ++i2, ++it2)
|
||||
{
|
||||
auto it1 = m_it1;
|
||||
for (size_t i1 = 1; i1 < m_size1; ++i1, ++it1)
|
||||
{
|
||||
if (m_comparator(*it1, *it2))
|
||||
{
|
||||
// We have match
|
||||
rowBottom[i1] = rowTop[i1 - 1] + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
const size_t leftCellValue = rowBottom[i1 - 1];
|
||||
const size_t upperCellValue = rowTop[i1];
|
||||
bool isLeftBigger = leftCellValue > upperCellValue;
|
||||
|
||||
if (isLeftBigger)
|
||||
{
|
||||
rowBottom[i1] = leftCellValue;
|
||||
m_backtrackData[i2 * m_size1 + i1] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
rowBottom[i1] = upperCellValue;
|
||||
m_backtrackData[i2 * m_size1 + i1] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bottom row will become top row
|
||||
std::swap(rowTop, rowBottom);
|
||||
}
|
||||
|
||||
size_t i1 = m_size1 - 1;
|
||||
size_t i2 = m_size2 - 1;
|
||||
|
||||
while (i1 > 0 && i2 > 0)
|
||||
{
|
||||
SequenceItem item;
|
||||
|
||||
const size_t index1 = i1 - 1;
|
||||
const size_t index2 = i2 - 1;
|
||||
|
||||
auto it1 = std::next(m_it1, index1);
|
||||
auto it2 = std::next(m_it2, index2);
|
||||
|
||||
if (m_comparator(*it1, *it2))
|
||||
{
|
||||
item.index1 = index1;
|
||||
item.index2 = index2;
|
||||
|
||||
--i1;
|
||||
--i2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_backtrackData[i2 * m_size1 + i1])
|
||||
{
|
||||
item.index1 = index1;
|
||||
--i1;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.index2 = index2;
|
||||
--i2;
|
||||
}
|
||||
}
|
||||
|
||||
m_sequence.push_back(item);
|
||||
}
|
||||
|
||||
while (i1 > 0)
|
||||
{
|
||||
SequenceItem item;
|
||||
|
||||
const size_t index1 = i1 - 1;
|
||||
item.index1 = index1;
|
||||
--i1;
|
||||
|
||||
m_sequence.push_back(item);
|
||||
}
|
||||
|
||||
while (i2 > 0)
|
||||
{
|
||||
SequenceItem item;
|
||||
|
||||
const size_t index2 = i2 - 1;
|
||||
item.index2 = index2;
|
||||
--i2;
|
||||
|
||||
m_sequence.push_back(item);
|
||||
}
|
||||
|
||||
std::reverse(m_sequence.begin(), m_sequence.end());
|
||||
}
|
||||
|
||||
} // namespace pdf
|
||||
|
||||
#endif // PDFALGORITHMLCS_H
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,223 +1,223 @@
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef PDFDIFF_H
|
||||
#define PDFDIFF_H
|
||||
|
||||
#include "pdfdocument.h"
|
||||
#include "pdfprogress.h"
|
||||
#include "pdfutils.h"
|
||||
#include "pdfalgorithmlcs.h"
|
||||
#include "pdfdocumenttextflow.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QFuture>
|
||||
#include <QFutureWatcher>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
struct PDFDiffPageContext;
|
||||
|
||||
class PDFDiffResult
|
||||
{
|
||||
public:
|
||||
explicit PDFDiffResult();
|
||||
|
||||
enum class Type
|
||||
{
|
||||
Invalid,
|
||||
PageMoved,
|
||||
PageAdded,
|
||||
PageRemoved,
|
||||
RemovedTextCharContent,
|
||||
RemovedVectorGraphicContent,
|
||||
RemovedImageContent,
|
||||
RemovedShadingContent,
|
||||
AddedTextCharContent,
|
||||
AddedVectorGraphicContent,
|
||||
AddedImageContent,
|
||||
AddedShadingContent,
|
||||
};
|
||||
|
||||
struct Difference
|
||||
{
|
||||
Type type = Type::Invalid;
|
||||
PDFInteger pageIndex1 = -1;
|
||||
PDFInteger pageIndex2 = -1;
|
||||
size_t leftRectIndex = 0;
|
||||
size_t leftRectCount = 0;
|
||||
size_t rightRectIndex = 0;
|
||||
size_t rightRectCount = 0;
|
||||
};
|
||||
|
||||
using Differences = std::vector<Difference>;
|
||||
|
||||
void setResult(PDFOperationResult result) { m_result = std::move(result); }
|
||||
const PDFOperationResult& getResult() const { return m_result; }
|
||||
|
||||
void addPageMoved(PDFInteger pageIndex1, PDFInteger pageIndex2);
|
||||
void addPageAdded(PDFInteger pageIndex);
|
||||
void addPageRemoved(PDFInteger pageIndex);
|
||||
|
||||
void addRemovedTextCharContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addRemovedVectorGraphicContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addRemovedImageContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addRemovedShadingContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addAddedTextCharContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addAddedVectorGraphicContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addAddedImageContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addAddedShadingContent(PDFInteger pageIndex, QRectF rect);
|
||||
|
||||
QString getMessage(size_t index) const;
|
||||
|
||||
private:
|
||||
void addLeftItem(Type type, PDFInteger pageIndex, QRectF rect);
|
||||
void addRightItem(Type type, PDFInteger pageIndex, QRectF rect);
|
||||
|
||||
void addRectLeft(Difference& difference, QRectF rect);
|
||||
void addRectRight(Difference& difference, QRectF rect);
|
||||
|
||||
Differences m_differences;
|
||||
std::vector<QRectF> m_rects;
|
||||
PDFOperationResult m_result;
|
||||
};
|
||||
|
||||
/// Diff engine for comparing two pdf documents.
|
||||
class PDF4QTLIBSHARED_EXPORT PDFDiff : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
using BaseClass = QObject;
|
||||
|
||||
public:
|
||||
explicit PDFDiff(QObject* parent);
|
||||
virtual ~PDFDiff() override;
|
||||
|
||||
enum Option
|
||||
{
|
||||
None = 0x0000,
|
||||
Asynchronous = 0x0001, ///< Compare document asynchronously
|
||||
PC_Text = 0x0002, ///< Use text to compare pages (determine, which pages correspond to each other)
|
||||
PC_VectorGraphics = 0x0004, ///< Use vector graphics to compare pages (determine, which pages correspond to each other)
|
||||
PC_Images = 0x0008, ///< Use images to compare pages (determine, which pages correspond to each other)
|
||||
PC_Mesh = 0x0010, ///< Use mesh to compare pages (determine, which pages correspond to each other)
|
||||
CompareTextsAsVector = 0x0020, ///< Compare texts as vector graphics
|
||||
CompareWords = 0x0040, ///< Compare words, not just characters
|
||||
};
|
||||
Q_DECLARE_FLAGS(Options, Option)
|
||||
|
||||
/// Source document (left)
|
||||
/// \param leftDocument Document
|
||||
void setLeftDocument(const PDFDocument* leftDocument);
|
||||
|
||||
/// Source document (right)(
|
||||
/// \param rightDocument Document
|
||||
void setRightDocument(const PDFDocument* rightDocument);
|
||||
|
||||
/// Source pages to be compared (left document)
|
||||
/// \param pagesForLeftDocument Page indices
|
||||
void setPagesForLeftDocument(PDFClosedIntervalSet pagesForLeftDocument);
|
||||
|
||||
/// Source pages to be compared (right document)
|
||||
/// \param pagesForRightDocument Page indices
|
||||
void setPagesForRightDocument(PDFClosedIntervalSet pagesForRightDocument);
|
||||
|
||||
/// Sets progress object
|
||||
/// \param progress Progress object
|
||||
void setProgress(PDFProgress* progress) { m_progress = progress; }
|
||||
|
||||
/// Enables or disables comparator engine option
|
||||
/// \param option Option
|
||||
/// \param enable Enable or disable option?
|
||||
void setOption(Option option, bool enable) { m_options.setFlag(option, enable); }
|
||||
|
||||
/// Starts comparator engine. If asynchronous engine option
|
||||
/// is enabled, then separate thread is started, in which two
|
||||
/// document is compared, and then signal \p comparationFinished,
|
||||
/// otherwise this function is blocking until comparation process
|
||||
/// is finished.
|
||||
void start();
|
||||
|
||||
/// Stops comparator engine. Result data are cleared.
|
||||
void stop();
|
||||
|
||||
/// Returns result of a comparation process
|
||||
const PDFDiffResult& getResult() const { return m_result; }
|
||||
|
||||
PDFDocumentTextFlowFactory::Algorithm getTextAnalysisAlgorithm() const;
|
||||
void setTextAnalysisAlgorithm(PDFDocumentTextFlowFactory::Algorithm textAnalysisAlgorithm);
|
||||
|
||||
signals:
|
||||
void comparationFinished();
|
||||
|
||||
private:
|
||||
|
||||
enum Steps
|
||||
{
|
||||
StepExtractContentLeftDocument,
|
||||
StepExtractContentRightDocument,
|
||||
StepMatchPages,
|
||||
StepExtractTextLeftDocument,
|
||||
StepExtractTextRightDocument,
|
||||
StepCompare,
|
||||
StepLast
|
||||
};
|
||||
|
||||
PDFDiffResult perform();
|
||||
void stepProgress();
|
||||
void performSteps(const std::vector<PDFInteger>& leftPages,
|
||||
const std::vector<PDFInteger>& rightPages);
|
||||
void performPageMatching(const std::vector<PDFDiffPageContext>& leftPreparedPages,
|
||||
const std::vector<PDFDiffPageContext>& rightPreparedPages,
|
||||
PDFAlgorithmLongestCommonSubsequenceBase::Sequence& pageSequence,
|
||||
std::map<size_t, size_t>& pageMatches);
|
||||
void performCompare(const std::vector<PDFDiffPageContext>& leftPreparedPages,
|
||||
const std::vector<PDFDiffPageContext>& rightPreparedPages,
|
||||
PDFAlgorithmLongestCommonSubsequenceBase::Sequence& pageSequence,
|
||||
const std::map<size_t, size_t>& pageMatches);
|
||||
void finalizeGraphicsPieces(PDFDiffPageContext& context);
|
||||
|
||||
void onComparationPerformed();
|
||||
|
||||
/// Calculates real epsilon for a page. Epsilon is used in page
|
||||
/// comparation process, where points closer that epsilon
|
||||
/// are recognized as equal.
|
||||
/// \param page Page
|
||||
PDFReal calculateEpsilonForPage(const PDFPage* page) const;
|
||||
|
||||
PDFProgress* m_progress;
|
||||
const PDFDocument* m_leftDocument;
|
||||
const PDFDocument* m_rightDocument;
|
||||
PDFClosedIntervalSet m_pagesForLeftDocument;
|
||||
PDFClosedIntervalSet m_pagesForRightDocument;
|
||||
Options m_options;
|
||||
PDFReal m_epsilon;
|
||||
std::atomic_bool m_cancelled;
|
||||
PDFDiffResult m_result;
|
||||
PDFDocumentTextFlowFactory::Algorithm m_textAnalysisAlgorithm;
|
||||
|
||||
QFuture<PDFDiffResult> m_future;
|
||||
std::optional<QFutureWatcher<PDFDiffResult>> m_futureWatcher;
|
||||
};
|
||||
|
||||
} // namespace pdf
|
||||
|
||||
#endif // PDFDIFF_H
|
||||
// Copyright (C) 2021 Jakub Melka
|
||||
//
|
||||
// This file is part of PDF4QT.
|
||||
//
|
||||
// PDF4QT is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// with the written consent of the copyright owner, any later version.
|
||||
//
|
||||
// PDF4QT is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef PDFDIFF_H
|
||||
#define PDFDIFF_H
|
||||
|
||||
#include "pdfdocument.h"
|
||||
#include "pdfprogress.h"
|
||||
#include "pdfutils.h"
|
||||
#include "pdfalgorithmlcs.h"
|
||||
#include "pdfdocumenttextflow.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QFuture>
|
||||
#include <QFutureWatcher>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
struct PDFDiffPageContext;
|
||||
|
||||
class PDFDiffResult
|
||||
{
|
||||
public:
|
||||
explicit PDFDiffResult();
|
||||
|
||||
enum class Type
|
||||
{
|
||||
Invalid,
|
||||
PageMoved,
|
||||
PageAdded,
|
||||
PageRemoved,
|
||||
RemovedTextCharContent,
|
||||
RemovedVectorGraphicContent,
|
||||
RemovedImageContent,
|
||||
RemovedShadingContent,
|
||||
AddedTextCharContent,
|
||||
AddedVectorGraphicContent,
|
||||
AddedImageContent,
|
||||
AddedShadingContent,
|
||||
};
|
||||
|
||||
struct Difference
|
||||
{
|
||||
Type type = Type::Invalid;
|
||||
PDFInteger pageIndex1 = -1;
|
||||
PDFInteger pageIndex2 = -1;
|
||||
size_t leftRectIndex = 0;
|
||||
size_t leftRectCount = 0;
|
||||
size_t rightRectIndex = 0;
|
||||
size_t rightRectCount = 0;
|
||||
};
|
||||
|
||||
using Differences = std::vector<Difference>;
|
||||
|
||||
void setResult(PDFOperationResult result) { m_result = std::move(result); }
|
||||
const PDFOperationResult& getResult() const { return m_result; }
|
||||
|
||||
void addPageMoved(PDFInteger pageIndex1, PDFInteger pageIndex2);
|
||||
void addPageAdded(PDFInteger pageIndex);
|
||||
void addPageRemoved(PDFInteger pageIndex);
|
||||
|
||||
void addRemovedTextCharContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addRemovedVectorGraphicContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addRemovedImageContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addRemovedShadingContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addAddedTextCharContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addAddedVectorGraphicContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addAddedImageContent(PDFInteger pageIndex, QRectF rect);
|
||||
void addAddedShadingContent(PDFInteger pageIndex, QRectF rect);
|
||||
|
||||
QString getMessage(size_t index) const;
|
||||
|
||||
private:
|
||||
void addLeftItem(Type type, PDFInteger pageIndex, QRectF rect);
|
||||
void addRightItem(Type type, PDFInteger pageIndex, QRectF rect);
|
||||
|
||||
void addRectLeft(Difference& difference, QRectF rect);
|
||||
void addRectRight(Difference& difference, QRectF rect);
|
||||
|
||||
Differences m_differences;
|
||||
std::vector<QRectF> m_rects;
|
||||
PDFOperationResult m_result;
|
||||
};
|
||||
|
||||
/// Diff engine for comparing two pdf documents.
|
||||
class PDF4QTLIBSHARED_EXPORT PDFDiff : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
using BaseClass = QObject;
|
||||
|
||||
public:
|
||||
explicit PDFDiff(QObject* parent);
|
||||
virtual ~PDFDiff() override;
|
||||
|
||||
enum Option
|
||||
{
|
||||
None = 0x0000,
|
||||
Asynchronous = 0x0001, ///< Compare document asynchronously
|
||||
PC_Text = 0x0002, ///< Use text to compare pages (determine, which pages correspond to each other)
|
||||
PC_VectorGraphics = 0x0004, ///< Use vector graphics to compare pages (determine, which pages correspond to each other)
|
||||
PC_Images = 0x0008, ///< Use images to compare pages (determine, which pages correspond to each other)
|
||||
PC_Mesh = 0x0010, ///< Use mesh to compare pages (determine, which pages correspond to each other)
|
||||
CompareTextsAsVector = 0x0020, ///< Compare texts as vector graphics
|
||||
CompareWords = 0x0040, ///< Compare words, not just characters
|
||||
};
|
||||
Q_DECLARE_FLAGS(Options, Option)
|
||||
|
||||
/// Source document (left)
|
||||
/// \param leftDocument Document
|
||||
void setLeftDocument(const PDFDocument* leftDocument);
|
||||
|
||||
/// Source document (right)(
|
||||
/// \param rightDocument Document
|
||||
void setRightDocument(const PDFDocument* rightDocument);
|
||||
|
||||
/// Source pages to be compared (left document)
|
||||
/// \param pagesForLeftDocument Page indices
|
||||
void setPagesForLeftDocument(PDFClosedIntervalSet pagesForLeftDocument);
|
||||
|
||||
/// Source pages to be compared (right document)
|
||||
/// \param pagesForRightDocument Page indices
|
||||
void setPagesForRightDocument(PDFClosedIntervalSet pagesForRightDocument);
|
||||
|
||||
/// Sets progress object
|
||||
/// \param progress Progress object
|
||||
void setProgress(PDFProgress* progress) { m_progress = progress; }
|
||||
|
||||
/// Enables or disables comparator engine option
|
||||
/// \param option Option
|
||||
/// \param enable Enable or disable option?
|
||||
void setOption(Option option, bool enable) { m_options.setFlag(option, enable); }
|
||||
|
||||
/// Starts comparator engine. If asynchronous engine option
|
||||
/// is enabled, then separate thread is started, in which two
|
||||
/// document is compared, and then signal \p comparationFinished,
|
||||
/// otherwise this function is blocking until comparation process
|
||||
/// is finished.
|
||||
void start();
|
||||
|
||||
/// Stops comparator engine. Result data are cleared.
|
||||
void stop();
|
||||
|
||||
/// Returns result of a comparation process
|
||||
const PDFDiffResult& getResult() const { return m_result; }
|
||||
|
||||
PDFDocumentTextFlowFactory::Algorithm getTextAnalysisAlgorithm() const;
|
||||
void setTextAnalysisAlgorithm(PDFDocumentTextFlowFactory::Algorithm textAnalysisAlgorithm);
|
||||
|
||||
signals:
|
||||
void comparationFinished();
|
||||
|
||||
private:
|
||||
|
||||
enum Steps
|
||||
{
|
||||
StepExtractContentLeftDocument,
|
||||
StepExtractContentRightDocument,
|
||||
StepMatchPages,
|
||||
StepExtractTextLeftDocument,
|
||||
StepExtractTextRightDocument,
|
||||
StepCompare,
|
||||
StepLast
|
||||
};
|
||||
|
||||
PDFDiffResult perform();
|
||||
void stepProgress();
|
||||
void performSteps(const std::vector<PDFInteger>& leftPages,
|
||||
const std::vector<PDFInteger>& rightPages);
|
||||
void performPageMatching(const std::vector<PDFDiffPageContext>& leftPreparedPages,
|
||||
const std::vector<PDFDiffPageContext>& rightPreparedPages,
|
||||
PDFAlgorithmLongestCommonSubsequenceBase::Sequence& pageSequence,
|
||||
std::map<size_t, size_t>& pageMatches);
|
||||
void performCompare(const std::vector<PDFDiffPageContext>& leftPreparedPages,
|
||||
const std::vector<PDFDiffPageContext>& rightPreparedPages,
|
||||
PDFAlgorithmLongestCommonSubsequenceBase::Sequence& pageSequence,
|
||||
const std::map<size_t, size_t>& pageMatches);
|
||||
void finalizeGraphicsPieces(PDFDiffPageContext& context);
|
||||
|
||||
void onComparationPerformed();
|
||||
|
||||
/// Calculates real epsilon for a page. Epsilon is used in page
|
||||
/// comparation process, where points closer that epsilon
|
||||
/// are recognized as equal.
|
||||
/// \param page Page
|
||||
PDFReal calculateEpsilonForPage(const PDFPage* page) const;
|
||||
|
||||
PDFProgress* m_progress;
|
||||
const PDFDocument* m_leftDocument;
|
||||
const PDFDocument* m_rightDocument;
|
||||
PDFClosedIntervalSet m_pagesForLeftDocument;
|
||||
PDFClosedIntervalSet m_pagesForRightDocument;
|
||||
Options m_options;
|
||||
PDFReal m_epsilon;
|
||||
std::atomic_bool m_cancelled;
|
||||
PDFDiffResult m_result;
|
||||
PDFDocumentTextFlowFactory::Algorithm m_textAnalysisAlgorithm;
|
||||
|
||||
QFuture<PDFDiffResult> m_future;
|
||||
std::optional<QFutureWatcher<PDFDiffResult>> m_futureWatcher;
|
||||
};
|
||||
|
||||
} // namespace pdf
|
||||
|
||||
#endif // PDFDIFF_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user