mirror of https://github.com/JakubMelka/PDF4QT.git
Issue #25: MinGW compilation fix
This commit is contained in:
parent
825fe59420
commit
8ffc4f9189
|
@ -62,6 +62,10 @@ if (MSVC)
|
||||||
add_compile_options(/bigobj)
|
add_compile_options(/bigobj)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (MINGW)
|
||||||
|
add_compile_options("-Wa,-mbig-obj")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(Pdf4QtLib)
|
add_subdirectory(Pdf4QtLib)
|
||||||
add_subdirectory(CodeGenerator)
|
add_subdirectory(CodeGenerator)
|
||||||
add_subdirectory(JBIG2_Viewer)
|
add_subdirectory(JBIG2_Viewer)
|
||||||
|
|
|
@ -86,8 +86,7 @@ void GeneratedCodeStorage::generateCode(QTextStream& stream, CodeGeneratorParame
|
||||||
QObject* Serializer::load(const QDomElement& element, QObject* parent)
|
QObject* Serializer::load(const QDomElement& element, QObject* parent)
|
||||||
{
|
{
|
||||||
QString className = element.attribute("class");
|
QString className = element.attribute("class");
|
||||||
const int metaTypeId = QMetaType::type(className.toLatin1());
|
const QMetaObject* metaObject = QMetaType::fromName(QByteArrayView(className.toLatin1())).metaObject();
|
||||||
const QMetaObject* metaObject = QMetaType::metaObjectForType(metaTypeId);
|
|
||||||
|
|
||||||
if (metaObject)
|
if (metaObject)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
|
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
|
||||||
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
|
|
||||||
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
|
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
|
||||||
QApplication application(argc, argv);
|
QApplication application(argc, argv);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
|
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
|
||||||
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
|
|
||||||
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
|
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
|
||||||
QApplication application(argc, argv);
|
QApplication application(argc, argv);
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,10 @@ target_link_libraries(Pdf4QtLib PRIVATE freetype)
|
||||||
target_link_libraries(Pdf4QtLib PRIVATE openjp2)
|
target_link_libraries(Pdf4QtLib PRIVATE openjp2)
|
||||||
target_link_libraries(Pdf4QtLib PRIVATE JPEG::JPEG)
|
target_link_libraries(Pdf4QtLib PRIVATE JPEG::JPEG)
|
||||||
|
|
||||||
|
if(MINGW)
|
||||||
|
target_link_libraries(Pdf4QtLib PRIVATE Secur32 Mscms Gdi32 User32 crypt32)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(Pdf4QtLib INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/sources)
|
target_include_directories(Pdf4QtLib INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/sources)
|
||||||
target_include_directories(Pdf4QtLib PUBLIC ${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR})
|
target_include_directories(Pdf4QtLib PUBLIC ${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR})
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,11 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
|
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <openssl/bio.h>
|
#include <openssl/bio.h>
|
||||||
#include <openssl/rsa.h>
|
#include <openssl/rsa.h>
|
||||||
#include <openssl/rsaerr.h>
|
#include <openssl/rsaerr.h>
|
||||||
|
@ -249,3 +254,7 @@ bool PDFSignatureFactory::sign(QString certificateName, QString password, QByteA
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace pdf
|
} // namespace pdf
|
||||||
|
|
||||||
|
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
|
@ -883,7 +883,8 @@ void PDFDiff::finalizeGraphicsPieces(PDFDiffPageContext& context)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasher.addData(reinterpret_cast<const char*>(info.hash.data()), int(info.hash.size()));
|
QByteArrayView view(reinterpret_cast<const char*>(info.hash.data()), info.hash.size());
|
||||||
|
hasher.addData(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray hash = hasher.result();
|
QByteArray hash = hasher.result();
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
|
#include <QColorSpace>
|
||||||
|
|
||||||
namespace pdf
|
namespace pdf
|
||||||
{
|
{
|
||||||
|
@ -566,7 +567,7 @@ PDFOpenGLDrawWidget::PDFOpenGLDrawWidget(PDFWidget* widget, int samplesCount, QW
|
||||||
QSurfaceFormat format = this->format();
|
QSurfaceFormat format = this->format();
|
||||||
format.setProfile(QSurfaceFormat::CoreProfile);
|
format.setProfile(QSurfaceFormat::CoreProfile);
|
||||||
format.setSamples(samplesCount);
|
format.setSamples(samplesCount);
|
||||||
format.setColorSpace(QSurfaceFormat::sRGBColorSpace);
|
format.setColorSpace(QColorSpace(QColorSpace::SRgb));
|
||||||
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
|
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
|
||||||
setFormat(format);
|
setFormat(format);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2233,9 +2233,9 @@ QString PDFEncoding::convertTextString(const QByteArray& stream)
|
||||||
|
|
||||||
QString PDFEncoding::convertFromUnicode(const QByteArray& stream)
|
QString PDFEncoding::convertFromUnicode(const QByteArray& stream)
|
||||||
{
|
{
|
||||||
const ushort* bytes = reinterpret_cast<const ushort*>(stream.data());
|
const char16_t* bytes = reinterpret_cast<const char16_t*>(stream.data());
|
||||||
const int sizeInChars = stream.size();
|
const int sizeInChars = stream.size();
|
||||||
const int sizeSizeInUShorts = sizeInChars / sizeof(const ushort) * sizeof(char);
|
const size_t sizeSizeInUShorts = sizeInChars / sizeof(const ushort) * sizeof(char);
|
||||||
|
|
||||||
return QString::fromUtf16(bytes, sizeSizeInUShorts);
|
return QString::fromUtf16(bytes, sizeSizeInUShorts);
|
||||||
}
|
}
|
||||||
|
|
|
@ -705,7 +705,7 @@ PDFObject PDFParser::getObject()
|
||||||
{
|
{
|
||||||
case PDFLexicalAnalyzer::TokenType::Boolean:
|
case PDFLexicalAnalyzer::TokenType::Boolean:
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_lookAhead1.data.type() == QVariant::Bool);
|
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::Bool);
|
||||||
const bool value = m_lookAhead1.data.toBool();
|
const bool value = m_lookAhead1.data.toBool();
|
||||||
shift();
|
shift();
|
||||||
return PDFObject::createBool(value);
|
return PDFObject::createBool(value);
|
||||||
|
@ -713,7 +713,7 @@ PDFObject PDFParser::getObject()
|
||||||
|
|
||||||
case PDFLexicalAnalyzer::TokenType::Integer:
|
case PDFLexicalAnalyzer::TokenType::Integer:
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_lookAhead1.data.type() == QVariant::LongLong);
|
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::LongLong);
|
||||||
const PDFInteger value = m_lookAhead1.data.toLongLong();
|
const PDFInteger value = m_lookAhead1.data.toLongLong();
|
||||||
shift();
|
shift();
|
||||||
|
|
||||||
|
@ -723,7 +723,7 @@ PDFObject PDFParser::getObject()
|
||||||
m_lookAhead2.type == PDFLexicalAnalyzer::TokenType::Command &&
|
m_lookAhead2.type == PDFLexicalAnalyzer::TokenType::Command &&
|
||||||
m_lookAhead2.data.toByteArray() == PDF_REFERENCE_COMMAND)
|
m_lookAhead2.data.toByteArray() == PDF_REFERENCE_COMMAND)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_lookAhead1.data.type() == QVariant::LongLong);
|
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::LongLong);
|
||||||
const PDFInteger generation = m_lookAhead1.data.toLongLong();
|
const PDFInteger generation = m_lookAhead1.data.toLongLong();
|
||||||
shift();
|
shift();
|
||||||
shift();
|
shift();
|
||||||
|
@ -738,7 +738,7 @@ PDFObject PDFParser::getObject()
|
||||||
|
|
||||||
case PDFLexicalAnalyzer::TokenType::Real:
|
case PDFLexicalAnalyzer::TokenType::Real:
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_lookAhead1.data.type() == QVariant::Double);
|
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::Double);
|
||||||
const PDFReal value = m_lookAhead1.data.toDouble();
|
const PDFReal value = m_lookAhead1.data.toDouble();
|
||||||
shift();
|
shift();
|
||||||
return PDFObject::createReal(value);
|
return PDFObject::createReal(value);
|
||||||
|
@ -746,7 +746,7 @@ PDFObject PDFParser::getObject()
|
||||||
|
|
||||||
case PDFLexicalAnalyzer::TokenType::String:
|
case PDFLexicalAnalyzer::TokenType::String:
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_lookAhead1.data.type() == QVariant::ByteArray);
|
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::ByteArray);
|
||||||
QByteArray array = m_lookAhead1.data.toByteArray();
|
QByteArray array = m_lookAhead1.data.toByteArray();
|
||||||
array.shrink_to_fit();
|
array.shrink_to_fit();
|
||||||
shift();
|
shift();
|
||||||
|
@ -755,7 +755,7 @@ PDFObject PDFParser::getObject()
|
||||||
|
|
||||||
case PDFLexicalAnalyzer::TokenType::Name:
|
case PDFLexicalAnalyzer::TokenType::Name:
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_lookAhead1.data.type() == QVariant::ByteArray);
|
Q_ASSERT(m_lookAhead1.data.typeId() == QVariant::ByteArray);
|
||||||
QByteArray array = m_lookAhead1.data.toByteArray();
|
QByteArray array = m_lookAhead1.data.toByteArray();
|
||||||
array.shrink_to_fit();
|
array.shrink_to_fit();
|
||||||
shift();
|
shift();
|
||||||
|
|
|
@ -26,6 +26,11 @@
|
||||||
|
|
||||||
#include <QRandomGenerator>
|
#include <QRandomGenerator>
|
||||||
|
|
||||||
|
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <openssl/rc4.h>
|
#include <openssl/rc4.h>
|
||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
#include <openssl/aes.h>
|
#include <openssl/aes.h>
|
||||||
|
@ -2612,3 +2617,8 @@ PDFObject PDFPublicKeySecurityHandler::createEncryptionDictionaryObject() const
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace pdf
|
} // namespace pdf
|
||||||
|
|
||||||
|
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,11 @@
|
||||||
#include "pdfdbgheap.h"
|
#include "pdfdbgheap.h"
|
||||||
#include "pdfsignaturehandler_impl.h"
|
#include "pdfsignaturehandler_impl.h"
|
||||||
|
|
||||||
|
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <openssl/rsa.h>
|
#include <openssl/rsa.h>
|
||||||
|
@ -2100,3 +2105,7 @@ pdf::PDFCertificateStore::CertificateEntries pdf::PDFCertificateStore::getSystem
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
|
@ -12134,19 +12134,19 @@ void PDFXFAEngineImpl::drawUi(const xfa::XFA_ui* ui,
|
||||||
passwordEdit || signature || textEdit;
|
passwordEdit || signature || textEdit;
|
||||||
const bool isDefaultUi = !isNonDefaultUi || defaultUi;
|
const bool isDefaultUi = !isNonDefaultUi || defaultUi;
|
||||||
|
|
||||||
if (textEdit || (isDefaultUi && value.value.type() == QVariant::String))
|
if (textEdit || (isDefaultUi && value.value.typeId() == QVariant::String))
|
||||||
{
|
{
|
||||||
drawUiTextEdit(textEdit, value, errors, nominalExtentArea, paragraphSettingsIndex, painter);
|
drawUiTextEdit(textEdit, value, errors, nominalExtentArea, paragraphSettingsIndex, painter);
|
||||||
}
|
}
|
||||||
else if (checkButton || (isDefaultUi && value.value.type() == QVariant::Bool))
|
else if (checkButton || (isDefaultUi && value.value.typeId() == QVariant::Bool))
|
||||||
{
|
{
|
||||||
drawUiCheckButton(checkButton, value, nominalExtentArea, painter);
|
drawUiCheckButton(checkButton, value, nominalExtentArea, painter);
|
||||||
}
|
}
|
||||||
else if (imageEdit || (isDefaultUi && value.value.type() == QVariant::Image))
|
else if (imageEdit || (isDefaultUi && value.value.typeId() == QVariant::Image))
|
||||||
{
|
{
|
||||||
drawUiImageEdit(imageEdit, value, errors, nominalExtentArea, painter);
|
drawUiImageEdit(imageEdit, value, errors, nominalExtentArea, painter);
|
||||||
}
|
}
|
||||||
else if (numericEdit || (isDefaultUi && value.value.type() == QVariant::Double))
|
else if (numericEdit || (isDefaultUi && value.value.typeId() == QVariant::Double))
|
||||||
{
|
{
|
||||||
drawUiNumericEdit(numericEdit, value, errors, nominalExtentArea, paragraphSettingsIndex, painter);
|
drawUiNumericEdit(numericEdit, value, errors, nominalExtentArea, paragraphSettingsIndex, painter);
|
||||||
}
|
}
|
||||||
|
@ -12166,9 +12166,9 @@ void PDFXFAEngineImpl::drawUi(const xfa::XFA_ui* ui,
|
||||||
{
|
{
|
||||||
errors << PDFRenderError(RenderErrorType::NotImplemented, PDFTranslationContext::tr("XFA: Buttons not implemented."));
|
errors << PDFRenderError(RenderErrorType::NotImplemented, PDFTranslationContext::tr("XFA: Buttons not implemented."));
|
||||||
}
|
}
|
||||||
else if (dateTimeEdit || (isDefaultUi && (value.value.type() == QVariant::DateTime ||
|
else if (dateTimeEdit || (isDefaultUi && (value.value.typeId() == QVariant::DateTime ||
|
||||||
value.value.type() == QVariant::Date ||
|
value.value.typeId() == QVariant::Date ||
|
||||||
value.value.type() == QVariant::Time)))
|
value.value.typeId() == QVariant::Time)))
|
||||||
{
|
{
|
||||||
drawUiDateTimeEdit(dateTimeEdit, value, errors, nominalExtentArea, paragraphSettingsIndex, painter);
|
drawUiDateTimeEdit(dateTimeEdit, value, errors, nominalExtentArea, paragraphSettingsIndex, painter);
|
||||||
}
|
}
|
||||||
|
@ -12391,15 +12391,15 @@ void PDFXFAEngineImpl::drawUiDateTimeEdit(const xfa::XFA_dateTimeEdit* dateTimeE
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
if (value.value.type() == QVariant::DateTime)
|
if (value.value.typeId() == QVariant::DateTime)
|
||||||
{
|
{
|
||||||
text = value.value.toDateTime().toString();
|
text = value.value.toDateTime().toString();
|
||||||
}
|
}
|
||||||
else if (value.value.type() == QVariant::Time)
|
else if (value.value.typeId() == QVariant::Time)
|
||||||
{
|
{
|
||||||
text = value.value.toTime().toString();
|
text = value.value.toTime().toString();
|
||||||
}
|
}
|
||||||
else if (value.value.type() == QVariant::Date)
|
else if (value.value.typeId() == QVariant::Date)
|
||||||
{
|
{
|
||||||
text = value.value.toDate().toString();
|
text = value.value.toDate().toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ void PDFDocumentPropertiesDialog::initializeProperties(const pdf::PDFDocument* d
|
||||||
{
|
{
|
||||||
QString key = QString::fromLatin1(item.first);
|
QString key = QString::fromLatin1(item.first);
|
||||||
QVariant valueVariant = item.second;
|
QVariant valueVariant = item.second;
|
||||||
QString value = (valueVariant.type() == QVariant::DateTime) ? locale.toString(valueVariant.toDateTime()) : valueVariant.toString();
|
QString value = (valueVariant.typeId() == QVariant::DateTime) ? locale.toString(valueVariant.toDateTime()) : valueVariant.toString();
|
||||||
new QTreeWidgetItem(customRoot, { key, value });
|
new QTreeWidgetItem(customRoot, { key, value });
|
||||||
}
|
}
|
||||||
ui->propertiesTreeWidget->addTopLevelItem(customRoot);
|
ui->propertiesTreeWidget->addTopLevelItem(customRoot);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "pdfencryptionsettingsdialog.h"
|
#include "pdfencryptionsettingsdialog.h"
|
||||||
#include "ui_pdfencryptionsettingsdialog.h"
|
#include "ui_pdfencryptionsettingsdialog.h"
|
||||||
|
#include "pdfencryptionstrengthhintwidget.h"
|
||||||
|
|
||||||
#include "pdfutils.h"
|
#include "pdfutils.h"
|
||||||
#include "pdfwidgetutils.h"
|
#include "pdfwidgetutils.h"
|
||||||
|
@ -33,7 +34,10 @@ PDFEncryptionSettingsDialog::PDFEncryptionSettingsDialog(QByteArray documentId,
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::PDFEncryptionSettingsDialog),
|
ui(new Ui::PDFEncryptionSettingsDialog),
|
||||||
m_isUpdatingUi(false),
|
m_isUpdatingUi(false),
|
||||||
m_documentId(documentId)
|
m_documentId(documentId),
|
||||||
|
m_userPasswordStrengthHintWidget(new PDFEncryptionStrengthHintWidget(this)),
|
||||||
|
m_ownerPasswordStrengthHintWidget(new PDFEncryptionStrengthHintWidget(this)),
|
||||||
|
m_algorithmHintWidget(new PDFEncryptionStrengthHintWidget(this))
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -45,20 +49,24 @@ PDFEncryptionSettingsDialog::PDFEncryptionSettingsDialog(QByteArray documentId,
|
||||||
|
|
||||||
ui->algorithmComboBox->setCurrentIndex(0);
|
ui->algorithmComboBox->setCurrentIndex(0);
|
||||||
|
|
||||||
ui->algorithmHintWidget->setFixedSize(ui->algorithmHintWidget->minimumSizeHint());
|
m_algorithmHintWidget->setFixedSize(m_algorithmHintWidget->minimumSizeHint());
|
||||||
ui->userPasswordStrengthHintWidget->setFixedSize(ui->userPasswordStrengthHintWidget->minimumSizeHint());
|
m_userPasswordStrengthHintWidget->setFixedSize(m_userPasswordStrengthHintWidget->minimumSizeHint());
|
||||||
ui->ownerPasswordStrengthHintWidget->setFixedSize(ui->ownerPasswordStrengthHintWidget->minimumSizeHint());
|
m_ownerPasswordStrengthHintWidget->setFixedSize(m_userPasswordStrengthHintWidget->minimumSizeHint());
|
||||||
|
|
||||||
ui->algorithmHintWidget->setMinValue(1);
|
ui->passwordsGroupBoxLayout->addWidget(m_userPasswordStrengthHintWidget, 0, 2);
|
||||||
ui->algorithmHintWidget->setMaxValue(5);
|
ui->passwordsGroupBoxLayout->addWidget(m_ownerPasswordStrengthHintWidget, 1, 2);
|
||||||
|
ui->methodGroupBoxLayout->addWidget(m_algorithmHintWidget, 0, 2);
|
||||||
|
|
||||||
|
m_algorithmHintWidget->setMinValue(1);
|
||||||
|
m_algorithmHintWidget->setMaxValue(5);
|
||||||
|
|
||||||
const int passwordOptimalEntropy = pdf::PDFSecurityHandlerFactory::getPasswordOptimalEntropy();
|
const int passwordOptimalEntropy = pdf::PDFSecurityHandlerFactory::getPasswordOptimalEntropy();
|
||||||
|
|
||||||
ui->userPasswordStrengthHintWidget->setMinValue(0);
|
m_userPasswordStrengthHintWidget->setMinValue(0);
|
||||||
ui->userPasswordStrengthHintWidget->setMaxValue(passwordOptimalEntropy);
|
m_userPasswordStrengthHintWidget->setMaxValue(passwordOptimalEntropy);
|
||||||
|
|
||||||
ui->ownerPasswordStrengthHintWidget->setMinValue(0);
|
m_ownerPasswordStrengthHintWidget->setMinValue(0);
|
||||||
ui->ownerPasswordStrengthHintWidget->setMaxValue(passwordOptimalEntropy);
|
m_ownerPasswordStrengthHintWidget->setMaxValue(passwordOptimalEntropy);
|
||||||
|
|
||||||
connect(ui->algorithmComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &PDFEncryptionSettingsDialog::updateUi);
|
connect(ui->algorithmComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &PDFEncryptionSettingsDialog::updateUi);
|
||||||
connect(ui->userPasswordEnableCheckBox, &QCheckBox::clicked, this, &PDFEncryptionSettingsDialog::updateUi);
|
connect(ui->userPasswordEnableCheckBox, &QCheckBox::clicked, this, &PDFEncryptionSettingsDialog::updateUi);
|
||||||
|
@ -103,17 +111,17 @@ void PDFEncryptionSettingsDialog::updateUi()
|
||||||
switch (algorithm)
|
switch (algorithm)
|
||||||
{
|
{
|
||||||
case pdf::PDFSecurityHandlerFactory::None:
|
case pdf::PDFSecurityHandlerFactory::None:
|
||||||
ui->algorithmHintWidget->setCurrentValue(1);
|
m_algorithmHintWidget->setCurrentValue(1);
|
||||||
break;
|
break;
|
||||||
case pdf::PDFSecurityHandlerFactory::RC4:
|
case pdf::PDFSecurityHandlerFactory::RC4:
|
||||||
ui->algorithmHintWidget->setCurrentValue(2);
|
m_algorithmHintWidget->setCurrentValue(2);
|
||||||
break;
|
break;
|
||||||
case pdf::PDFSecurityHandlerFactory::AES_128:
|
case pdf::PDFSecurityHandlerFactory::AES_128:
|
||||||
ui->algorithmHintWidget->setCurrentValue(4);
|
m_algorithmHintWidget->setCurrentValue(4);
|
||||||
break;
|
break;
|
||||||
case pdf::PDFSecurityHandlerFactory::AES_256:
|
case pdf::PDFSecurityHandlerFactory::AES_256:
|
||||||
case pdf::PDFSecurityHandlerFactory::Certificate:
|
case pdf::PDFSecurityHandlerFactory::Certificate:
|
||||||
ui->algorithmHintWidget->setCurrentValue(5);
|
m_algorithmHintWidget->setCurrentValue(5);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -170,8 +178,8 @@ void PDFEncryptionSettingsDialog::updateUi()
|
||||||
ui->ownerPasswordEdit->clear();
|
ui->ownerPasswordEdit->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->userPasswordStrengthHintWidget->setEnabled(ui->userPasswordEnableCheckBox->isChecked());
|
m_userPasswordStrengthHintWidget->setEnabled(ui->userPasswordEnableCheckBox->isChecked());
|
||||||
ui->ownerPasswordStrengthHintWidget->setEnabled(ui->ownerPasswordEnableCheckBox->isChecked());
|
m_ownerPasswordStrengthHintWidget->setEnabled(ui->ownerPasswordEnableCheckBox->isChecked());
|
||||||
|
|
||||||
ui->encryptAllRadioButton->setEnabled(encrypted);
|
ui->encryptAllRadioButton->setEnabled(encrypted);
|
||||||
ui->encryptAllExceptMetadataRadioButton->setEnabled(encrypted);
|
ui->encryptAllExceptMetadataRadioButton->setEnabled(encrypted);
|
||||||
|
@ -204,8 +212,8 @@ void PDFEncryptionSettingsDialog::updatePasswordScore()
|
||||||
const int userPasswordScore = pdf::PDFSecurityHandlerFactory::getPasswordEntropy(ui->userPasswordEdit->text(), algorithm);
|
const int userPasswordScore = pdf::PDFSecurityHandlerFactory::getPasswordEntropy(ui->userPasswordEdit->text(), algorithm);
|
||||||
const int ownerPasswordScore = pdf::PDFSecurityHandlerFactory::getPasswordEntropy(ui->ownerPasswordEdit->text(), algorithm);
|
const int ownerPasswordScore = pdf::PDFSecurityHandlerFactory::getPasswordEntropy(ui->ownerPasswordEdit->text(), algorithm);
|
||||||
|
|
||||||
ui->userPasswordStrengthHintWidget->setCurrentValue(userPasswordScore);
|
m_userPasswordStrengthHintWidget->setCurrentValue(userPasswordScore);
|
||||||
ui->ownerPasswordStrengthHintWidget->setCurrentValue(ownerPasswordScore);
|
m_ownerPasswordStrengthHintWidget->setCurrentValue(ownerPasswordScore);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PDFEncryptionSettingsDialog::accept()
|
void PDFEncryptionSettingsDialog::accept()
|
||||||
|
|
|
@ -32,6 +32,7 @@ class QCheckBox;
|
||||||
|
|
||||||
namespace pdfviewer
|
namespace pdfviewer
|
||||||
{
|
{
|
||||||
|
class PDFEncryptionStrengthHintWidget;
|
||||||
|
|
||||||
class PDFEncryptionSettingsDialog : public QDialog
|
class PDFEncryptionSettingsDialog : public QDialog
|
||||||
{
|
{
|
||||||
|
@ -57,6 +58,9 @@ private:
|
||||||
std::map<QCheckBox*, pdf::PDFSecurityHandler::Permission> m_checkBoxToPermission;
|
std::map<QCheckBox*, pdf::PDFSecurityHandler::Permission> m_checkBoxToPermission;
|
||||||
pdf::PDFSecurityHandlerPointer m_updatedSecurityHandler;
|
pdf::PDFSecurityHandlerPointer m_updatedSecurityHandler;
|
||||||
QByteArray m_documentId;
|
QByteArray m_documentId;
|
||||||
|
PDFEncryptionStrengthHintWidget* m_userPasswordStrengthHintWidget;
|
||||||
|
PDFEncryptionStrengthHintWidget* m_ownerPasswordStrengthHintWidget;
|
||||||
|
PDFEncryptionStrengthHintWidget* m_algorithmHintWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace pdfviewer
|
} // namespace pdfviewer
|
||||||
|
|
|
@ -20,9 +20,6 @@
|
||||||
<string>Encryption Method</string>
|
<string>Encryption Method</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="methodGroupBoxLayout">
|
<layout class="QGridLayout" name="methodGroupBoxLayout">
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="pdfviewer::PDFEncryptionStrengthHintWidget" name="algorithmHintWidget" native="true"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="encryptionAlgorithm">
|
<widget class="QLabel" name="encryptionAlgorithm">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -62,13 +59,6 @@
|
||||||
<string>Passwords</string>
|
<string>Passwords</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="passwordsGroupBoxLayout">
|
<layout class="QGridLayout" name="passwordsGroupBoxLayout">
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QCheckBox" name="ownerPasswordEnableCheckBox">
|
|
||||||
<property name="text">
|
|
||||||
<string>Password (owner access)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QCheckBox" name="userPasswordEnableCheckBox">
|
<widget class="QCheckBox" name="userPasswordEnableCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -76,6 +66,16 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="ownerPasswordEdit">
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Password</enum>
|
||||||
|
</property>
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLineEdit" name="userPasswordEdit">
|
<widget class="QLineEdit" name="userPasswordEdit">
|
||||||
<property name="echoMode">
|
<property name="echoMode">
|
||||||
|
@ -86,22 +86,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="1" column="0">
|
||||||
<widget class="pdfviewer::PDFEncryptionStrengthHintWidget" name="userPasswordStrengthHintWidget" native="true"/>
|
<widget class="QCheckBox" name="ownerPasswordEnableCheckBox">
|
||||||
</item>
|
<property name="text">
|
||||||
<item row="1" column="1">
|
<string>Password (owner access)</string>
|
||||||
<widget class="QLineEdit" name="ownerPasswordEdit">
|
|
||||||
<property name="echoMode">
|
|
||||||
<enum>QLineEdit::Password</enum>
|
|
||||||
</property>
|
|
||||||
<property name="clearButtonEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="pdfviewer::PDFEncryptionStrengthHintWidget" name="ownerPasswordStrengthHintWidget" native="true"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -215,14 +206,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>pdfviewer::PDFEncryptionStrengthHintWidget</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>pdfencryptionstrengthhintwidget.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
|
|
@ -97,7 +97,7 @@ void PDFRecentFileManager::onRecentFileActionTriggered()
|
||||||
Q_ASSERT(action);
|
Q_ASSERT(action);
|
||||||
|
|
||||||
QVariant data = action->data();
|
QVariant data = action->data();
|
||||||
if (data.type() == QVariant::String)
|
if (data.typeId() == QVariant::String)
|
||||||
{
|
{
|
||||||
emit fileOpenRequest(data.toString());
|
emit fileOpenRequest(data.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ namespace pdfviewer
|
||||||
bool PDFSendMail::sendMail(QWidget* parent, QString subject, QString fileName)
|
bool PDFSendMail::sendMail(QWidget* parent, QString subject, QString fileName)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
||||||
|
#if !defined(PDF4QT_COMPILER_MINGW)
|
||||||
QFileInfo fileInfo(fileName);
|
QFileInfo fileInfo(fileName);
|
||||||
std::wstring subjectString = subject.toStdWString();
|
std::wstring subjectString = subject.toStdWString();
|
||||||
std::wstring fileNameString = fileInfo.fileName().toStdWString();
|
std::wstring fileNameString = fileInfo.fileName().toStdWString();
|
||||||
|
@ -84,6 +86,7 @@ bool PDFSendMail::sendMail(QWidget* parent, QString subject, QString fileName)
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
#elif defined(Q_OS_UNIX)
|
#elif defined(Q_OS_UNIX)
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
|
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
|
||||||
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
|
|
||||||
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
|
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
|
||||||
QApplication application(argc, argv);
|
QApplication application(argc, argv);
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,10 @@ add_library(AudioBookPlugin SHARED
|
||||||
|
|
||||||
target_link_libraries(AudioBookPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
target_link_libraries(AudioBookPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
||||||
|
|
||||||
|
if(MINGW)
|
||||||
|
target_link_libraries(AudioBookPlugin PRIVATE ole32 sapi)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties(AudioBookPlugin PROPERTIES
|
set_target_properties(AudioBookPlugin PROPERTIES
|
||||||
VERSION ${PDF4QT_VERSION}
|
VERSION ${PDF4QT_VERSION}
|
||||||
SOVERSION ${PDF4QT_VERSION}
|
SOVERSION ${PDF4QT_VERSION}
|
||||||
|
|
|
@ -31,14 +31,16 @@ ObjectInspectorDialog::ObjectInspectorDialog(const pdf::PDFCMS* cms, const pdf::
|
||||||
ui(new Ui::ObjectInspectorDialog),
|
ui(new Ui::ObjectInspectorDialog),
|
||||||
m_cms(cms),
|
m_cms(cms),
|
||||||
m_document(document),
|
m_document(document),
|
||||||
m_model(nullptr)
|
m_model(nullptr),
|
||||||
|
m_viewerWidget(new ObjectViewerWidget(this))
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
m_objectClassifier.classify(document);
|
m_objectClassifier.classify(document);
|
||||||
|
|
||||||
ui->currentObjectWidget->setCms(cms);
|
m_viewerWidget->setCms(cms);
|
||||||
ui->currentObjectWidget->setDocument(document);
|
m_viewerWidget->setDocument(document);
|
||||||
|
ui->currentObjectTabLayout->addWidget(m_viewerWidget);
|
||||||
|
|
||||||
ui->modeComboBox->addItem(tr("Document"), int(PDFObjectInspectorTreeItemModel::Document));
|
ui->modeComboBox->addItem(tr("Document"), int(PDFObjectInspectorTreeItemModel::Document));
|
||||||
ui->modeComboBox->addItem(tr("Pages"), int(PDFObjectInspectorTreeItemModel::Page));
|
ui->modeComboBox->addItem(tr("Pages"), int(PDFObjectInspectorTreeItemModel::Page));
|
||||||
|
@ -103,8 +105,8 @@ ObjectInspectorDialog::ObjectInspectorDialog(const pdf::PDFCMS* cms, const pdf::
|
||||||
ui->splitter->setSizes(QList<int>() << pdf::PDFWidgetUtils::scaleDPI_x(this, 300) << pdf::PDFWidgetUtils::scaleDPI_x(this, 200));
|
ui->splitter->setSizes(QList<int>() << pdf::PDFWidgetUtils::scaleDPI_x(this, 300) << pdf::PDFWidgetUtils::scaleDPI_x(this, 200));
|
||||||
|
|
||||||
connect(ui->objectTreeView->selectionModel(), &QItemSelectionModel::currentChanged, this, &ObjectInspectorDialog::onCurrentIndexChanged);
|
connect(ui->objectTreeView->selectionModel(), &QItemSelectionModel::currentChanged, this, &ObjectInspectorDialog::onCurrentIndexChanged);
|
||||||
connect(ui->currentObjectWidget, &ObjectViewerWidget::pinRequest, this, &ObjectInspectorDialog::onPinRequest);
|
connect(m_viewerWidget, &ObjectViewerWidget::pinRequest, this, &ObjectInspectorDialog::onPinRequest);
|
||||||
connect(ui->currentObjectWidget, &ObjectViewerWidget::unpinRequest, this, &ObjectInspectorDialog::onUnpinRequest);
|
connect(m_viewerWidget, &ObjectViewerWidget::unpinRequest, this, &ObjectInspectorDialog::onUnpinRequest);
|
||||||
|
|
||||||
ui->objectTreeView->setMinimumWidth(pdf::PDFWidgetUtils::scaleDPI_x(this, 200));
|
ui->objectTreeView->setMinimumWidth(pdf::PDFWidgetUtils::scaleDPI_x(this, 200));
|
||||||
setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(800, 600)));
|
setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(800, 600)));
|
||||||
|
@ -126,12 +128,12 @@ void ObjectInspectorDialog::onPinRequest()
|
||||||
{
|
{
|
||||||
ObjectViewerWidget* source = qobject_cast<ObjectViewerWidget*>(sender());
|
ObjectViewerWidget* source = qobject_cast<ObjectViewerWidget*>(sender());
|
||||||
|
|
||||||
if (!source || source != ui->currentObjectWidget)
|
if (!source || source != m_viewerWidget)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectViewerWidget* cloned = ui->currentObjectWidget->clone(true, this);
|
ObjectViewerWidget* cloned = m_viewerWidget->clone(true, this);
|
||||||
connect(cloned, &ObjectViewerWidget::pinRequest, this, &ObjectInspectorDialog::onPinRequest);
|
connect(cloned, &ObjectViewerWidget::pinRequest, this, &ObjectInspectorDialog::onPinRequest);
|
||||||
connect(cloned, &ObjectViewerWidget::unpinRequest, this, &ObjectInspectorDialog::onUnpinRequest);
|
connect(cloned, &ObjectViewerWidget::unpinRequest, this, &ObjectInspectorDialog::onUnpinRequest);
|
||||||
ui->tabWidget->addTab(cloned, cloned->getTitleText());
|
ui->tabWidget->addTab(cloned, cloned->getTitleText());
|
||||||
|
@ -141,7 +143,7 @@ void ObjectInspectorDialog::onUnpinRequest()
|
||||||
{
|
{
|
||||||
ObjectViewerWidget* source = qobject_cast<ObjectViewerWidget*>(sender());
|
ObjectViewerWidget* source = qobject_cast<ObjectViewerWidget*>(sender());
|
||||||
|
|
||||||
if (!source || source == ui->currentObjectWidget)
|
if (!source || source == m_viewerWidget)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -165,7 +167,7 @@ void ObjectInspectorDialog::onCurrentIndexChanged(const QModelIndex& current, co
|
||||||
isRoot = true;
|
isRoot = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->currentObjectWidget->setData(reference, qMove(object), isRoot);
|
m_viewerWidget->setData(reference, qMove(object), isRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace pdfplugin
|
} // namespace pdfplugin
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "pdfdocument.h"
|
#include "pdfdocument.h"
|
||||||
#include "pdfobjectutils.h"
|
#include "pdfobjectutils.h"
|
||||||
#include "pdfcms.h"
|
#include "pdfcms.h"
|
||||||
|
#include "objectviewerwidget.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ private:
|
||||||
const pdf::PDFDocument* m_document;
|
const pdf::PDFDocument* m_document;
|
||||||
pdf::PDFObjectClassifier m_objectClassifier;
|
pdf::PDFObjectClassifier m_objectClassifier;
|
||||||
PDFObjectInspectorTreeItemModel* m_model;
|
PDFObjectInspectorTreeItemModel* m_model;
|
||||||
|
ObjectViewerWidget* m_viewerWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace pdfplugin
|
} // namespace pdfplugin
|
||||||
|
|
|
@ -47,11 +47,7 @@
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Current Object</string>
|
<string>Current Object</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="currentObjectTabLayout"/>
|
||||||
<item>
|
|
||||||
<widget class="pdfplugin::ObjectViewerWidget" name="currentObjectWidget" native="true"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -68,14 +64,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>pdfplugin::ObjectViewerWidget</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>objectviewerwidget.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
|
|
@ -26,10 +26,13 @@ namespace pdfplugin
|
||||||
ObjectStatisticsDialog::ObjectStatisticsDialog(const pdf::PDFDocument* document, QWidget *parent) :
|
ObjectStatisticsDialog::ObjectStatisticsDialog(const pdf::PDFDocument* document, QWidget *parent) :
|
||||||
QDialog(parent, Qt::Dialog | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint),
|
QDialog(parent, Qt::Dialog | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint),
|
||||||
ui(new Ui::ObjectStatisticsDialog),
|
ui(new Ui::ObjectStatisticsDialog),
|
||||||
m_document(document)
|
m_document(document),
|
||||||
|
m_statisticsGraphWidget(new StatisticsGraphWidget(this))
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
ui->dialogLayout->addWidget(m_statisticsGraphWidget);
|
||||||
|
|
||||||
ui->comboBox->addItem(tr("Statistics by Object Function"), int(ByObjectClass));
|
ui->comboBox->addItem(tr("Statistics by Object Function"), int(ByObjectClass));
|
||||||
ui->comboBox->addItem(tr("Statistics by Object Type"), int(ByObjectType));
|
ui->comboBox->addItem(tr("Statistics by Object Type"), int(ByObjectType));
|
||||||
ui->comboBox->setCurrentIndex(ui->comboBox->findData(int(ByObjectClass), Qt::UserRole, Qt::MatchExactly));
|
ui->comboBox->setCurrentIndex(ui->comboBox->findData(int(ByObjectClass), Qt::UserRole, Qt::MatchExactly));
|
||||||
|
@ -163,7 +166,7 @@ void ObjectStatisticsDialog::updateStatisticsWidget()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->graphWidget->setStatistics(qMove(statistics));
|
m_statisticsGraphWidget->setStatistics(qMove(statistics));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace pdfplugin
|
} // namespace pdfplugin
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "pdfdocument.h"
|
#include "pdfdocument.h"
|
||||||
#include "pdfobjectutils.h"
|
#include "pdfobjectutils.h"
|
||||||
|
#include "statisticsgraphwidget.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ private:
|
||||||
|
|
||||||
const pdf::PDFDocument* m_document;
|
const pdf::PDFDocument* m_document;
|
||||||
pdf::PDFObjectClassifier::Statistics m_statistics;
|
pdf::PDFObjectClassifier::Statistics m_statistics;
|
||||||
|
StatisticsGraphWidget* m_statisticsGraphWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace pdfplugin
|
} // namespace pdfplugin
|
||||||
|
|
|
@ -13,23 +13,12 @@
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Object Statistics</string>
|
<string>Object Statistics</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="dialogLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox"/>
|
<widget class="QComboBox" name="comboBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="pdfplugin::StatisticsGraphWidget" name="graphWidget" native="true"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>pdfplugin::StatisticsGraphWidget</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>StatisticsGraphWidget.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -38,6 +38,7 @@ OutputPreviewDialog::OutputPreviewDialog(const pdf::PDFDocument* document, pdf::
|
||||||
m_document(document),
|
m_document(document),
|
||||||
m_widget(widget),
|
m_widget(widget),
|
||||||
m_needUpdateImage(false),
|
m_needUpdateImage(false),
|
||||||
|
m_outputPreviewWidget(new OutputPreviewWidget(this)),
|
||||||
m_futureWatcher(nullptr)
|
m_futureWatcher(nullptr)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -46,6 +47,8 @@ OutputPreviewDialog::OutputPreviewDialog(const pdf::PDFDocument* document, pdf::
|
||||||
ui->pageIndexScrollBar->setValue(1);
|
ui->pageIndexScrollBar->setValue(1);
|
||||||
ui->pageIndexScrollBar->setMaximum(int(document->getCatalog()->getPageCount()));
|
ui->pageIndexScrollBar->setMaximum(int(document->getCatalog()->getPageCount()));
|
||||||
|
|
||||||
|
ui->frameViewLayout->insertWidget(0, m_outputPreviewWidget);
|
||||||
|
|
||||||
ui->displayModeComboBox->addItem(tr("Separations"), OutputPreviewWidget::Separations);
|
ui->displayModeComboBox->addItem(tr("Separations"), OutputPreviewWidget::Separations);
|
||||||
ui->displayModeComboBox->addItem(tr("Color Warnings | Ink Coverage"), OutputPreviewWidget::ColorWarningInkCoverage);
|
ui->displayModeComboBox->addItem(tr("Color Warnings | Ink Coverage"), OutputPreviewWidget::ColorWarningInkCoverage);
|
||||||
ui->displayModeComboBox->addItem(tr("Color Warnings | Rich Black"), OutputPreviewWidget::ColorWarningRichBlack);
|
ui->displayModeComboBox->addItem(tr("Color Warnings | Rich Black"), OutputPreviewWidget::ColorWarningRichBlack);
|
||||||
|
@ -54,7 +57,7 @@ OutputPreviewDialog::OutputPreviewDialog(const pdf::PDFDocument* document, pdf::
|
||||||
ui->displayModeComboBox->addItem(tr("Opacity Channel"), OutputPreviewWidget::OpacityChannel);
|
ui->displayModeComboBox->addItem(tr("Opacity Channel"), OutputPreviewWidget::OpacityChannel);
|
||||||
ui->displayModeComboBox->setCurrentIndex(0);
|
ui->displayModeComboBox->setCurrentIndex(0);
|
||||||
|
|
||||||
ui->imageWidget->setInkMapper(&m_inkMapper);
|
m_outputPreviewWidget->setInkMapper(&m_inkMapper);
|
||||||
ui->inksTreeWidget->setMinimumHeight(pdf::PDFWidgetUtils::scaleDPI_y(ui->inksTreeWidget, 150));
|
ui->inksTreeWidget->setMinimumHeight(pdf::PDFWidgetUtils::scaleDPI_y(ui->inksTreeWidget, 150));
|
||||||
|
|
||||||
m_inkMapper.createSpotColors(ui->simulateSeparationsCheckBox->isChecked());
|
m_inkMapper.createSpotColors(ui->simulateSeparationsCheckBox->isChecked());
|
||||||
|
@ -191,7 +194,7 @@ void OutputPreviewDialog::updateAlarmColorButtonIcon()
|
||||||
{
|
{
|
||||||
QSize iconSize = ui->alarmColorButton->iconSize();
|
QSize iconSize = ui->alarmColorButton->iconSize();
|
||||||
QPixmap pixmap(iconSize);
|
QPixmap pixmap(iconSize);
|
||||||
pixmap.fill(ui->imageWidget->getAlarmColor());
|
pixmap.fill(m_outputPreviewWidget->getAlarmColor());
|
||||||
ui->alarmColorButton->setIcon(QIcon(pixmap));
|
ui->alarmColorButton->setIcon(QIcon(pixmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,10 +209,10 @@ void OutputPreviewDialog::onPaperColorChanged()
|
||||||
|
|
||||||
void OutputPreviewDialog::onAlarmColorButtonClicked()
|
void OutputPreviewDialog::onAlarmColorButtonClicked()
|
||||||
{
|
{
|
||||||
QColorDialog colorDialog(ui->imageWidget->getAlarmColor(), this);
|
QColorDialog colorDialog(m_outputPreviewWidget->getAlarmColor(), this);
|
||||||
if (colorDialog.exec() == QColorDialog::Accepted)
|
if (colorDialog.exec() == QColorDialog::Accepted)
|
||||||
{
|
{
|
||||||
ui->imageWidget->setAlarmColor(colorDialog.currentColor());
|
m_outputPreviewWidget->setAlarmColor(colorDialog.currentColor());
|
||||||
updateAlarmColorButtonIcon();
|
updateAlarmColorButtonIcon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,7 +234,7 @@ void OutputPreviewDialog::onSimulatePaperColorChecked(bool checked)
|
||||||
|
|
||||||
void OutputPreviewDialog::onDisplayModeChanged()
|
void OutputPreviewDialog::onDisplayModeChanged()
|
||||||
{
|
{
|
||||||
ui->imageWidget->setDisplayMode(OutputPreviewWidget::DisplayMode(ui->displayModeComboBox->currentData().toInt()));
|
m_outputPreviewWidget->setDisplayMode(OutputPreviewWidget::DisplayMode(ui->displayModeComboBox->currentData().toInt()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputPreviewDialog::onInksChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int>& roles)
|
void OutputPreviewDialog::onInksChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int>& roles)
|
||||||
|
@ -247,12 +250,12 @@ void OutputPreviewDialog::onInksChanged(const QModelIndex& topLeft, const QModel
|
||||||
|
|
||||||
void OutputPreviewDialog::onInkCoverageLimitChanged(double value)
|
void OutputPreviewDialog::onInkCoverageLimitChanged(double value)
|
||||||
{
|
{
|
||||||
ui->imageWidget->setInkCoverageLimit(value / 100.0);
|
m_outputPreviewWidget->setInkCoverageLimit(value / 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputPreviewDialog::onRichBlackLimtiChanged(double value)
|
void OutputPreviewDialog::onRichBlackLimtiChanged(double value)
|
||||||
{
|
{
|
||||||
ui->imageWidget->setRichBlackLimit(value / 100.0);
|
m_outputPreviewWidget->setRichBlackLimit(value / 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputPreviewDialog::updatePageImage()
|
void OutputPreviewDialog::updatePageImage()
|
||||||
|
@ -268,7 +271,7 @@ void OutputPreviewDialog::updatePageImage()
|
||||||
const pdf::PDFPage* page = m_document->getCatalog()->getPage(ui->pageIndexScrollBar->value() - 1);
|
const pdf::PDFPage* page = m_document->getCatalog()->getPage(ui->pageIndexScrollBar->value() - 1);
|
||||||
if (!page)
|
if (!page)
|
||||||
{
|
{
|
||||||
ui->imageWidget->clear();
|
m_outputPreviewWidget->clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +321,7 @@ void OutputPreviewDialog::updatePageImage()
|
||||||
flags.setFlag(pdf::PDFTransparencyRendererSettings::SaveOriginalProcessImage, true);
|
flags.setFlag(pdf::PDFTransparencyRendererSettings::SaveOriginalProcessImage, true);
|
||||||
|
|
||||||
m_inkMapperForRendering = m_inkMapper;
|
m_inkMapperForRendering = m_inkMapper;
|
||||||
QSize renderSize = ui->imageWidget->getPageImageSizeHint();
|
QSize renderSize = m_outputPreviewWidget->getPageImageSizeHint();
|
||||||
auto renderImage = [this, page, renderSize, paperColor, activeColorMask, flags]() -> RenderedImage
|
auto renderImage = [this, page, renderSize, paperColor, activeColorMask, flags]() -> RenderedImage
|
||||||
{
|
{
|
||||||
return renderPage(page, renderSize, paperColor, activeColorMask, flags);
|
return renderPage(page, renderSize, paperColor, activeColorMask, flags);
|
||||||
|
@ -389,7 +392,7 @@ void OutputPreviewDialog::onPageImageRendered()
|
||||||
m_futureWatcher->deleteLater();
|
m_futureWatcher->deleteLater();
|
||||||
m_futureWatcher = nullptr;
|
m_futureWatcher = nullptr;
|
||||||
|
|
||||||
ui->imageWidget->setPageImage(qMove(result.image), qMove(result.originalProcessImage), result.pageSize);
|
m_outputPreviewWidget->setPageImage(qMove(result.image), qMove(result.originalProcessImage), result.pageSize);
|
||||||
|
|
||||||
if (m_needUpdateImage)
|
if (m_needUpdateImage)
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,6 +87,7 @@ private:
|
||||||
const pdf::PDFDocument* m_document;
|
const pdf::PDFDocument* m_document;
|
||||||
pdf::PDFWidget* m_widget;
|
pdf::PDFWidget* m_widget;
|
||||||
bool m_needUpdateImage;
|
bool m_needUpdateImage;
|
||||||
|
OutputPreviewWidget* m_outputPreviewWidget;
|
||||||
|
|
||||||
QFuture<RenderedImage> m_future;
|
QFuture<RenderedImage> m_future;
|
||||||
QFutureWatcher<RenderedImage>* m_futureWatcher;
|
QFutureWatcher<RenderedImage>* m_futureWatcher;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>955</width>
|
<width>955</width>
|
||||||
<height>677</height>
|
<height>686</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -40,9 +40,6 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<widget class="pdfplugin::OutputPreviewWidget" name="imageWidget" native="true"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QScrollBar" name="pageIndexScrollBar">
|
<widget class="QScrollBar" name="pageIndexScrollBar">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -316,14 +313,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>pdfplugin::OutputPreviewWidget</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>outputpreviewwidget.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
|
|
@ -29,7 +29,6 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
|
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
|
||||||
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
|
|
||||||
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
|
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
|
||||||
QApplication application(argc, argv);
|
QApplication application(argc, argv);
|
||||||
|
|
||||||
|
|
|
@ -48,4 +48,8 @@ add_executable(PdfTool
|
||||||
|
|
||||||
target_link_libraries(PdfTool PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Xml)
|
target_link_libraries(PdfTool PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Xml)
|
||||||
|
|
||||||
|
if(MINGW)
|
||||||
|
target_link_libraries(PdfTool PRIVATE ole32 sapi)
|
||||||
|
endif()
|
||||||
|
|
||||||
install(TARGETS PdfTool)
|
install(TARGETS PdfTool)
|
||||||
|
|
|
@ -258,7 +258,8 @@ PDFToolAbstractApplication::Options PDFToolFetchImages::getOptionsFlags() const
|
||||||
void PDFToolFetchImages::onImageExtracted(pdf::PDFInteger pageIndex, pdf::PDFInteger order, const QImage& image)
|
void PDFToolFetchImages::onImageExtracted(pdf::PDFInteger pageIndex, pdf::PDFInteger order, const QImage& image)
|
||||||
{
|
{
|
||||||
QCryptographicHash hasher(QCryptographicHash::Sha512);
|
QCryptographicHash hasher(QCryptographicHash::Sha512);
|
||||||
hasher.addData(reinterpret_cast<const char*>(image.bits()), image.sizeInBytes());
|
QByteArrayView imageData(image.bits(), image.sizeInBytes());
|
||||||
|
hasher.addData(imageData);
|
||||||
QByteArray hash = hasher.result();
|
QByteArray hash = hasher.result();
|
||||||
|
|
||||||
QMutexLocker lock(&m_mutex);
|
QMutexLocker lock(&m_mutex);
|
||||||
|
|
|
@ -155,7 +155,7 @@ int PDFToolInfoApplication::execute(const PDFToolOptions& options)
|
||||||
{
|
{
|
||||||
QString key = QString::fromLatin1(item.first);
|
QString key = QString::fromLatin1(item.first);
|
||||||
QVariant valueVariant = item.second;
|
QVariant valueVariant = item.second;
|
||||||
QString value = (valueVariant.type() == QVariant::DateTime) ? convertDateTimeToString(valueVariant.toDateTime().toLocalTime(), options.outputDateFormat) : valueVariant.toString();
|
QString value = (valueVariant.typeId() == QVariant::DateTime) ? convertDateTimeToString(valueVariant.toDateTime().toLocalTime(), options.outputDateFormat) : valueVariant.toString();
|
||||||
writeProperty("custom-property", key, value);
|
writeProperty("custom-property", key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "pdffont.h"
|
#include "pdffont.h"
|
||||||
#include "pdfconstants.h"
|
#include "pdfconstants.h"
|
||||||
|
|
||||||
|
#include <QColorSpace>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
namespace pdftool
|
namespace pdftool
|
||||||
|
@ -185,7 +186,7 @@ int PDFToolRenderBase::execute(const PDFToolOptions& options)
|
||||||
surfaceFormat = QSurfaceFormat::defaultFormat();
|
surfaceFormat = QSurfaceFormat::defaultFormat();
|
||||||
surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
|
surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
|
||||||
surfaceFormat.setSamples(options.renderMSAAsamples);
|
surfaceFormat.setSamples(options.renderMSAAsamples);
|
||||||
surfaceFormat.setColorSpace(QSurfaceFormat::sRGBColorSpace);
|
surfaceFormat.setColorSpace(QColorSpace(QColorSpace::SRgb));
|
||||||
surfaceFormat.setSwapBehavior(QSurfaceFormat::DefaultSwapBehavior);
|
surfaceFormat.setSwapBehavior(QSurfaceFormat::DefaultSwapBehavior);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue