1 | /* |
2 | SPDX-FileCopyrightText: 2016 Dan Leinir Turthra Jensen <admin@leinir.dk> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
5 | */ |
6 | |
7 | #ifndef DOWNLOADLINKINFO_H |
8 | #define DOWNLOADLINKINFO_H |
9 | |
10 | #include "KNSCore/Entry" |
11 | |
12 | #include <QSharedData> |
13 | |
14 | class DownloadLinkInfoPrivate; |
15 | /** |
16 | * @short One downloadable item as contained within one content item |
17 | * |
18 | * A simple data container which wraps a KNSCore::Entry::DownloadLinkInformation |
19 | * instance and provides property accessors for each of the pieces of information stored |
20 | * in it. |
21 | */ |
22 | class DownloadLinkInfo |
23 | { |
24 | Q_GADGET |
25 | Q_PROPERTY(QString name READ name CONSTANT) |
26 | Q_PROPERTY(QString priceAmount READ priceAmount CONSTANT) |
27 | Q_PROPERTY(QString distributionType READ distributionType CONSTANT) |
28 | Q_PROPERTY(QString descriptionLink READ descriptionLink CONSTANT) |
29 | Q_PROPERTY(int id READ id CONSTANT) |
30 | Q_PROPERTY(bool isDownloadtypeLink READ isDownloadtypeLink CONSTANT) |
31 | Q_PROPERTY(quint64 size READ size CONSTANT) |
32 | Q_PROPERTY(QString formattedSize READ formattedSize CONSTANT) |
33 | Q_PROPERTY(QString icon READ icon CONSTANT) |
34 | |
35 | public: |
36 | explicit DownloadLinkInfo(const KNSCore::Entry::DownloadLinkInformation &data); |
37 | DownloadLinkInfo(const DownloadLinkInfo &); |
38 | DownloadLinkInfo &operator=(const DownloadLinkInfo &); |
39 | ~DownloadLinkInfo(); |
40 | |
41 | QString name() const; |
42 | QString priceAmount() const; |
43 | QString distributionType() const; |
44 | QString descriptionLink() const; |
45 | int id() const; |
46 | bool isDownloadtypeLink() const; |
47 | quint64 size() const; |
48 | QString formattedSize() const; |
49 | QString icon() const; |
50 | |
51 | private: |
52 | QSharedDataPointer<DownloadLinkInfoPrivate> d; |
53 | }; |
54 | |
55 | #endif // DOWNLOADLINKINFO_H |
56 | |