Commit 3e83d955 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Move the metadata code into its own library

parent eca38514
......@@ -20,4 +20,5 @@ add_subdirectory( libkis )
if (NOT APPLE AND HAVE_QT_QUICK)
add_subdirectory( libqml )
endif()
add_subdirectory( metadata )
......@@ -4,7 +4,6 @@ add_subdirectory( tiles3 )
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/metadata
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty
${CMAKE_CURRENT_SOURCE_DIR}/brushengine
${CMAKE_CURRENT_SOURCE_DIR}/commands
......@@ -275,22 +274,6 @@ set(kritaimage_LIB_SRCS
kis_layer_composition.cpp
kis_selection_filters.cpp
KisProofingConfiguration.h
metadata/kis_meta_data_entry.cc
metadata/kis_meta_data_filter.cc
metadata/kis_meta_data_filter_p.cc
metadata/kis_meta_data_filter_registry.cc
metadata/kis_meta_data_filter_registry_model.cc
metadata/kis_meta_data_io_backend.cc
metadata/kis_meta_data_merge_strategy.cc
metadata/kis_meta_data_merge_strategy_p.cc
metadata/kis_meta_data_merge_strategy_registry.cc
metadata/kis_meta_data_parser.cc
metadata/kis_meta_data_schema.cc
metadata/kis_meta_data_schema_registry.cc
metadata/kis_meta_data_store.cc
metadata/kis_meta_data_type_info.cc
metadata/kis_meta_data_validator.cc
metadata/kis_meta_data_value.cc
kis_keyframe.cpp
kis_keyframe_channel.cpp
......@@ -338,10 +321,13 @@ target_link_libraries(kritaimage
PUBLIC
kritaversion
kritawidgets
kritaglobal kritapsd
kritaodf kritapigment
kritaglobal
kritapsd
kritaodf
kritapigment
kritacommand
kritawidgetutils
kritametadata
Qt5::Concurrent
)
......@@ -371,7 +357,6 @@ target_include_directories(kritaimage
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/filter>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/generator>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/layerstyles>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/metadata>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/processing>
)
......
......@@ -20,8 +20,8 @@
#define KIS_EXIF_INFO_VISITOR_H
#include <kis_node_visitor.h>
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_filter_registry_model.h>
#include <kis_meta_data_store.h>
#include <kis_meta_data_filter_registry_model.h>
#include <kis_paint_layer.h>
#include <kis_group_layer.h>
......
......@@ -12,7 +12,6 @@ else()
endif()
include_directories(
${CMAKE_SOURCE_DIR}/libs/image/metadata
${CMAKE_BINARY_DIR}/libs/image/
${CMAKE_SOURCE_DIR}/libs/image/
${CMAKE_SOURCE_DIR}/libs/image/brushengine
......@@ -141,7 +140,6 @@ ecm_add_tests(
kis_update_scheduler_test.cpp
kis_async_merger_test.cpp
kis_cage_transform_worker_test.cpp
kis_meta_data_test.cpp
kis_random_generator_test.cpp
kis_keyframing_test.cpp
kis_filter_mask_test.cpp
......
......@@ -586,7 +586,7 @@ void KisImageTest::testFlattenLayer()
}
}
#include <metadata/kis_meta_data_merge_strategy_registry.h>
#include <kis_meta_data_merge_strategy_registry.h>
template<class ContainerTest>
KisLayerSP mergeHelper(ContainerTest &p, KisLayerSP layer)
......
......@@ -25,9 +25,9 @@
#include <klocalizedstring.h>
#include <kis_image.h>
#include <KoColorSpace.h>
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_filter_registry_model.h>
#include <metadata/kis_exif_info_visitor.h>
#include <kis_meta_data_store.h>
#include <kis_meta_data_filter_registry_model.h>
#include <kis_exif_info_visitor.h>
class ExifCheck : public KisExportCheckBase
{
......
......@@ -45,7 +45,7 @@
#include <lazybrush/kis_colorize_mask.h>
#include <kis_layer.h>
#include <kis_meta_data_merge_strategy.h>
#include <metadata/kis_meta_data_merge_strategy_registry.h>
#include <kis_meta_data_merge_strategy_registry.h>
#include <kis_filter_strategy.h>
#include <kis_raster_keyframe_channel.h>
......
set(kritametadata_LIB_SRCS
kis_legacy_importer.cc
kis_meta_data_entry.cc
kis_meta_data_filter.cc
kis_meta_data_filter_p.cc
kis_meta_data_filter_registry.cc
kis_meta_data_filter_registry_model.cc
kis_meta_data_io_backend.cc
kis_meta_data_merge_strategy.cc
kis_meta_data_merge_strategy_p.cc
kis_meta_data_merge_strategy_registry.cc
kis_meta_data_parser.cc
kis_meta_data_schema.cc
kis_meta_data_schema_registry.cc
kis_meta_data_store.cc
kis_meta_data_type_info.cc
kis_meta_data_validator.cc
kis_meta_data_value.cc
)
add_library(kritametadata SHARED ${kritametadata_LIB_SRCS} )
generate_export_header(kritametadata)
target_link_libraries(kritametadata kritaversion kritaglobal kritaplugin kritawidgetutils)
set_target_properties(kritametadata PROPERTIES
VERSION ${GENERIC_KRITA_LIB_VERSION} SOVERSION ${GENERIC_KRITA_LIB_SOVERSION}
)
install(TARGETS kritametadata ${INSTALL_TARGETS_DEFAULT_ARGS})
add_subdirectory(tests)
......@@ -20,7 +20,7 @@
#ifndef _KIS_META_DATA_ENTRY_H_
#define _KIS_META_DATA_ENTRY_H_
#include <kritaimage_export.h>
#include <kritametadata_export.h>
#include <kis_debug.h>
class QString;
......@@ -33,7 +33,7 @@ class Schema;
/**
* Represent a metadata entry, a name and a value (\ref KisMetaData::Value).
*/
class KRITAIMAGE_EXPORT Entry
class KRITAMETADATA_EXPORT Entry
{
struct Private;
friend class Store;
......@@ -92,6 +92,6 @@ private:
};
}
KRITAIMAGE_EXPORT QDebug operator<<(QDebug debug, const KisMetaData::Entry &c);
KRITAMETADATA_EXPORT QDebug operator<<(QDebug debug, const KisMetaData::Entry &c);
#endif
......@@ -19,7 +19,7 @@
#ifndef _KIS_META_DATA_FILTER_H_
#define _KIS_META_DATA_FILTER_H_
#include <kritaimage_export.h>
#include <kritametadata_export.h>
class QString;
namespace KisMetaData
......
......@@ -19,7 +19,7 @@
#ifndef _KIS_META_DATA_FILTER_REGISTRY_H_
#define _KIS_META_DATA_FILTER_REGISTRY_H_
#include <kritaimage_export.h>
#include <kritametadata_export.h>
#include "KoGenericRegistry.h"
#include "kis_meta_data_filter.h"
......@@ -27,7 +27,7 @@
namespace KisMetaData
{
class KRITAIMAGE_EXPORT FilterRegistry : public KoGenericRegistry<const KisMetaData::Filter*>
class KRITAMETADATA_EXPORT FilterRegistry : public KoGenericRegistry<const KisMetaData::Filter*>
{
public:
FilterRegistry();
......
......@@ -32,7 +32,7 @@ namespace KisMetaData
* Use this model to display a list of filters (KisMetaData::Filter) that can be
* enabled or disabled.
*/
class KRITAIMAGE_EXPORT FilterRegistryModel : public KoGenericRegistryModel<const Filter*>
class KRITAMETADATA_EXPORT FilterRegistryModel : public KoGenericRegistryModel<const Filter*>
{
public:
FilterRegistryModel();
......
......@@ -19,7 +19,7 @@
#ifndef _KIS_META_DATA_IO_BACKEND_H_
#define _KIS_META_DATA_IO_BACKEND_H_
#include <kritaimage_export.h>
#include <kritametadata_export.h>
#include <KoGenericRegistry.h>
......@@ -33,7 +33,7 @@ class Store;
* For instance, to add support to exif or xmp or iptc or dublin core
* or anything else, it is needed to extend this interface.
*/
class KRITAIMAGE_EXPORT IOBackend
class KRITAMETADATA_EXPORT IOBackend
{
public:
......@@ -98,7 +98,7 @@ public:
virtual bool loadFrom(Store* store, QIODevice* ioDevice) const = 0;
};
class KRITAIMAGE_EXPORT IOBackendRegistry : public KoGenericRegistry<IOBackend*>
class KRITAMETADATA_EXPORT IOBackendRegistry : public KoGenericRegistry<IOBackend*>
{
public:
......
......@@ -21,7 +21,7 @@
#include <QList>
#include <kritaimage_export.h>
#include <kritametadata_export.h>
class QString;
......@@ -34,7 +34,7 @@ class Store;
* This is used to decide which entries of a metadata store is kept, or how they
* are modified when a list of meta data stores are merged together.
*/
class KRITAIMAGE_EXPORT MergeStrategy
class KRITAMETADATA_EXPORT MergeStrategy
{
public:
virtual ~MergeStrategy();
......
......@@ -19,7 +19,7 @@
#ifndef _KIS_META_DATA_MERGE_STRATEGY_REGISTRY_H_
#define _KIS_META_DATA_MERGE_STRATEGY_REGISTRY_H_
#include <kritaimage_export.h>
#include <kritametadata_export.h>
#include "KoGenericRegistry.h"
#include "kis_meta_data_merge_strategy.h"
......@@ -27,7 +27,7 @@
namespace KisMetaData
{
class KRITAIMAGE_EXPORT MergeStrategyRegistry : public KoGenericRegistry<const KisMetaData::MergeStrategy*>
class KRITAMETADATA_EXPORT MergeStrategyRegistry : public KoGenericRegistry<const KisMetaData::MergeStrategy*>
{
public:
MergeStrategyRegistry();
......
......@@ -19,7 +19,7 @@
#ifndef _KIS_META_DATA_PARSER_H_
#define _KIS_META_DATA_PARSER_H_
#include <kritaimage_export.h>
#include <kritametadata_export.h>
#include <QString>
......@@ -30,7 +30,7 @@ class Value;
/**
* This class allow to parse from a string and return a value.
*/
class KRITAIMAGE_EXPORT Parser
class KRITAMETADATA_EXPORT Parser
{
friend class TypeInfo;
public:
......
......@@ -19,7 +19,7 @@
#ifndef _KIS_META_DATA_SCHEMA_H_
#define _KIS_META_DATA_SCHEMA_H_
#include <kritaimage_export.h>
#include <kritametadata_export.h>
#include <kis_debug.h>
class QString;
......@@ -30,7 +30,7 @@ namespace KisMetaData
class SchemaRegistry;
class TypeInfo;
class KRITAIMAGE_EXPORT Schema
class KRITAMETADATA_EXPORT Schema
{
friend class SchemaRegistry;
......@@ -70,6 +70,6 @@ private:
}
KRITAIMAGE_EXPORT QDebug operator<<(QDebug debug, const KisMetaData::Schema &c);
KRITAMETADATA_EXPORT QDebug operator<<(QDebug debug, const KisMetaData::Schema &c);
#endif
......@@ -19,7 +19,7 @@
#ifndef _KIS_META_DATA_SCHEMA_REGISTRY_H_
#define _KIS_META_DATA_SCHEMA_REGISTRY_H_
#include <kritaimage_export.h>
#include <kritametadata_export.h>
class QString;
class QDebug;
......@@ -29,7 +29,7 @@ namespace KisMetaData
class Schema;
class KRITAIMAGE_EXPORT SchemaRegistry
class KRITAMETADATA_EXPORT SchemaRegistry
{
struct Private;
SchemaRegistry();
......@@ -64,6 +64,6 @@ private:
};
}
KRITAIMAGE_EXPORT QDebug operator<<(QDebug debug, const KisMetaData::Schema &c);
KRITAMETADATA_EXPORT QDebug operator<<(QDebug debug, const KisMetaData::Schema &c);
#endif
......@@ -20,7 +20,7 @@
#ifndef _KIS_META_DATA_STORE_H_
#define _KIS_META_DATA_STORE_H_
#include <kritaimage_export.h>
#include <kritametadata_export.h>
#include <QHash>
......@@ -35,7 +35,7 @@ class Value;
* This class holds the list of metadata entries and schemas (for instance the
* author of the image, copyright holder, license, aperture, speed...)
*/
class KRITAIMAGE_EXPORT Store
class KRITAMETADATA_EXPORT Store
{
struct Private;
public:
......
......@@ -21,14 +21,14 @@
#include <QList>
#include <QString>
#include <kritaimage_export.h>
#include <kritametadata_export.h>
namespace KisMetaData
{
class Parser;
class Schema;
class Value;
class KRITAIMAGE_EXPORT TypeInfo
class KRITAMETADATA_EXPORT TypeInfo
{
public:
enum PropertyType {
......@@ -46,7 +46,7 @@ public:
OpenedChoice,
ClosedChoice
};
class KRITAIMAGE_EXPORT Choice
class KRITAMETADATA_EXPORT Choice
{
public:
Choice(const Value&, const QString& hint);
......
......@@ -20,7 +20,7 @@
#include <QHash>
struct KRITAIMAGE_EXPORT KisMetaData::TypeInfo::Private {
struct KRITAMETADATA_EXPORT KisMetaData::TypeInfo::Private {
Private() : embeddedTypeInfo(0), structureSchema(0), parser(0) {}
PropertyType propertyType;
const TypeInfo* embeddedTypeInfo;
......
......@@ -22,7 +22,7 @@
#include <QMap>
#include <QString>
#include <kritaimage_export.h>
#include <kritametadata_export.h>
namespace KisMetaData
{
......@@ -30,10 +30,10 @@ class Store;
/**
* This class contains information on the validation results of a \ref KisMetaData::Store .
*/
class KRITAIMAGE_EXPORT Validator
class KRITAMETADATA_EXPORT Validator
{
public:
class KRITAIMAGE_EXPORT Reason
class KRITAMETADATA_EXPORT Reason
{
friend class Validator;
friend class QMap<QString, Reason>;
......
......@@ -21,7 +21,7 @@
#include <QList>
#include <QMap>
#include <kritaimage_export.h>
#include <kritametadata_export.h>
#include <boost/operators.hpp>
class QVariant;
......@@ -43,7 +43,7 @@ struct Rational : public boost::equality_comparable<Rational>
* Value is build on top of QVariant to extend it to support the various types
* and extensions through property qualifiers.
*/
class KRITAIMAGE_EXPORT Value
class KRITAMETADATA_EXPORT Value
{
struct Private;
public:
......@@ -129,6 +129,6 @@ private:
}
KRITAIMAGE_EXPORT QDebug operator<<(QDebug debug, const KisMetaData::Value &v);
KRITAMETADATA_EXPORT QDebug operator<<(QDebug debug, const KisMetaData::Value &v);
#endif
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
include(ECMAddTests)
include(KritaAddBrokenUnitTest)
macro_add_unittest_definitions()
ecm_add_tests(
kis_meta_data_test.cpp
NAME_PREFIX "libs-metadata-"
LINK_LIBRARIES kritametadata Qt5::Test)
......@@ -75,7 +75,7 @@
#include <generator/kis_generator_registry.h>
#include <generator/kis_generator.h>
#include <brushengine/kis_paintop_registry.h>
#include <metadata/kis_meta_data_io_backend.h>
#include <kis_meta_data_io_backend.h>
#include "kisexiv2/kis_exiv2.h"
#include "KisApplicationArguments.h"
#include <kis_debug.h>
......
......@@ -60,8 +60,8 @@
#include <flake/kis_shape_layer.h>
#include <kis_undo_adapter.h>
#include <kis_painter.h>
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_merge_strategy_registry.h>
#include <kis_meta_data_store.h>
#include <kis_meta_data_merge_strategy_registry.h>
#include <kis_psd_layer_style.h>
#include <KisMimeDatabase.h>
......
......@@ -59,8 +59,8 @@
#include <kis_transaction.h>
#include <kis_paint_layer.h>
#include <kis_group_layer.h>
#include <metadata/kis_meta_data_io_backend.h>
#include <metadata/kis_meta_data_store.h>
#include <kis_meta_data_io_backend.h>
#include <kis_meta_data_store.h>
#include <KoColorModelStandardIds.h>
#include "dialogs/kis_dlg_png_import.h"
#include "kis_clipboard.h"
......
......@@ -33,11 +33,11 @@
#include "kis_exiv2.h"
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_entry.h>
#include <metadata/kis_meta_data_value.h>
#include <metadata/kis_meta_data_schema.h>
#include <metadata/kis_meta_data_schema_registry.h>
#include <kis_meta_data_store.h>
#include <kis_meta_data_entry.h>
#include <kis_meta_data_value.h>
#include <kis_meta_data_schema.h>
#include <kis_meta_data_schema_registry.h>
struct KisExifIO::Private {
};
......
......@@ -18,7 +18,7 @@
#ifndef _KIS_EXIF_IO_H_
#define _KIS_EXIF_IO_H_
#include <metadata/kis_meta_data_io_backend.h>
#include <kis_meta_data_io_backend.h>
#include <klocalizedstring.h>
......
......@@ -24,7 +24,7 @@
#include "kis_exif_io.h"
#include "kis_xmp_io.h"
#include <metadata/kis_meta_data_value.h>
#include <kis_meta_data_value.h>
#include <kis_debug.h>
// ---- Generic conversion functions ---- //
......
......@@ -20,7 +20,7 @@
#define _KIS_EXIV2_H_
#include <metadata/kis_meta_data_value.h>
#include <kis_meta_data_value.h>
#include <exiv2/value.hpp>
#include "kritaui_export.h"
......
......@@ -23,11 +23,11 @@
#include "kis_exiv2.h"
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_entry.h>
#include <metadata/kis_meta_data_value.h>
#include <metadata/kis_meta_data_schema.h>
#include <metadata/kis_meta_data_schema_registry.h>
#include <kis_meta_data_store.h>
#include <kis_meta_data_entry.h>
#include <kis_meta_data_value.h>
#include <kis_meta_data_schema.h>
#include <kis_meta_data_schema_registry.h>
const char photoshopMarker[] = "Photoshop 3.0\0";
const char photoshopBimId_[] = "8BIM";
......
......@@ -19,7 +19,7 @@
#ifndef _KIS_IPTC_IO_H_
#define _KIS_IPTC_IO_H_
#include <metadata/kis_meta_data_io_backend.h>
#include <kis_meta_data_io_backend.h>
#include <klocalizedstring.h>
......
......@@ -21,13 +21,13 @@
#include "kis_exiv2.h"
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_entry.h>
#include <metadata/kis_meta_data_parser.h>
#include <metadata/kis_meta_data_value.h>
#include <metadata/kis_meta_data_schema.h>
#include <metadata/kis_meta_data_schema_registry.h>
#include <metadata/kis_meta_data_type_info.h>
#include <kis_meta_data_store.h>
#include <kis_meta_data_entry.h>
#include <kis_meta_data_parser.h>
#include <kis_meta_data_value.h>
#include <kis_meta_data_schema.h>
#include <kis_meta_data_schema_registry.h>
#include <kis_meta_data_type_info.h>
#include <kis_debug.h>
......
......@@ -18,7 +18,7 @@
#ifndef _KIS_XMP_IO_H_
#define _KIS_XMP_IO_H_
#include <metadata/kis_meta_data_io_backend.h>
#include <kis_meta_data_io_backend.h>
#include <klocalizedstring.h>
......
......@@ -30,7 +30,7 @@
#include "kis_meta_data_schema_registry.h"
#include "kis_meta_data_store.h"
#include "kis_meta_data_validator.h"
#include <metadata/kis_meta_data_value.h>
#include <kis_meta_data_value.h>
#include "kisexiv2/kis_exiv2.h"
#include "filestest.h"
#include "sdk/tests/kistest.h"
......
......@@ -30,8 +30,8 @@
#include <KisPart.h>
#include <KisDocument.h>
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_merge_strategy_registry.h>
#include <kis_meta_data_store.h>
#include <kis_meta_data_merge_strategy_registry.h>
#include "kis_filter_strategy.h"
......
......@@ -21,7 +21,7 @@
#include <KoDialog.h>
#include <kis_debug.h>
#include <metadata/kis_meta_data_merge_strategy_registry.h>
#include <kis_meta_data_merge_strategy_registry.h>
#include "ui_wdgmetadatamergestrategychooser.h"
......
......@@ -22,9 +22,9 @@
#include <kis_debug.h>
#include <metadata/kis_meta_data_value.h>
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_entry.h>
#include <kis_meta_data_value.h>
#include <kis_meta_data_store.h>
#include <kis_meta_data_entry.h>
struct KisEntryEditor::Private {
QObject* object;
......
......@@ -27,11 +27,11 @@
#include <kis_debug.h>
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_entry.h>
#include <metadata/kis_meta_data_value.h>
#include <metadata/kis_meta_data_schema.h>
#include <metadata/kis_meta_data_schema_registry.h>
#include <kis_meta_data_store.h>
#include <kis_meta_data_entry.h>
#include <kis_meta_data_value.h>
#include <kis_meta_data_schema.h>
#include <kis_meta_data_schema_registry.h>
#include <kis_icon.h>
#include "kis_entry_editor.h"
#include <QTableView>
......
......@@ -20,9 +20,9 @@
#include <klocalizedstring.h>
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_entry.h>
#include <metadata/kis_meta_data_value.h>
#include <kis_meta_data_store.h>
#include <kis_meta_data_entry.h>
#include <kis_meta_data_value.h>
KisMetaDataModel::KisMetaDataModel(KisMetaData::Store* store) : m_store(store)
{
......
......@@ -36,10 +36,10 @@
#include "kis_action.h"
#include "kis_image.h"