diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,13 +16,15 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) -include(GenerateExportHeader) +include(ECMGenerateExportHeader) include(ECMSetupVersion) include(ECMGenerateHeaders) include(ECMMarkNonGuiExecutable) 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 @@ -17,8 +17,15 @@ ecm_qt_declare_logging_category(kiconthemes_SRCS HEADER debug.h IDENTIFIER KICONTHEMES CATEGORY_NAME kf5.kiconthemes) add_library(KF5IconThemes ${kiconthemes_SRCS}) -generate_export_header(KF5IconThemes BASE_NAME KIconThemes) add_library(KF5::IconThemes ALIAS KF5IconThemes) +ecm_generate_export_header(KF5IconThemes + BASE_NAME KIconThemes + # GROUP_BASE_NAME KF <- enable once all of KF modules use ecm_generate_export_header + VERSION ${KF5_VERSION} + DEPRECATED_BASE_VERSION 0 + DEPRECATION_VERSIONS 4.8 5.0 5.63 + EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} +) target_include_directories(KF5IconThemes INTERFACE "$") diff --git a/src/kiconloader.h b/src/kiconloader.h --- a/src/kiconloader.h +++ b/src/kiconloader.h @@ -88,7 +88,11 @@ Action, ///< An action icon (e.g. 'save', 'print'). Application, ///< An icon that represents an application. Device, ///< An icon that represents a device. - FileSystem, ///< An icon that represents a file system. @deprecated Use Place instead. +#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(4, 8) + FileSystem, ///< An icon that represents a file system. @deprecated Since 4.8. Use Place instead. +#elif KICONTHEMES_BUILD_DEPRECATED_SINCE(4, 8) + FileSystem_DEPRECATED_DO_NOT_USE, +#endif MimeType, ///< An icon that represents a mime type (or file type). Animation, ///< An icon that is animated. Category, ///< An icon that represents a category. @@ -313,6 +317,7 @@ */ KPixmapSequence loadPixmapSequence(const QString &iconName, int size = SizeSmall) const; +#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 0) /** * Creates an icon set, that will do on-demand loading of the icon. * Loading itself is done by calling loadIcon . @@ -328,10 +333,10 @@ * @return the icon set. Can be null when not found, depending on * @p canReturnNull. * - * @deprecated use QIcon::fromTheme instead, which uses the iconloader internally + * @deprecated Since 5.0, use QIcon::fromTheme instead, which uses the iconloader internally */ -#ifndef KICONTHEMES_NO_DEPRECATED - KICONTHEMES_DEPRECATED QIcon loadIconSet(const QString &name, KIconLoader::Group group, int size = 0, + KICONTHEMES_DEPRECATED_VERSION(5, 0, "Use QIcon::fromTheme(const QString&)") + QIcon loadIconSet(const QString &name, KIconLoader::Group group, int size = 0, bool canReturnNull = false); #endif @@ -546,14 +551,17 @@ void resetPalette(); public Q_SLOTS: + // TODO: while marked as deprecated, newIconLoader() is still used: + // internally by KIconLoadeer as well as by Plasma's Icons kcm module (state: 5.17) + // this needs some further cleanup work before removing it from the API with KICONTHEMES_ENABLE_DEPRECATED_SINCE /** * Re-initialize the global icon loader * - * @deprecated since 5.0, use emitChange(Group) + * @todo Check deprecation, still used internally. + * @deprecated Since 5.0, use emitChange(Group) */ -#ifndef KICONTHEMES_NO_DEPRECATED - KICONTHEMES_DEPRECATED void newIconLoader(); -#endif + KICONTHEMES_DEPRECATED_VERSION(5, 0, "Use KIconLoader::emitChange(Group)") + void newIconLoader(); /** * Emits an iconChanged() signal on all the KIconLoader instances in the system @@ -586,89 +594,112 @@ Q_PRIVATE_SLOT(d, void _k_refreshIcons(int group)) }; -#ifndef KICONTHEMES_NO_DEPRECATED +#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 63) /** * \relates KIconLoader * Load a desktop icon. * @deprecated since 5.63. Prefer QIcon::fromTheme instead where possible, * if you need a pixmap use QIcon::pixmap with KIconLoader::StdSizes, * if you need the overlay, use KIconLoader::loadIcon. */ -KICONTHEMES_DEPRECATED_EXPORT QPixmap DesktopIcon(const QString &name, int size = 0, +KICONTHEMES_DEPRECATED_VERSION(5, 63, "See API dox for replacement") +KICONTHEMES_EXPORT QPixmap DesktopIcon(const QString &name, int size = 0, int state = KIconLoader::DefaultState, const QStringList &overlays = QStringList()); +#endif +#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 0) /** * \relates KIconLoader * Load a desktop icon, and apply the necessary effects to get an IconSet. - * @deprecated use QIcon::fromTheme instead + * @deprecated Since 5.0, use QIcon::fromTheme instead */ -KICONTHEMES_DEPRECATED_EXPORT QIcon DesktopIconSet(const QString &name, int size = 0); +KICONTHEMES_DEPRECATED_VERSION(5, 0, "Use QIcon::fromTheme(const QString&)") +KICONTHEMES_EXPORT QIcon DesktopIconSet(const QString &name, int size = 0); +#endif +#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 63) /** * \relates KIconLoader * Load a toolbar icon. * @deprecated since 5.63. Prefer QIcon::fromTheme instead where possible, * if you need a pixmap use QIcon::pixmap with KIconLoader::StdSizes, * if you need the overlay, use KIconLoader::loadIcon. */ -KICONTHEMES_DEPRECATED_EXPORT QPixmap BarIcon(const QString &name, int size = 0, int state = KIconLoader::DefaultState, +KICONTHEMES_DEPRECATED_VERSION(5, 63, "See API dox for replacement") +KICONTHEMES_EXPORT QPixmap BarIcon(const QString &name, int size = 0, int state = KIconLoader::DefaultState, const QStringList &overlays = QStringList()); +#endif +#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 0) /** * \relates KIconLoader * Load a toolbar icon, and apply the necessary effects to get an IconSet. - * @deprecated use QIcon::fromTheme instead + * @deprecated Since 5.0, use QIcon::fromTheme instead */ -KICONTHEMES_DEPRECATED_EXPORT QIcon BarIconSet(const QString &name, int size = 0); +KICONTHEMES_DEPRECATED_VERSION(5, 0, "Use QIcon::fromTheme(const QString&)") +KICONTHEMES_EXPORT QIcon BarIconSet(const QString &name, int size = 0); +#endif +#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 63) /** * \relates KIconLoader * Load a small icon. * @deprecated since 5.63. Prefer QIcon::fromTheme instead where possible, * if you need a pixmap use QIcon::pixmap with KIconLoader::StdSizes, * if you need the overlay, use KIconLoader::loadIcon. */ -KICONTHEMES_DEPRECATED_EXPORT QPixmap SmallIcon(const QString &name, int size = 0, +KICONTHEMES_DEPRECATED_VERSION(5, 63, "See API dox for replacement") +KICONTHEMES_EXPORT QPixmap SmallIcon(const QString &name, int size = 0, int state = KIconLoader::DefaultState, const QStringList &overlays = QStringList()); +#endif +#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 0) /** * \relates KIconLoader * Load a small icon, and apply the necessary effects to get an IconSet. - * @deprecated use QIcon::fromTheme instead + * @deprecated Since 5.0, use QIcon::fromTheme instead */ -KICONTHEMES_DEPRECATED_EXPORT QIcon SmallIconSet(const QString &name, int size = 0); +KICONTHEMES_DEPRECATED_VERSION(5, 0, "Use QIcon::fromTheme(const QString&)") +KICONTHEMES_EXPORT QIcon SmallIconSet(const QString &name, int size = 0); +#endif +#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 63) /** * \relates KIconLoader * Load a main toolbar icon. * @deprecated since 5.63. Prefer QIcon::fromTheme instead where possible, * if you need a pixmap use QIcon::pixmap with KIconLoader::StdSizes, * if you need the overlay, use KIconLoader::loadIcon. */ -KICONTHEMES_DEPRECATED_EXPORT QPixmap MainBarIcon(const QString &name, int size = 0, +KICONTHEMES_DEPRECATED_VERSION(5, 63, "See API dox for replacement") +KICONTHEMES_EXPORT QPixmap MainBarIcon(const QString &name, int size = 0, int state = KIconLoader::DefaultState, const QStringList &overlays = QStringList()); +#endif +#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 0) /** * \relates KIconLoader * Load a main toolbar icon, and apply the effects to get an IconSet. - * @deprecated use QIcon::fromTheme instead + * @deprecated Since 5.0, use QIcon::fromTheme instead */ -KICONTHEMES_DEPRECATED_EXPORT QIcon MainBarIconSet(const QString &name, int size = 0); +KICONTHEMES_DEPRECATED_VERSION(5, 0, "Use QIcon::fromTheme(const QString&)") +KICONTHEMES_EXPORT QIcon MainBarIconSet(const QString &name, int size = 0); #endif /** * \relates KIconLoader * Load a user icon. User icons are searched in $appdir/pics. */ KICONTHEMES_EXPORT QPixmap UserIcon(const QString &name, int state = KIconLoader::DefaultState, const QStringList &overlays = QStringList()); +#if KICONTHEMES_ENABLE_DEPRECATED_SINCE(5, 0) /** * \relates KIconLoader * Load a user icon, and apply the effects to get an IconSet. - * @deprecated use QIcon::fromTheme instead + * @deprecated Since 5.0, use QIcon::fromTheme instead */ -#ifndef KICONTHEMES_NO_DEPRECATED -KICONTHEMES_DEPRECATED_EXPORT QIcon UserIconSet(const QString &name); +KICONTHEMES_DEPRECATED_VERSION(5, 0, "Use QIcon::fromTheme(const QString&)") +KICONTHEMES_EXPORT QIcon UserIconSet(const QString &name); #endif /** diff --git a/src/kiconloader.cpp b/src/kiconloader.cpp --- a/src/kiconloader.cpp +++ b/src/kiconloader.cpp @@ -1680,8 +1680,7 @@ return true; } -// deprecated -#ifndef KICONTHEMES_NO_DEPRECATED +#if KICONTHEMES_BUILD_DEPRECATED_SINCE(5, 0) QIcon KIconLoader::loadIconSet(const QString &name, KIconLoader::Group g, int s, bool canReturnNull) { @@ -1699,53 +1698,63 @@ // Easy access functions -#ifndef KICONTHEMES_NO_DEPRECATED +#if KICONTHEMES_BUILD_DEPRECATED_SINCE(5, 63) QPixmap DesktopIcon(const QString &name, int force_size, int state, const QStringList &overlays) { KIconLoader *loader = KIconLoader::global(); return loader->loadIcon(name, KIconLoader::Desktop, force_size, state, overlays); } +#endif -// deprecated +#if KICONTHEMES_BUILD_DEPRECATED_SINCE(5, 0) QIcon DesktopIconSet(const QString &name, int force_size) { KIconLoader *loader = KIconLoader::global(); return loader->loadIconSet(name, KIconLoader::Desktop, force_size); } +#endif +#if KICONTHEMES_BUILD_DEPRECATED_SINCE(5, 63) QPixmap BarIcon(const QString &name, int force_size, int state, const QStringList &overlays) { KIconLoader *loader = KIconLoader::global(); return loader->loadIcon(name, KIconLoader::Toolbar, force_size, state, overlays); } +#endif -// deprecated +#if KICONTHEMES_BUILD_DEPRECATED_SINCE(5, 0) QIcon BarIconSet(const QString &name, int force_size) { KIconLoader *loader = KIconLoader::global(); return loader->loadIconSet(name, KIconLoader::Toolbar, force_size); } +#endif +#if KICONTHEMES_BUILD_DEPRECATED_SINCE(5, 63) QPixmap SmallIcon(const QString &name, int force_size, int state, const QStringList &overlays) { KIconLoader *loader = KIconLoader::global(); return loader->loadIcon(name, KIconLoader::Small, force_size, state, overlays); } +#endif -// deprecated +#if KICONTHEMES_BUILD_DEPRECATED_SINCE(5, 0) QIcon SmallIconSet(const QString &name, int force_size) { KIconLoader *loader = KIconLoader::global(); return loader->loadIconSet(name, KIconLoader::Small, force_size); } +#endif +#if KICONTHEMES_BUILD_DEPRECATED_SINCE(5, 63) QPixmap MainBarIcon(const QString &name, int force_size, int state, const QStringList &overlays) { KIconLoader *loader = KIconLoader::global(); return loader->loadIcon(name, KIconLoader::MainToolbar, force_size, state, overlays); } +#endif -// deprecated +#if KICONTHEMES_BUILD_DEPRECATED_SINCE(5, 0) QIcon MainBarIconSet(const QString &name, int force_size) { KIconLoader *loader = KIconLoader::global(); @@ -1759,8 +1768,7 @@ return loader->loadIcon(name, KIconLoader::User, 0, state, overlays); } -// deprecated -#ifndef KICONTHEMES_NO_DEPRECATED +#if KICONTHEMES_BUILD_DEPRECATED_SINCE(5, 0) QIcon UserIconSet(const QString &name) { KIconLoader *loader = KIconLoader::global(); @@ -1835,7 +1843,6 @@ return globalIconLoader(); } -#ifndef KICONTHEMES_NO_DEPRECATED void KIconLoader::newIconLoader() { if (global() == this) { @@ -1845,7 +1852,6 @@ reconfigure(objectName()); emit iconLoaderSettingsChanged(); } -#endif void KIconLoader::emitChange(KIconLoader::Group g) { diff --git a/src/kicontheme.cpp b/src/kicontheme.cpp --- a/src/kicontheme.cpp +++ b/src/kicontheme.cpp @@ -733,8 +733,10 @@ mContext = KIconLoader::Device; } else if (tmp == QLatin1String("MimeTypes")) { mContext = KIconLoader::MimeType; +#if KICONTHEMES_BUILD_DEPRECATED_SINCE(4, 8) } else if (tmp == QLatin1String("FileSystems")) { mContext = KIconLoader::FileSystem; +#endif } else if (tmp == QLatin1String("Applications")) { mContext = KIconLoader::Application; } else if (tmp == QLatin1String("Actions")) {