diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,13 +15,15 @@ include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) -include(GenerateExportHeader) +include(ECMGenerateExportHeader) include(ECMSetupVersion) include(ECMGenerateHeaders) include(CMakePackageConfigHelpers) # Used to create CMake config files include(ECMQtDeclareLoggingCategory) include(ECMAddQch) +set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].") + option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -88,7 +88,14 @@ ) add_library(KF5::Attica ALIAS KF5Attica) -generate_export_header(KF5Attica BASE_NAME Attica) +ecm_generate_export_header(KF5Attica + BASE_NAME Attica + # GROUP_BASE_NAME KF <- enable once all of KF modules use ecm_generate_export_header + VERSION ${KF5_VERSION} + DEPRECATED_BASE_VERSION 0 + DEPRECATION_VERSIONS 0.2 5.4 5.23 + EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} +) target_link_libraries(KF5Attica PUBLIC diff --git a/src/downloaddescription.h b/src/downloaddescription.h --- a/src/downloaddescription.h +++ b/src/downloaddescription.h @@ -52,36 +52,80 @@ The id of the description - as one Content can have multiple download descriptions associated. This will simply be 1, 2, ... */ - Q_DECL_DEPRECATED int id(); int id() const; - - // TODO KF6 remove deprecated methods. - Q_DECL_DEPRECATED Attica::DownloadDescription::Type type(); +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload") + int id(); +#endif + +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(0, 2, "Use DownloadDescription::type()") + Attica::DownloadDescription::Type type(); +#endif Attica::DownloadDescription::Type type() const; - Q_DECL_DEPRECATED bool isDownloadtypLink(); - Q_DECL_DEPRECATED bool hasPrice(); +#if ATTICA_ENABLE_DEPRECATED_SINCE(0, 2) + ATTICA_DEPRECATED_VERSION(0, 2, "Use DownloadDescription::type()") + bool isDownloadtypLink(); +#endif +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload") + bool hasPrice(); +#endif bool hasPrice() const; - Q_DECL_DEPRECATED QString category(); +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload") + QString category(); +#endif QString category() const; - Q_DECL_DEPRECATED QString name(); +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload") + QString name(); +#endif QString name() const; - Q_DECL_DEPRECATED QString link(); +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload") + QString link(); +#endif QString link() const; - Q_DECL_DEPRECATED QString distributionType(); +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload") + QString distributionType(); +#endif QString distributionType() const; - Q_DECL_DEPRECATED QString priceReason(); +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload") + QString priceReason(); +#endif QString priceReason() const; - Q_DECL_DEPRECATED QString priceAmount(); +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload") + QString priceAmount(); +#endif QString priceAmount() const; - Q_DECL_DEPRECATED uint size(); +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload") + uint size(); +#endif uint size() const; - Q_DECL_DEPRECATED QString gpgFingerprint(); +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload") + QString gpgFingerprint(); +#endif QString gpgFingerprint() const; - Q_DECL_DEPRECATED QString gpgSignature(); +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload") + QString gpgSignature(); +#endif QString gpgSignature() const; - Q_DECL_DEPRECATED QString packageName(); +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload") + QString packageName(); +#endif QString packageName() const; - Q_DECL_DEPRECATED QString repository(); +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 4) + ATTICA_DEPRECATED_VERSION(5, 4, "Use const overload") + QString repository(); +#endif QString repository() const; /** * Get the list of tags for this download description @@ -91,7 +135,10 @@ void setId(int id); void setType(Attica::DownloadDescription::Type type); - Q_DECL_DEPRECATED void setDownloadtypLink(bool isLink); +#if ATTICA_ENABLE_DEPRECATED_SINCE(0, 2) + ATTICA_DEPRECATED_VERSION(0, 2, "Use DownloadDescription::setType(Attica::DownloadDescription::Type)") + void setDownloadtypLink(bool isLink); +#endif void setHasPrice(bool hasPrice); void setCategory(const QString &category); void setName(const QString &name); diff --git a/src/downloaddescription.cpp b/src/downloaddescription.cpp --- a/src/downloaddescription.cpp +++ b/src/downloaddescription.cpp @@ -71,15 +71,19 @@ { } +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) QString Attica::DownloadDescription::category() { return d->category; } +#endif +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) int DownloadDescription::id() { return d->id; } +#endif QString Attica::DownloadDescription::category() const { @@ -101,10 +105,12 @@ d->category = category; } +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) QString Attica::DownloadDescription::distributionType() { return d->distributionType; } +#endif QString Attica::DownloadDescription::distributionType() const { @@ -116,10 +122,12 @@ d->distributionType = distributionType; } +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) bool Attica::DownloadDescription::hasPrice() { return d->hasPrice; } +#endif bool Attica::DownloadDescription::hasPrice() const { @@ -131,10 +139,12 @@ d->hasPrice = hasPrice; } +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) Attica::DownloadDescription::Type DownloadDescription::type() { return d->type; } +#endif Attica::DownloadDescription::Type DownloadDescription::type() const { @@ -146,24 +156,30 @@ d->type = type; } +#if ATTICA_BUILD_DEPRECATED_SINCE(0, 2) bool Attica::DownloadDescription::isDownloadtypLink() { return d->type == Attica::DownloadDescription::LinkDownload; } +#endif +#if ATTICA_BUILD_DEPRECATED_SINCE(0, 2) void DownloadDescription::setDownloadtypLink(bool isLink) { if (isLink) { d->type = Attica::DownloadDescription::LinkDownload; } else { d->type = Attica::DownloadDescription::FileDownload; } } +#endif +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) QString Attica::DownloadDescription::link() { return d->link; } +#endif QString Attica::DownloadDescription::link() const { @@ -175,10 +191,12 @@ d->link = link; } +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) QString Attica::DownloadDescription::name() { return d->name; } +#endif QString Attica::DownloadDescription::name() const { @@ -190,10 +208,12 @@ d->name = name; } +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) QString Attica::DownloadDescription::priceAmount() { return d->priceAmount; } +#endif QString Attica::DownloadDescription::priceAmount() const { @@ -205,10 +225,12 @@ d->priceAmount = priceAmount; } +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) QString Attica::DownloadDescription::priceReason() { return d->priceReason; } +#endif QString Attica::DownloadDescription::priceReason() const { @@ -220,10 +242,12 @@ d->priceReason = priceReason; } +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) uint Attica::DownloadDescription::size() { return d->size; } +#endif uint Attica::DownloadDescription::size() const { @@ -235,10 +259,12 @@ d->size = size; } +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) QString Attica::DownloadDescription::gpgFingerprint() { return d->gpgFingerprint; } +#endif QString Attica::DownloadDescription::gpgFingerprint() const { @@ -250,10 +276,12 @@ d->gpgFingerprint = fingerprint; } +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) QString Attica::DownloadDescription::gpgSignature() { return d->gpgSignature; } +#endif QString Attica::DownloadDescription::gpgSignature() const { @@ -265,10 +293,12 @@ d->gpgSignature = signature; } +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) QString Attica::DownloadDescription::packageName() { return d->packageName; } +#endif QString Attica::DownloadDescription::packageName() const { @@ -280,10 +310,12 @@ d->packageName = packageName; } +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 4) QString Attica::DownloadDescription::repository() { return d->repository; } +#endif QString Attica::DownloadDescription::repository() const { diff --git a/src/provider.h b/src/provider.h --- a/src/provider.h +++ b/src/provider.h @@ -588,13 +588,17 @@ ItemJob *downloadLink(const QString &contentId, const QString &itemId = QStringLiteral("1")); +#if ATTICA_ENABLE_DEPRECATED_SINCE(0, 2) /** Vote for a content item * This version is for the old OCS API < 1.6 * @param contentId the content which this voting is for * @param positiveVote whether the voting is positive or negative * @return the post job for this voting + * @deprecated Since 0.2, use voteForContent(const QString &, uint) */ - Q_DECL_DEPRECATED PostJob *voteForContent(const QString &contentId, bool positiveVote); + ATTICA_DEPRECATED_VERSION(0, 2, "Use Provider::voteForContent(const QString &, uint)") + PostJob *voteForContent(const QString &contentId, bool positiveVote); +#endif /** Vote for a content item * @param contentId the content which this voting is for diff --git a/src/provider.cpp b/src/provider.cpp --- a/src/provider.cpp +++ b/src/provider.cpp @@ -1274,6 +1274,7 @@ return new PostJob(d->m_internals, postRequest.request(), postRequest.data()); } +#if ATTICA_BUILD_DEPRECATED_SINCE(0, 2) PostJob *Provider::voteForContent(const QString &contentId, bool positiveVote) { if (!isValid()) { @@ -1285,6 +1286,7 @@ //qCDebug(ATTICA) << "vote: " << positiveVote; return new PostJob(d->m_internals, createRequest(QLatin1String("content/vote/") + contentId), postParameters); } +#endif PostJob *Provider::voteForContent(const QString &contentId, uint rating) { diff --git a/src/providermanager.h b/src/providermanager.h --- a/src/providermanager.h +++ b/src/providermanager.h @@ -147,7 +147,13 @@ */ QList providers() const; - ATTICA_DEPRECATED bool contains(const QString &provider) const; +#if ATTICA_ENABLE_DEPRECATED_SINCE(5, 23) + /** + * @deprecated Since 5.23, use contains(const QUrl&) + */ + ATTICA_DEPRECATED_VERSION(5, 23, "Use ProviderManager::contains(const QUrl&)") + bool contains(const QString &provider) const; +#endif /** * @returns whether there's a provider with base url @p provider diff --git a/src/providermanager.cpp b/src/providermanager.cpp --- a/src/providermanager.cpp +++ b/src/providermanager.cpp @@ -264,10 +264,12 @@ return d->m_providers.values(); } +#if ATTICA_BUILD_DEPRECATED_SINCE(5, 23) bool ProviderManager::contains(const QString &provider) const { return d->m_providers.contains(QUrl(provider)); } +#endif QList ProviderManager::providerFiles() const {