Commit a2550b7c authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Include API to provide an icon for the backend

CCBUG: 390464
parent 6f04c9d6
......@@ -59,6 +59,8 @@ public:
void setAddons(const AddonList& addons);
void setAddonInstalled(const QString& addon, bool installed);
QString sourceIcon() const override { return QStringLiteral("player-time"); }
public:
QString m_name;
......
......@@ -131,6 +131,7 @@ public:
// void setAddonInstalled(const QString& addon, bool installed);
void updateFromRef(FlatpakRef* ref);
QString sourceIcon() const override { return QStringLiteral("https://flatpak.org/img/logo.svg"); }
Q_SIGNALS:
void propertyStateChanged(PropertyKind kind, PropertyState state);
......
......@@ -65,6 +65,7 @@ public:
QUrl url() const override;
QString executeLabel() const override;
QString sourceIcon() const override { return QStringLiteral("get-hot-new-stuff"); }
private:
const QStringList m_categories;
......
......@@ -259,3 +259,8 @@ QString PackageKitResource::sizeDescription()
else
return i18np("%2 (plus %1 dependency)", "%2 (plus %1 dependencies)", m_dependenciesCount, AbstractResource::sizeDescription());
}
QString PackageKitResource::sourceIcon() const
{
return QStringLiteral("package-available");
}
......@@ -69,6 +69,8 @@ class PackageKitResource : public AbstractResource
QString sizeDescription() override;
void setDependenciesCount(uint count);
QString sourceIcon() const override;
public Q_SLOTS:
void addPackageId(PackageKit::Transaction::Info info, const QString &packageId, bool arch);
void setDetails(const PackageKit::Details& details);
......
......@@ -58,6 +58,7 @@ public:
void setSnap(const QSharedPointer<QSnapdSnap> &snap);
void setState(AbstractResource::State state);
QString sourceIcon() const override { return QStringLiteral("snap"); }
public:
void gotIcon();
......
......@@ -77,6 +77,7 @@ class DISCOVERCOMMON_EXPORT AbstractResource : public QObject
Q_PROPERTY(QString categoryDisplay READ categoryDisplay CONSTANT)
Q_PROPERTY(QUrl url READ url CONSTANT)
Q_PROPERTY(QString executeLabel READ executeLabel CONSTANT)
Q_PROPERTY(QString sourceIcon READ sourceIcon CONSTANT)
public:
/**
* This describes the state of the resource
......@@ -200,6 +201,7 @@ class DISCOVERCOMMON_EXPORT AbstractResource : public QObject
virtual QUrl url() const;
virtual QString executeLabel() const;
virtual QString sourceIcon() const = 0;
public Q_SLOTS:
virtual void fetchScreenshots();
......
......@@ -58,6 +58,7 @@ ResourcesProxyModel::ResourcesProxyModel(QObject *parent)
{ SectionRole, "section" },
{ MimeTypes, "mimetypes" },
{ LongDescriptionRole, "longDescription" },
{ SourceIconRole, "sourceIcon" },
{ SizeRole, "size" }
})
, m_currentStream(nullptr)
......
......@@ -75,7 +75,8 @@ public:
SectionRole,
MimeTypes,
SizeRole,
LongDescriptionRole
LongDescriptionRole,
SourceIconRole
};
Q_ENUM(Roles)
......
Supports Markdown
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