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

KDE's Doxygen guidelines are available online.