diff --git a/src/modules/packagechooser/Config.cpp b/src/modules/packagechooser/Config.cpp index 931071a4e..642311b33 100644 --- a/src/modules/packagechooser/Config.cpp +++ b/src/modules/packagechooser/Config.cpp @@ -16,7 +16,6 @@ #ifdef HAVE_APPSTREAM_VERSION #include "ItemAppStream.h" -#include #include #endif diff --git a/src/modules/packagechooser/ItemAppStream.cpp b/src/modules/packagechooser/ItemAppStream.cpp index 7592c8308..a3b6e248d 100644 --- a/src/modules/packagechooser/ItemAppStream.cpp +++ b/src/modules/packagechooser/ItemAppStream.cpp @@ -7,20 +7,16 @@ * */ -/** @brief Loading items from AppData XML files. +/** @brief Loading items from AppStream database. * - * Only used if QtXML is found, implements PackageItem::fromAppData(). + * Only used if AppStreamQt is found, implements PackageItem::fromAppStream(). */ -#include "PackageModel.h" +#include "ItemAppStream.h" #include "locale/TranslationsModel.h" #include "utils/Logger.h" #include "utils/Variant.h" -#include -#include -#include - /// @brief Return number of pixels in a size, for < ordering purposes static inline quint64 sizeOrder( const QSize& size ) diff --git a/src/modules/packagechooser/ItemAppStream.h b/src/modules/packagechooser/ItemAppStream.h index 5d92ab443..a087a56dc 100644 --- a/src/modules/packagechooser/ItemAppStream.h +++ b/src/modules/packagechooser/ItemAppStream.h @@ -12,10 +12,28 @@ #include "PackageModel.h" -namespace AppStream -{ -class Pool; -} // namespace AppStream +/* + * This weird include mechanism is because an #include line is allowed + * to consist of preprocessor-tokens, which are expanded, and then + * the #include is *re*processed. But if it starts with < or ", then + * preprocessor tokens are not expanded. So we build up a #include <> + * style line with a suitable path -- if we are given a value for + * HAVE_APPSTREAM_HEADERS, that is the directory that the AppStreamQt + * headers live in. + */ +#define CALAMARES_LT < +#define CALAMARES_GT > + +#ifndef HAVE_APPSTREAM_HEADERS +#define HAVE_APPSTREAM_HEADERS AppStreamQt +#endif + +#include CALAMARES_LT HAVE_APPSTREAM_HEADERS/pool.h CALAMARES_GT +#include CALAMARES_LT HAVE_APPSTREAM_HEADERS/image.h CALAMARES_GT +#include CALAMARES_LT HAVE_APPSTREAM_HEADERS/screenshot.h CALAMARES_GT + +#undef CALAMARES_LT +#undef CALAMARES_GT /** @brief Loads an item from AppStream data. *