KNewStuff

entry.cpp
1 /*
2  SPDX-FileCopyrightText: 2009 Frederik Gladhorn <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6 
7 #include "entry.h"
8 #include "entry_p.h"
9 #include <knewstuff_debug.h>
10 
11 #include <QStringList>
12 
13 using namespace KNS3;
14 
15 Entry::Entry()
16  : d(new EntryPrivate)
17 {
18 }
19 
20 Entry::Entry(const Entry &other)
21  : d(other.d)
22 {
23 }
24 
25 Entry &Entry::operator=(const Entry &other)
26 {
27  d = other.d;
28  return *this;
29 }
30 
31 Entry::~Entry()
32 {
33 }
34 
35 QString Entry::id() const
36 {
37  return d->e.uniqueId();
38 }
39 
40 QString Entry::providerId() const
41 {
42  return d->e.providerId();
43 }
44 
45 QString Entry::name() const
46 {
47  return d->e.name();
48 }
49 
50 QString Entry::category() const
51 {
52  return d->e.category();
53 }
54 
55 QString Entry::license() const
56 {
57  return d->e.license();
58 }
59 
60 QString Entry::summary() const
61 {
62  return d->e.summary();
63 }
64 
65 QString Entry::version() const
66 {
67  return d->e.version();
68 }
69 
70 Entry::Status Entry::status() const
71 {
72  return static_cast<Entry::Status>(d->e.status());
73 }
74 
76 {
77  return d->e.installedFiles();
78 }
79 
81 {
82  return d->e.uninstalledFiles();
83 }
84 
86 {
87  return d->e.homepage();
88 }
89 
90 static void appendIfValid(QList<QUrl>& list, const QUrl &value)
91 {
92  if (value.isValid() && !value.isEmpty())
93  list << value;
94 }
95 
97 {
98  QList<QUrl> ret;
99  appendIfValid(ret, QUrl(d->e.previewUrl(KNSCore::EntryInternal::PreviewBig1)));
100  appendIfValid(ret, QUrl(d->e.previewUrl(KNSCore::EntryInternal::PreviewBig2)));
101  appendIfValid(ret, QUrl(d->e.previewUrl(KNSCore::EntryInternal::PreviewBig3)));
102  return ret;
103 }
104 
106 {
107  QList<QUrl> ret;
108  appendIfValid(ret, QUrl(d->e.previewUrl(KNSCore::EntryInternal::PreviewSmall1)));
109  appendIfValid(ret, QUrl(d->e.previewUrl(KNSCore::EntryInternal::PreviewSmall2)));
110  appendIfValid(ret, QUrl(d->e.previewUrl(KNSCore::EntryInternal::PreviewSmall3)));
111  return ret;
112 }
113 
114 quint64 KNS3::Entry::size() const
115 {
116  const auto downloadInfo = d->e.downloadLinkInformationList();
117  return downloadInfo.isEmpty() ? 0 : downloadInfo.at(0).size;
118 }
119 
121 {
122  return d->e.numberOfComments();
123 }
124 
126 {
127  return d->e.rating();
128 }
129 
131 {
132  return d->e.updateVersion();
133 }
134 
136 {
137  return d->e.changelog();
138 }
139 
141 {
142  return d->e.shortSummary();
143 }
QList< QUrl > previewImages() const
Definition: entry.cpp:96
QString changelog() const
Definition: entry.cpp:135
uint numberOfComments() const
Definition: entry.cpp:120
QString shortSummary() const
Definition: entry.cpp:140
QUrl url() const
Definition: entry.cpp:85
bool isEmpty() const const
KNewStuff information about changed entries.
Definition: entry.h:32
QList< QUrl > previewThumbnails() const
Definition: entry.cpp:105
QStringList installedFiles() const
Retrieve the locally installed files.
Definition: entry.cpp:75
quint64 size() const
Definition: entry.cpp:114
Status
Status of the entry.
Definition: entry.h:46
bool isValid() const const
uint rating() const
Definition: entry.cpp:125
QString updateVersion() const
Definition: entry.cpp:130
Definition: button.cpp:18
QStringList uninstalledFiles() const
Retrieve the locally uninstalled files.
Definition: entry.cpp:80
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 22:43:23 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.