Commit 2a0db12c authored by Volker Krause's avatar Volker Krause
Browse files

Move extractor engine capabilities string to the library

This allows us to show this in the app about screen too, not just in the
command line tool.
parent 2ad1d3b1
......@@ -67,6 +67,7 @@ set(kitinerary_lib_srcs
calendarhandler.cpp
documentutil.cpp
extractor.cpp
extractorcapabilities.cpp
extractorengine.cpp
extractorfilter.cpp
extractorinput.cpp
......@@ -101,6 +102,7 @@ set_target_properties(KPimItinerary PROPERTIES
)
target_include_directories(KPimItinerary INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_PIM}>")
target_include_directories(KPimItinerary PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
target_include_directories(KPimItinerary PRIVATE ${CMAKE_BINARY_DIR})
target_link_libraries(KPimItinerary
PUBLIC
Qt5::Core
......@@ -142,6 +144,7 @@ ecm_generate_headers(KItinerary_FORWARDING_HEADERS
CalendarHandler
DocumentUtil
Extractor
ExtractorCapabilities
ExtractorEngine
ExtractorFilter
ExtractorInput
......
......@@ -19,6 +19,7 @@
#include <kitinerary_version.h>
#include <KItinerary/Extractor>
#include <KItinerary/ExtractorCapabilities>
#include <KItinerary/ExtractorEngine>
#include <KItinerary/ExtractorInput>
#include <KItinerary/ExtractorPostprocessor>
......@@ -41,56 +42,7 @@ using namespace KItinerary;
static void printCapabilities()
{
std::cout << "HTML support : "
#ifdef HAVE_LIBXML2
<< "libxml2"
#else
<< "not available"
#endif
<< std::endl;
std::cout << "PDF support : "
#ifdef HAVE_POPPLER
<< "poppler (" << KPOPPLER_VERSION_STRING << ")"
#else
<< "not available"
#endif
<< std::endl;
std::cout << "iCal support : "
#ifdef HAVE_KCAL
<< "kcal"
#else
<< "not available"
#endif
<< std::endl;
std::cout << "Barcode decoder : "
#ifdef HAVE_ZXING
<< "zxing"
#else
<< "not available"
#endif
<< std::endl;
std::cout << "Phone number decoder: "
#ifdef HAVE_PHONENUMBER
<< "libphonenumber"
#else
<< "not available"
#endif
<< std::endl;
std::cout << "RSA support : "
#ifdef HAVE_OPENSSL_RSA
<< "openssl"
#else
<< "not available"
#endif
<< std::endl;
ExtractorRepository repo;
std::cout << "Extractor scripts : " << repo.allExtractors().size() << std::endl;
std::cout << qPrintable(ExtractorCapabilities::capabilitiesString());
}
static void printExtractors()
......
/*
Copyright (C) 2019 Volker Krause <vkrause@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program 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 Library General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <config-kitinerary.h>
#include <kitinerary_version.h>
#include "extractorcapabilities.h"
#include "extractor.h"
#include "extractorrepository.h"
#include <QString>
using namespace KItinerary;
QString ExtractorCapabilities::capabilitiesString()
{
const char s[] =
"Engine version : " KITINERARY_VERSION_STRING "\n"
"HTML support : "
#ifdef HAVE_LIBXML2
"libxml2"
#else
"not available"
#endif
"\n"
"PDF support : "
#ifdef HAVE_POPPLER
"poppler (" KPOPPLER_VERSION_STRING ")"
#else
"not available"
#endif
"\n"
"iCal support : "
#ifdef HAVE_KCAL
"kcal"
#else
"not available"
#endif
"\n"
"Barcode decoder : "
#ifdef HAVE_ZXING
"zxing"
#else
"not available"
#endif
"\n"
"Phone number decoder: "
#ifdef HAVE_PHONENUMBER
"libphonenumber"
#else
"not available"
#endif
"\n"
"RSA support : "
#ifdef HAVE_OPENSSL_RSA
"openssl"
#else
"not available"
#endif
"\n"
"Extractor scripts : ";
auto caps = QString::fromLatin1(s);
ExtractorRepository repo;
caps += QString::number(repo.allExtractors().size()) + QLatin1Char('\n');
return caps;
}
/*
Copyright (C) 2019 Volker Krause <vkrause@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program 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 Library General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef KITINERARY_EXTRACTORCAPABILITIES_H
#define KITINERARY_EXTRACTORCAPABILITIES_H
#include "kitinerary_export.h"
class QString;
namespace KItinerary {
/** Diagnositic information about which features of the extractor are available.
* This typically depends on build options.
*/
namespace ExtractorCapabilities
{
/** Textual representation, mainly useful for bug reports/support. */
KITINERARY_EXPORT QString capabilitiesString();
}
}
#endif // KITINERARY_EXTRACTORCAPABILITIES_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment