File indexing completed on 2024-11-24 04:54:57
0001 /* 0002 * SPDX-FileCopyrightText: 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <KNSCore/Entry> 0010 #include <QPointer> 0011 #include <attica/content.h> 0012 #include <resources/AbstractResource.h> 0013 0014 #include "discovercommon_export.h" 0015 0016 class KNSBackend; 0017 class DISCOVERCOMMON_EXPORT KNSResource : public AbstractResource 0018 { 0019 Q_OBJECT 0020 public: 0021 explicit KNSResource(const KNSCore::Entry &c, QStringList categories, KNSBackend *parent); 0022 ~KNSResource() override; 0023 0024 AbstractResource::State state() override; 0025 QVariant icon() const override; 0026 QString comment() override; 0027 QString name() const override; 0028 QString packageName() const override; 0029 QStringList categories() override; 0030 QUrl homepage() override; 0031 QJsonArray licenses() override; 0032 QString longDescription() override; 0033 QList<PackageState> addonsInformation() override 0034 { 0035 return QList<PackageState>(); 0036 } 0037 QString availableVersion() const override; 0038 QString installedVersion() const override; 0039 QString origin() const override; 0040 QString displayOrigin() const override; 0041 QString section() override; 0042 void fetchScreenshots() override; 0043 quint64 size() override; 0044 void fetchChangelog() override; 0045 QStringList extends() const override; 0046 AbstractResource::Type type() const override 0047 { 0048 return Addon; 0049 } 0050 QString author() const override; 0051 0052 KNSBackend *knsBackend() const; 0053 0054 void setEntry(const KNSCore::Entry &entry); 0055 KNSCore::Entry entry() const; 0056 0057 bool canExecute() const override; 0058 void invokeApplication() const override; 0059 0060 QUrl url() const override; 0061 QString executeLabel() const override; 0062 QString sourceIcon() const override 0063 { 0064 return QStringLiteral("get-hot-new-stuff"); 0065 } 0066 QDate releaseDate() const override; 0067 QVector<int> linkIds() const; 0068 QUrl donationURL() override; 0069 0070 Rating *ratingInstance(); 0071 0072 private: 0073 const QStringList m_categories; 0074 KNSCore::Entry m_entry; 0075 KNSCore::Entry::Status m_lastStatus; 0076 QScopedPointer<Rating> m_rating; 0077 };