PDF: Add a "Using Poppler $VERSION" string

It is sometimes useful to know which version of the poppler you're using
and to which you where built

Needs feature introduced in poppler just now
This commit is contained in:
Albert Astals Cid 2018-12-19 00:41:37 +01:00
parent a4a1978516
commit c950ea92f5
4 changed files with 28 additions and 0 deletions

View file

@ -107,6 +107,15 @@ int main()
}
" HAVE_POPPLER_0_69)
check_cxx_source_compiles("
#include <poppler-version.h>
int main()
{
QString s = Poppler::Version::string();
return 0;
}
" HAVE_POPPLER_0_73)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config-okular-poppler.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-okular-poppler.h

View file

@ -33,3 +33,6 @@
/* Defined if we have the 0.69 version of the Poppler library */
#cmakedefine HAVE_POPPLER_0_69 1
/* Defined if we have the 0.73 version of the Poppler library */
#cmakedefine HAVE_POPPLER_0_73 1

View file

@ -53,6 +53,7 @@
#include <config-okular-poppler.h>
#include <poppler-media.h>
#include <poppler-version.h>
#include "debug_pdf.h"
#include "annots.h"
@ -1490,6 +1491,16 @@ QVariant PDFGenerator::metaData( const QString & key, const QVariant & option )
#ifdef HAVE_POPPLER_0_53
QMutexLocker ml(userMutex());
return QVariant::fromValue<QVector<int>>(pdfdoc->formCalculateOrder());
#endif
}
else if ( key == QLatin1String("GeneratorExtraDescription") )
{
#ifdef HAVE_POPPLER_0_73
if (Poppler::Version::string() == POPPLER_VERSION) {
return i18n("Using Poppler %1", Poppler::Version::string());
} else {
return i18n("Using Poppler %1\n\nBuilt against Poppler %2", Poppler::Version::string(), POPPLER_VERSION);
}
#endif
}
return QVariant();

View file

@ -3166,6 +3166,11 @@ void Part::slotAboutBackend()
}
}
const QString extraDescription = m_document->metaData( QStringLiteral("GeneratorExtraDescription") ).toString();
if (!extraDescription.isEmpty()) {
aboutData.setShortDescription(aboutData.shortDescription() + QStringLiteral("\n\n") + extraDescription);
}
if (!icon.isNull()) {
// 48x48 is what KAboutApplicationDialog wants, which doesn't match any default so we hardcode it
aboutData.setProgramLogo(icon.pixmap(48, 48));