Commit 18b61027 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Move ifdefs to Discover instead of modifying Appstream

It's still necessary some modifications for find_package(Appstream)
parent c52df700
......@@ -19,10 +19,13 @@
***************************************************************************/
#include "AppPackageKitResource.h"
#include <AppstreamQt/screenshot.h>
#include <AppstreamQt/image.h>
#ifdef NEWAPPSTREAM
#include <AppStreamQt/icon.h>
#include <AppStreamQt/screenshot.h>
#include <AppStreamQt/image.h>
#else
#include <AppstreamQt/screenshot.h>
#include <AppstreamQt/image.h>
#endif
// #include <AppstreamQt/release.h>
#include <KLocalizedString>
......@@ -173,13 +176,20 @@ static QUrl screenshot(const Appstream::Component& comp, Appstream::Image::Kind
QUrl AppPackageKitResource::screenshotUrl()
{
#ifdef NEWAPPSTREAM
return screenshot(m_appdata, Appstream::Image::KindSource);
#else
return screenshot(m_appdata, Appstream::Image::Plain);
#endif
}
QUrl AppPackageKitResource::thumbnailUrl()
{
return screenshot(m_appdata, Appstream::Image::Thumbnail);
#ifdef NEWAPPSTREAM
return screenshot(m_appdata, Appstream::Image::KindThumbnail);
#else
return screenshot(m_appdata, Appstream::Image::Thumbnail);
#endif
}
void AppPackageKitResource::fetchScreenshots()
......@@ -187,8 +197,13 @@ void AppPackageKitResource::fetchScreenshots()
QList<QUrl> thumbnails, screenshots;
Q_FOREACH (const Appstream::Screenshot &s, m_appdata.screenshots()) {
const QUrl thumbnail = imageOfKind(s.images(), Appstream::Image::Thumbnail);
const QUrl plain = imageOfKind(s.images(), Appstream::Image::Plain);
#ifdef NEWAPPSTREAM
const QUrl thumbnail = imageOfKind(s.images(), Appstream::Image::KindThumbnail);
const QUrl plain = imageOfKind(s.images(), Appstream::Image::KindSource);
#else
const QUrl thumbnail = imageOfKind(s.images(), Appstream::Image::Thumbnail);
const QUrl plain = imageOfKind(s.images(), Appstream::Image::Plain);
#endif
if (plain.isEmpty())
qWarning() << "invalid screenshot for" << name();
......
......@@ -31,8 +31,8 @@
#include <PackageKit/Transaction>
#ifdef NEWAPPSTREAM
#include <AppstreamQt/pool.h>
#include <AppstreamQt/provided.h>
#include <AppStreamQt/pool.h>
#include <AppStreamQt/provided.h>
namespace AppStream {
typedef Provided Provides;
typedef Pool Database;
......
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