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
remotes/origin/Applications/19.04
Albert Astals Cid 7 years ago
parent a4a1978516
commit c950ea92f5
  1. 9
      generators/poppler/CMakeLists.txt
  2. 3
      generators/poppler/config-okular-poppler.h.cmake
  3. 11
      generators/poppler/generator_pdf.cpp
  4. 5
      part.cpp

@ -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

@ -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

@ -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();

@ -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));

Loading…
Cancel
Save