Make KFileMetadata dependency optional (fixes CI build)

parent 7ec8000e
......@@ -75,7 +75,14 @@ check_include_files(pthread.h HAVE_PTHREAD_H)
find_package(Qt5 CONFIG REQUIRED Core DBus Test Widgets Script Svg)
find_package(KF5 5.15 REQUIRED COMPONENTS Archive Bookmarks CoreAddons Config ConfigWidgets
DBusAddons KIO WidgetsAddons Plotting NotifyConfig NewStuff XmlGui Notifications GuiAddons TextWidgets IconThemes DocTools Crash FileMetaData)
DBusAddons KIO WidgetsAddons Plotting NotifyConfig NewStuff XmlGui Notifications GuiAddons TextWidgets IconThemes DocTools Crash OPTIONAL_COMPONENTS FileMetaData)
if (KF5FileMetaData_FOUND)
message(STATUS "Found KF5 FileMetadata to extract file metadata")
set(KF5_FILEMETADATA TRUE)
else()
message(STATUS "KF5 FileMetadata not found, file metadata will not be available")
endif()
# Search MLT package.
find_package(MLT ${MLT_MIN_VERSION} REQUIRED)
......
......@@ -243,8 +243,6 @@ include_directories(
# to the components requested in find_package().
#include(${QT_USE_FILE})
target_link_libraries(kdenlive
KF5::WidgetsAddons
KF5::Plotting
......@@ -260,7 +258,6 @@ target_link_libraries(kdenlive
KF5::XmlGui
KF5::GuiAddons
KF5::Notifications
KF5::FileMetaData
KF5::TextWidgets
KF5::IconThemes
KF5::Crash
......@@ -275,6 +272,11 @@ target_link_libraries(kdenlive
kiss_fft
)
if (KF5_FILEMETADATA)
add_definitions(-DKF5_USE_FILEMETADATA)
target_link_libraries(kdenlive KF5::FileMetaData)
endif()
qt5_use_modules( kdenlive Script Widgets Concurrent Qml Quick)
if(Q_WS_X11)
......
......@@ -30,10 +30,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "utils/KoIconUtils.h"
#include <KLocalizedString>
#ifdef KF5_USE_FILEMETADATA
#include <KFileMetaData/Extractor>
#include <KFileMetaData/ExtractionResult>
#include <KFileMetaData/PropertyInfo>
#include <KFileMetaData/ExtractorCollection>
#endif
#include <KIO/Global>
#include <QMimeDatabase>
......@@ -51,6 +55,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QToolBar>
#include <QFileDialog>
#ifdef KF5_USE_FILEMETADATA
class ExtractionResult : public KFileMetaData::ExtractionResult
{
public:
......@@ -58,9 +63,9 @@ class ExtractionResult : public KFileMetaData::ExtractionResult
: KFileMetaData::ExtractionResult( filename, mimetype, KFileMetaData::ExtractionResult::ExtractMetaData ),
m_tree( tree ) {}
void append(const QString& text) override {}
void append(const QString& /*text*/) override {}
void addType(KFileMetaData::Type::Type type) override {}
void addType(KFileMetaData::Type::Type /*type*/) override {}
void add(KFileMetaData::Property::Property property, const QVariant& value) override
{
......@@ -107,7 +112,7 @@ class ExtractionResult : public KFileMetaData::ExtractionResult
private:
QTreeWidget *m_tree;
};
#endif
ClipPropertiesController::ClipPropertiesController(Timecode tc, ClipController *controller, QWidget *parent) : QTabWidget(parent)
, m_controller(controller)
......@@ -637,6 +642,8 @@ void ClipPropertiesController::fillProperties()
QList <QStringList> propertyMap;
m_propertiesTree->setSortingEnabled(false);
#ifdef KF5_USE_FILEMETADATA
// Read File Metadata through KDE's metadata system
KFileMetaData::ExtractorCollection metaDataCollection;
QMimeDatabase mimeDatabase;
......@@ -648,6 +655,7 @@ void ClipPropertiesController::fillProperties()
ExtractionResult extractionResult(m_controller->clipUrl().toLocalFile(), mimeType.name(), m_propertiesTree);
plugin->extract(&extractionResult);
}
#endif
// Get MLT's metadata
if (m_type == Image) {
......
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