File indexing completed on 2024-04-21 14:52:17

0001 /*
0002     This file is part of KDE.
0003 
0004     SPDX-FileCopyrightText: 2009 Frederik Gladhorn <gladhorn@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef DOWNLOADDESCRIPTION_H
0010 #define DOWNLOADDESCRIPTION_H
0011 
0012 #include <QSharedData>
0013 #include <QString>
0014 
0015 #include "attica_export.h"
0016 
0017 namespace Attica
0018 {
0019 
0020 /**
0021  * @class DownloadDescription downloaddescription.h <Attica/DownloadDescription>
0022  *
0023  * Represents a download description.
0024  */
0025 class ATTICA_EXPORT DownloadDescription
0026 {
0027 public:
0028     enum Type {
0029         FileDownload = 0,
0030         LinkDownload,
0031         PackageDownload,
0032     };
0033 
0034     DownloadDescription();
0035     DownloadDescription(const DownloadDescription &other);
0036 
0037     DownloadDescription &operator=(const DownloadDescription &other);
0038     ~DownloadDescription();
0039 
0040     /**
0041       The id of the description - as one Content can have multiple download descriptions associated.
0042       This will simply be 1, 2, ...
0043       */
0044     int id() const;
0045 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0046     ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload")
0047     int id();
0048 #endif
0049 
0050 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0051     ATTICA_DEPRECATED_VERSION(0, 2, "Use DownloadDescription::type()")
0052     Attica::DownloadDescription::Type type();
0053 #endif
0054     Attica::DownloadDescription::Type type() const;
0055 #if ATTICA_ENABLE_DEPRECATED_SINCE(0, 2)
0056     ATTICA_DEPRECATED_VERSION(0, 2, "Use DownloadDescription::type()")
0057     bool isDownloadtypLink();
0058 #endif
0059 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0060     ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload")
0061     bool hasPrice();
0062 #endif
0063     bool hasPrice() const;
0064 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0065     ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload")
0066     QString category();
0067 #endif
0068     QString category() const;
0069 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0070     ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload")
0071     QString name();
0072 #endif
0073     QString name() const;
0074 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0075     ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload")
0076     QString link();
0077 #endif
0078     QString link() const;
0079 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0080     ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload")
0081     QString distributionType();
0082 #endif
0083     QString distributionType() const;
0084 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0085     ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload")
0086     QString priceReason();
0087 #endif
0088     QString priceReason() const;
0089 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0090     ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload")
0091     QString priceAmount();
0092 #endif
0093     QString priceAmount() const;
0094 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0095     ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload")
0096     uint size();
0097 #endif
0098     uint size() const;
0099 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0100     ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload")
0101     QString gpgFingerprint();
0102 #endif
0103     QString gpgFingerprint() const;
0104 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0105     ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload")
0106     QString gpgSignature();
0107 #endif
0108     QString gpgSignature() const;
0109 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0110     ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload")
0111     QString packageName();
0112 #endif
0113     QString packageName() const;
0114 #if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4)
0115     ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload")
0116     QString repository();
0117 #endif
0118     QString repository() const;
0119     /**
0120      * Get the list of tags for this download description
0121      * @since 5.50
0122      */
0123     QStringList tags() const;
0124 
0125     void setId(int id);
0126     void setType(Attica::DownloadDescription::Type type);
0127 #if ATTICA_ENABLE_DEPRECATED_SINCE(0, 2)
0128     ATTICA_DEPRECATED_VERSION(0, 2, "Use DownloadDescription::setType(Attica::DownloadDescription::Type)")
0129     void setDownloadtypLink(bool isLink);
0130 #endif
0131     void setHasPrice(bool hasPrice);
0132     void setCategory(const QString &category);
0133     void setName(const QString &name);
0134     void setLink(const QString &link);
0135     void setDistributionType(const QString &distributionType);
0136     void setPriceReason(const QString &priceReason);
0137     void setPriceAmount(const QString &priceAmount);
0138     void setSize(uint size);
0139     void setGpgFingerprint(const QString &fingerprint);
0140     void setGpgSignature(const QString &signature);
0141     void setPackageName(const QString &packageName);
0142     void setRepository(const QString &repository);
0143     /**
0144      * Set the list of tags for this download description
0145      * @since 5.50
0146      */
0147     void setTags(const QStringList &tags);
0148 
0149 private:
0150     class Private;
0151     QSharedDataPointer<Private> d;
0152 };
0153 
0154 }
0155 
0156 #endif // DOWNLOADDESCRIPTION_H