mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2024-12-25 07:51:42 +01:00
Issue #182: PDF4QT Document Diff command line cmd line arguments ignored
This commit is contained in:
parent
1e79871b9b
commit
625a4307d0
@ -16,6 +16,7 @@
|
||||
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "pdfconstants.h"
|
||||
#include "pdfdocumentreader.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
@ -44,5 +45,40 @@ int main(int argc, char *argv[])
|
||||
pdfdiff::MainWindow mainWindow(nullptr);
|
||||
mainWindow.show();
|
||||
|
||||
QStringList positionalArguments = parser.positionalArguments();
|
||||
|
||||
if (positionalArguments.size() >= 1)
|
||||
{
|
||||
bool leftDocumentIsOK = false;
|
||||
bool rightDocumentIsOk = false;
|
||||
|
||||
pdf::PDFDocumentReader reader(nullptr, [](bool* ok) { *ok = false; return QString(); }, true, false);
|
||||
pdf::PDFDocument documentLeft = reader.readFromFile(positionalArguments.front());
|
||||
|
||||
if (reader.getReadingResult() == pdf::PDFDocumentReader::Result::OK)
|
||||
{
|
||||
leftDocumentIsOK = true;
|
||||
mainWindow.setLeftDocument(std::move(documentLeft));
|
||||
}
|
||||
|
||||
if (positionalArguments.size() >= 2)
|
||||
{
|
||||
pdf::PDFDocument documentRight = reader.readFromFile(positionalArguments[1]);
|
||||
|
||||
if (reader.getReadingResult() == pdf::PDFDocumentReader::Result::OK)
|
||||
{
|
||||
rightDocumentIsOk = true;
|
||||
mainWindow.setRightDocument(std::move(documentRight));
|
||||
}
|
||||
}
|
||||
|
||||
mainWindow.updateViewDocument();
|
||||
|
||||
if (leftDocumentIsOK && rightDocumentIsOk && mainWindow.canPerformOperation(pdfdiff::MainWindow::Operation::Compare))
|
||||
{
|
||||
mainWindow.performOperation(pdfdiff::MainWindow::Operation::Compare);
|
||||
}
|
||||
}
|
||||
|
||||
return application.exec();
|
||||
}
|
||||
|
@ -458,22 +458,7 @@ void MainWindow::performOperation(Operation operation)
|
||||
if (document)
|
||||
{
|
||||
clear(true, false);
|
||||
m_leftDocument = std::move(*document);
|
||||
|
||||
const size_t pageCount = m_leftDocument.getCatalog()->getPageCount();
|
||||
if (pageCount > 1)
|
||||
{
|
||||
m_settingsDockWidget->getLeftPageSelectionEdit()->setText(QString("1-%2").arg(pageCount));
|
||||
}
|
||||
else if (pageCount == 1)
|
||||
{
|
||||
m_settingsDockWidget->getLeftPageSelectionEdit()->setText("1");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settingsDockWidget->getLeftPageSelectionEdit()->clear();
|
||||
}
|
||||
|
||||
setLeftDocument(std::move(*document));
|
||||
updateViewDocument();
|
||||
}
|
||||
|
||||
@ -489,22 +474,7 @@ void MainWindow::performOperation(Operation operation)
|
||||
if (document)
|
||||
{
|
||||
clear(false, true);
|
||||
m_rightDocument = std::move(*document);
|
||||
|
||||
const size_t pageCount = m_rightDocument.getCatalog()->getPageCount();
|
||||
if (pageCount > 1)
|
||||
{
|
||||
m_settingsDockWidget->getRightPageSelectionEdit()->setText(QString("1-%2").arg(pageCount));
|
||||
}
|
||||
else if (pageCount == 1)
|
||||
{
|
||||
m_settingsDockWidget->getRightPageSelectionEdit()->setText("1");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settingsDockWidget->getRightPageSelectionEdit()->clear();
|
||||
}
|
||||
|
||||
setRightDocument(std::move(*document));
|
||||
updateViewDocument();
|
||||
}
|
||||
|
||||
@ -863,6 +833,44 @@ std::optional<pdf::PDFDocument> MainWindow::openDocument()
|
||||
return pdf::PDFDocument();
|
||||
}
|
||||
|
||||
void MainWindow::setRightDocument(pdf::PDFDocument&& newRightDocument)
|
||||
{
|
||||
m_rightDocument = newRightDocument;
|
||||
|
||||
const size_t pageCount = m_rightDocument.getCatalog()->getPageCount();
|
||||
if (pageCount > 1)
|
||||
{
|
||||
m_settingsDockWidget->getRightPageSelectionEdit()->setText(QString("1-%2").arg(pageCount));
|
||||
}
|
||||
else if (pageCount == 1)
|
||||
{
|
||||
m_settingsDockWidget->getRightPageSelectionEdit()->setText("1");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settingsDockWidget->getRightPageSelectionEdit()->clear();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setLeftDocument(pdf::PDFDocument&& newLeftDocument)
|
||||
{
|
||||
m_leftDocument = newLeftDocument;
|
||||
|
||||
const size_t pageCount = m_leftDocument.getCatalog()->getPageCount();
|
||||
if (pageCount > 1)
|
||||
{
|
||||
m_settingsDockWidget->getLeftPageSelectionEdit()->setText(QString("1-%2").arg(pageCount));
|
||||
}
|
||||
else if (pageCount == 1)
|
||||
{
|
||||
m_settingsDockWidget->getLeftPageSelectionEdit()->setText("1");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_settingsDockWidget->getLeftPageSelectionEdit()->clear();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onProgressStarted(pdf::ProgressStartupInfo info)
|
||||
{
|
||||
#ifdef WIN_TASKBAR_BUTTON
|
||||
|
@ -84,6 +84,14 @@ public:
|
||||
virtual void showEvent(QShowEvent* event) override;
|
||||
virtual void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
void setLeftDocument(pdf::PDFDocument&& newLeftDocument);
|
||||
void setRightDocument(pdf::PDFDocument&& newRightDocument);
|
||||
|
||||
void updateViewDocument();
|
||||
|
||||
bool canPerformOperation(Operation operation) const;
|
||||
void performOperation(Operation operation);
|
||||
|
||||
private slots:
|
||||
void updateActions();
|
||||
void onSelectionChanged(size_t currentIndex);
|
||||
@ -100,9 +108,6 @@ private:
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
|
||||
bool canPerformOperation(Operation operation) const;
|
||||
void performOperation(Operation operation);
|
||||
|
||||
void setViewDocument(pdf::PDFDocument* document, bool updateCustomPageLayout);
|
||||
|
||||
ComparedDocumentMapper::Mode getDocumentViewMode() const;
|
||||
@ -115,7 +120,6 @@ private:
|
||||
|
||||
void updateAll(bool resetFilters);
|
||||
void updateFilteredResult();
|
||||
void updateViewDocument();
|
||||
void updateCustomPageLayout();
|
||||
void updateOverlayTransparency();
|
||||
|
||||
|
@ -1,12 +1,16 @@
|
||||
CURRENT:
|
||||
- Issue #182: PDF4QT Document Diff command line cmd line arguments ignored
|
||||
- Issue #173: errors loading file Echoplex.pdf
|
||||
- Issue #172: access keys are missing from most menu items/action text strings
|
||||
- Issue #168: When opening a PDF file or merging some PDF files, stamp will disappear.
|
||||
- Issue #166: Adding images to PDF?
|
||||
- Issue #164: Taskbar icon not shown in linux mint.
|
||||
- Issue #163: Unable to render probably valid PDF
|
||||
- Issue #161: Can it be possible to trust a certificate like in acrobat?
|
||||
- Issue #159: Offer 4 AppImage one for each App [enhancement]
|
||||
- Issue #123: Alternative software rendering backend (Blend2D)
|
||||
- Issue #42: Is REAL pdf text editing planned ?
|
||||
- Issue #26: Add pictures in PDF files
|
||||
|
||||
V: 1.3.7 10.1.2024
|
||||
- Issue #142: Cannot reach the top
|
||||
|
Loading…
Reference in New Issue
Block a user