File indexing completed on 2024-04-21 03:56:25

0001 /*
0002     SPDX-FileCopyrightText: 2016 Dan Leinir Turthra Jensen <admin@leinir.dk>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef DOWNLOADLINKINFO_H
0008 #define DOWNLOADLINKINFO_H
0009 
0010 #include "KNSCore/Entry"
0011 
0012 #include <QSharedData>
0013 
0014 class DownloadLinkInfoPrivate;
0015 /**
0016  * @short One downloadable item as contained within one content item
0017  *
0018  * A simple data container which wraps a KNSCore::Entry::DownloadLinkInformation
0019  * instance and provides property accessors for each of the pieces of information stored
0020  * in it.
0021  */
0022 class DownloadLinkInfo
0023 {
0024     Q_GADGET
0025     Q_PROPERTY(QString name READ name CONSTANT)
0026     Q_PROPERTY(QString priceAmount READ priceAmount CONSTANT)
0027     Q_PROPERTY(QString distributionType READ distributionType CONSTANT)
0028     Q_PROPERTY(QString descriptionLink READ descriptionLink CONSTANT)
0029     Q_PROPERTY(int id READ id CONSTANT)
0030     Q_PROPERTY(bool isDownloadtypeLink READ isDownloadtypeLink CONSTANT)
0031     Q_PROPERTY(quint64 size READ size CONSTANT)
0032     Q_PROPERTY(QString formattedSize READ formattedSize CONSTANT)
0033     Q_PROPERTY(QString icon READ icon CONSTANT)
0034 
0035 public:
0036     explicit DownloadLinkInfo(const KNSCore::Entry::DownloadLinkInformation &data);
0037     DownloadLinkInfo(const DownloadLinkInfo &);
0038     DownloadLinkInfo &operator=(const DownloadLinkInfo &);
0039     ~DownloadLinkInfo();
0040 
0041     QString name() const;
0042     QString priceAmount() const;
0043     QString distributionType() const;
0044     QString descriptionLink() const;
0045     int id() const;
0046     bool isDownloadtypeLink() const;
0047     quint64 size() const;
0048     QString formattedSize() const;
0049     QString icon() const;
0050 
0051 private:
0052     QSharedDataPointer<DownloadLinkInfoPrivate> d;
0053 };
0054 
0055 #endif // DOWNLOADLINKINFO_H