KNewStuff

entryinternal.h
1 /*
2  knewstuff3/entry.h.
3  SPDX-FileCopyrightText: 2002 Cornelius Schumacher <[email protected]>
4  SPDX-FileCopyrightText: 2003-2007 Josef Spillner <[email protected]>
5  SPDX-FileCopyrightText: 2009 Jeremy Whiting <[email protected]>
6  SPDX-FileCopyrightText: 2009 Frederik Gladhorn <[email protected]>
7 
8  SPDX-License-Identifier: LGPL-2.1-or-later
9 */
10 
11 #ifndef KNEWSTUFF3_ENTRYINTERNAL_P_H
12 #define KNEWSTUFF3_ENTRYINTERNAL_P_H
13 
14 #include <QDate>
15 #include <QDomElement>
16 #include <QString>
17 #include <QUrl>
18 #include <QImage>
19 
20 #include "author.h"
21 // This include only exists for the KNS3::Entry::Status enum
22 // TODO Move the KNS3::Entry::Status enum to Core for KF6
23 #include "entry.h"
24 
25 #include "knewstuffcore_export.h"
26 
27 class QXmlStreamReader;
28 
29 namespace KNSCore
30 {
31 static const int PreviewWidth = 96;
32 static const int PreviewHeight = 72;
33 
37 KNEWSTUFFCORE_EXPORT QString replaceBBCode(const QString &unformattedText);
38 
49 class KNEWSTUFFCORE_EXPORT EntryInternal
50 {
51 public:
52  typedef QList<EntryInternal> List;
53 
59  enum Source {
60  Cache,
61  Online,
62  Registry,
63  };
64 
65  enum PreviewType {
66  PreviewSmall1,
67  PreviewSmall2,
68  PreviewSmall3,
69  PreviewBig1,
70  PreviewBig2,
71  PreviewBig3,
72  };
73 
74  struct DownloadLinkInformation {
75  QString name;
76  QString priceAmount;
77  QString distributionType;
78  QString descriptionLink;
79  int id;
80  bool isDownloadtypeLink;
81  quint64 size = 0;
82  QStringList tags;
83  };
84 
85  enum EntryEvent {
86  UnknownEvent = 0,
87  StatusChangedEvent = 1,
88  AdoptedEvent = 2,
89  DetailsLoadedEvent = 3,
90  };
91 
95  EntryInternal();
96 
97  EntryInternal(const EntryInternal &other);
98  EntryInternal &operator=(const EntryInternal &other);
99 
100  bool operator==(const EntryInternal &other) const;
101  bool operator<(const EntryInternal &other) const;
102 
106  ~EntryInternal();
107 
108  bool isValid() const;
109 
113  void setName(const QString &name);
114 
120  QString name() const;
121 
128  void setUniqueId(const QString &id);
137  QString uniqueId() const;
138 
142  void setCategory(const QString &category);
143 
152  QString category() const;
153 
159  void setHomepage(const QUrl &page);
165  QUrl homepage() const;
166 
170  void setAuthor(const Author &author);
171 
177  Author author() const;
178 
182  void setLicense(const QString &license);
183 
189  QString license() const;
190 
194  void setSummary(const QString &summary);
195 
201  QString shortSummary() const;
202 
206  void setShortSummary(const QString &summary);
207 
213  QString summary() const;
214 
218  void setChangelog(const QString &changelog);
219  QString changelog() const;
220 
224  void setVersion(const QString &version);
225 
231  QString version() const;
232 
236  void setReleaseDate(const QDate &releasedate);
237 
243  QDate releaseDate() const;
244 
248  void setUpdateVersion(const QString &version);
249 
255  QString updateVersion() const;
256 
260  void setUpdateReleaseDate(const QDate &releasedate);
261 
267  QDate updateReleaseDate() const;
268 
272  void setPayload(const QString &url);
273 
279  QString payload() const;
280 
285  void setPreviewUrl(const QString &url, PreviewType type = PreviewSmall1);
286 
292  QString previewUrl(PreviewType type = PreviewSmall1) const;
293 
297  QImage previewImage(PreviewType type = PreviewSmall1) const;
298  void setPreviewImage(const QImage &image, PreviewType type = PreviewSmall1);
299 
304  void setInstalledFiles(const QStringList &files);
305 
310  QStringList installedFiles() const;
311 
317  void setUnInstalledFiles(const QStringList &files);
318 
324  QStringList uninstalledFiles() const;
325 
331  void setRating(int rating);
332 
339  int rating() const;
340 
346  void setNumberOfComments(int comments);
347 
351  int numberOfComments() const;
352 
358  void setDownloadCount(int downloads);
359 
366  int downloadCount() const;
367 
374  int numberFans() const;
383  void setNumberFans(int fans);
384 
389  int numberKnowledgebaseEntries() const;
394  void setNumberKnowledgebaseEntries(int num);
399  QString knowledgebaseLink() const;
405  void setKnowledgebaseLink(const QString &link);
406 
411  int downloadLinkCount() const;
417  QList<DownloadLinkInformation> downloadLinkInformationList() const;
422  void appendDownloadLinkInformation(const DownloadLinkInformation &info);
426  void clearDownloadLinkInformation();
427 
433  QString donationLink() const;
439  void setDonationLink(const QString &link);
440 
449  QStringList tags() const;
455  void setTags(const QStringList &tags);
456 
460  QString providerId() const;
461  void setProviderId(const QString &id);
462 
466  void setSource(Source source);
467  Source source() const;
468 
480  bool setEntryXML(QXmlStreamReader &reader);
481 
482 //#if KNEWSTUFFCORE_ENABLE_DEPRECATED_SINCE(5, 36) // TODO This is still internally used and has not been fully ported
494  KNEWSTUFFCORE_DEPRECATED_VERSION(5, 36, "Use EntryInternal::setEntryXML(QXmlStreamReader &)")
495  bool setEntryXML(const QDomElement &xmldata);
496 //#endif
497 
501  QDomElement entryXML() const;
502 
514  void setStatus(KNS3::Entry::Status status);
515 
521  KNS3::Entry::Status status() const;
522 
523  static KNSCore::EntryInternal fromEntry(const KNS3::Entry &entry);
524 private:
525  class Private;
527 };
528 
529 inline uint qHash(const KNSCore::EntryInternal &entry)
530 {
531  return qHash(entry.uniqueId());
532 }
533 
534 }
535 Q_DECLARE_METATYPE(KNSCore::EntryInternal::List)
536 
537 #endif
QString uniqueId() const
Get the object&#39;s unique ID.
KNEWSTUFFCORE_EXPORT QString replaceBBCode(const QString &unformattedText)
function to remove bb code formatting that opendesktop sends
Contains the core functionality for handling interaction with NewStuff providers. ...
Source
Source of the entry, A entry&#39;s data is coming from either cache, or an online provider this helps the...
Definition: entryinternal.h:59
KNewStuff author information.
Definition: core/author.h:30
KNewStuff information about changed entries.
Definition: entry.h:32
Status
Status of the entry.
Definition: entry.h:46
KCALENDARCORE_EXPORT uint qHash(const KCalendarCore::Period &key)
KNewStuff data entry container.
Definition: entryinternal.h:49
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.