KNewStuff

entryinternal.h
1 /*
2  knewstuff3/entry.h.
3  Copyright (c) 2002 Cornelius Schumacher <[email protected]>
4  Copyright (c) 2003 - 2007 Josef Spillner <[email protected]>
5  Copyright (c) 2009 Jeremy Whiting <[email protected]>
6  Copyright (C) 2009 Frederik Gladhorn <[email protected]>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef KNEWSTUFF3_ENTRYINTERNAL_P_H
23 #define KNEWSTUFF3_ENTRYINTERNAL_P_H
24 
25 #include <QDate>
26 #include <QDomElement>
27 #include <QString>
28 #include <QUrl>
29 #include <QImage>
30 
31 #include "author.h"
32 // This include only exists for the KNS3::Entry::Status enum
33 // TODO Move the KNS3::Entry::Status enum to Core for KF6
34 #include "entry.h"
35 
36 #include "knewstuffcore_export.h"
37 
38 class QXmlStreamReader;
39 
40 namespace KNSCore
41 {
42 static const int PreviewWidth = 96;
43 static const int PreviewHeight = 72;
44 
48 KNEWSTUFFCORE_EXPORT QString replaceBBCode(const QString &unformattedText);
49 
60 class KNEWSTUFFCORE_EXPORT EntryInternal
61 {
62 public:
63  typedef QList<EntryInternal> List;
64 
70  enum Source {
71  Cache,
72  Online,
73  Registry
74  };
75 
76  enum PreviewType {
77  PreviewSmall1,
78  PreviewSmall2,
79  PreviewSmall3,
80  PreviewBig1,
81  PreviewBig2,
82  PreviewBig3
83  };
84 
85  struct DownloadLinkInformation {
86  QString name;
87  QString priceAmount;
88  QString distributionType;
89  QString descriptionLink;
90  int id;
91  bool isDownloadtypeLink;
92  quint64 size = 0;
93  QStringList tags;
94  };
95 
99  EntryInternal();
100 
101  EntryInternal(const EntryInternal &other);
102  EntryInternal &operator=(const EntryInternal &other);
103 
104  bool operator==(const EntryInternal &other) const;
105  bool operator<(const EntryInternal &other) const;
106 
110  ~EntryInternal();
111 
112  bool isValid() const;
113 
117  void setName(const QString &name);
118 
124  QString name() const;
125 
132  void setUniqueId(const QString &id);
141  QString uniqueId() const;
142 
146  void setCategory(const QString &category);
147 
156  QString category() const;
157 
163  void setHomepage(const QUrl &page);
169  QUrl homepage() const;
170 
174  void setAuthor(const Author &author);
175 
181  Author author() const;
182 
186  void setLicense(const QString &license);
187 
193  QString license() const;
194 
198  void setSummary(const QString &summary);
199 
205  QString shortSummary() const;
206 
210  void setShortSummary(const QString &summary);
211 
217  QString summary() const;
218 
222  void setChangelog(const QString &changelog);
223  QString changelog() const;
224 
228  void setVersion(const QString &version);
229 
235  QString version() const;
236 
240  void setReleaseDate(const QDate &releasedate);
241 
247  QDate releaseDate() const;
248 
252  void setUpdateVersion(const QString &version);
253 
259  QString updateVersion() const;
260 
264  void setUpdateReleaseDate(const QDate &releasedate);
265 
271  QDate updateReleaseDate() const;
272 
276  void setPayload(const QString &url);
277 
283  QString payload() const;
284 
289  void setPreviewUrl(const QString &url, PreviewType type = PreviewSmall1);
290 
296  QString previewUrl(PreviewType type = PreviewSmall1) const;
297 
301  QImage previewImage(PreviewType type = PreviewSmall1) const;
302  void setPreviewImage(const QImage &image, PreviewType type = PreviewSmall1);
303 
308  void setInstalledFiles(const QStringList &files);
309 
314  QStringList installedFiles() const;
315 
321  void setUnInstalledFiles(const QStringList &files);
322 
328  QStringList uninstalledFiles() const;
329 
335  void setRating(int rating);
336 
343  int rating() const;
344 
350  void setNumberOfComments(int comments);
351 
355  int numberOfComments() const;
356 
362  void setDownloadCount(int downloads);
363 
370  int downloadCount() const;
371 
378  int numberFans() const;
387  void setNumberFans(int fans);
388 
393  int numberKnowledgebaseEntries() const;
398  void setNumberKnowledgebaseEntries(int num);
403  QString knowledgebaseLink() const;
409  void setKnowledgebaseLink(const QString &link);
410 
415  int downloadLinkCount() const;
421  QList<DownloadLinkInformation> downloadLinkInformationList() const;
426  void appendDownloadLinkInformation(const DownloadLinkInformation &info);
430  void clearDownloadLinkInformation();
431 
437  QString donationLink() const;
443  void setDonationLink(const QString &link);
444 
453  QStringList tags() const;
459  void setTags(const QStringList &tags);
460 
464  QString providerId() const;
465  void setProviderId(const QString &id);
466 
470  void setSource(Source source);
471  Source source() const;
472 
484  bool setEntryXML(QXmlStreamReader &reader);
485 
486 #if KNEWSTUFFCORE_ENABLE_DEPRECATED_SINCE(5, 36)
487 
498  KNEWSTUFFCORE_DEPRECATED_VERSION(5, 36, "Use EntryInternal::setEntryXML(QXmlStreamReader &)")
499  bool setEntryXML(const QDomElement &xmldata);
500 #endif
501 
505  QDomElement entryXML() const;
506 
518  void setStatus(KNS3::Entry::Status status);
519 
525  KNS3::Entry::Status status() const;
526 
527  //void setIdNumber(int number);
528  //int idNumber() const;
529 
530  static KNSCore::EntryInternal fromEntry(const KNS3::Entry &entry);
531 private:
532  class Private;
534 };
535 
536 inline uint qHash(const KNSCore::EntryInternal &entry)
537 {
538  return qHash(entry.uniqueId());
539 }
540 
541 }
542 Q_DECLARE_METATYPE(KNSCore::EntryInternal::List)
543 
544 #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:70
KNewStuff author information.
Definition: core/author.h:40
KNewStuff information about changed entries.
Definition: entry.h:43
Status
Status of the entry.
Definition: entry.h:57
KCALENDARCORE_EXPORT uint qHash(const KCalendarCore::Period &key)
KNewStuff data entry container.
Definition: entryinternal.h:60
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Aug 9 2020 22:43:40 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.