From ffcb97c69a876d99ad076ef4e42492d1d86ceba7 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Mon, 28 Jun 2021 08:18:19 +0200 Subject: [PATCH] Remove custom macro for creating plugin Instead use K_PLUGIN_CLASS_WITH_JSON and embedded JSON metadata Task: https://phabricator.kde.org/T14542 --- dataengines/geolocation/CMakeLists.txt | 8 ++------ dataengines/geolocation/geolocationprovider.h | 4 ---- dataengines/geolocation/location_gps.cpp | 2 +- dataengines/geolocation/location_ip.cpp | 2 +- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/dataengines/geolocation/CMakeLists.txt b/dataengines/geolocation/CMakeLists.txt index e80779802..f348fac14 100644 --- a/dataengines/geolocation/CMakeLists.txt +++ b/dataengines/geolocation/CMakeLists.txt @@ -1,9 +1,3 @@ -if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") - # CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros. - # 3.10+ lets us provide more macro names that require automoc. - list(APPEND CMAKE_AUTOMOC_MACRO_NAMES K_EXPORT_PLASMA_GEOLOCATIONPROVIDER) -endif() - set(plasma_geolocation_interface_SRCS geolocationprovider.cpp) add_library(plasma-geolocation-interface SHARED ${plasma_geolocation_interface_SRCS}) target_link_libraries(plasma-geolocation-interface @@ -50,6 +44,7 @@ install(FILES plasma-geolocationprovider.desktop DESTINATION ${KDE_INSTALL_KSERV set(plasma_geolocation_ip_SRCS location_ip.cpp) ecm_qt_declare_logging_category(plasma_geolocation_ip_SRCS HEADER geolocdebug.h IDENTIFIER DATAENGINE_GEOLOCATION CATEGORY_NAME org.kde.plasma.dataengine.geolocation) add_library(plasma-geolocation-ip MODULE ${plasma_geolocation_ip_SRCS}) +kcoreaddons_desktop_to_json(plasma-geolocation-ip plasma-geolocation-ip.desktop) target_compile_definitions(plasma-geolocation-ip PRIVATE -DQT_NO_KEYWORDS) target_link_libraries(plasma-geolocation-ip plasma-geolocation-interface KF5::KIOCore KF5::NetworkManagerQt) install(FILES plasma-geolocation-ip.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) @@ -68,6 +63,7 @@ if(LIBGPS_FOUND) set(plasma_geolocation_gps_SRCS location_gps.cpp) ecm_qt_declare_logging_category(plasma_geolocation_gps_SRCS HEADER geolocdebug.h IDENTIFIER DATAENGINE_GEOLOCATION CATEGORY_NAME org.kde.plasma.dataengine.geolocation) add_library(plasma-geolocation-gps MODULE ${plasma_geolocation_gps_SRCS}) + kcoreaddons_desktop_to_json(plasma-geolocation-gps plasma-geolocation-gps.desktop) target_link_libraries(plasma-geolocation-gps plasma-geolocation-interface ${LIBGPS_LIBRARIES}) install(FILES plasma-geolocation-gps.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) install(TARGETS plasma-geolocation-gps DESTINATION ${KDE_INSTALL_PLUGINDIR}) diff --git a/dataengines/geolocation/geolocationprovider.h b/dataengines/geolocation/geolocationprovider.h index fc7d89b7c..88e18919d 100644 --- a/dataengines/geolocation/geolocationprovider.h +++ b/dataengines/geolocation/geolocationprovider.h @@ -77,8 +77,4 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(GeolocationProvider::UpdateTriggers) -#define K_EXPORT_PLASMA_GEOLOCATIONPROVIDER(libname, classname) \ - K_PLUGIN_FACTORY(factory, registerPlugin();) \ - K_EXPORT_PLUGIN_VERSION(1.0) - #endif diff --git a/dataengines/geolocation/location_gps.cpp b/dataengines/geolocation/location_gps.cpp index f002f4589..28fb0750a 100644 --- a/dataengines/geolocation/location_gps.cpp +++ b/dataengines/geolocation/location_gps.cpp @@ -120,6 +120,6 @@ void Gps::update() } } -K_EXPORT_PLASMA_GEOLOCATIONPROVIDER(gps, Gps) +K_PLUGIN_CLASS_WITH_JSON(Gps, "plasma-geolocation-gps.json") #include "location_gps.moc" diff --git a/dataengines/geolocation/location_ip.cpp b/dataengines/geolocation/location_ip.cpp index 2a9d77957..66c3b0446 100644 --- a/dataengines/geolocation/location_ip.cpp +++ b/dataengines/geolocation/location_ip.cpp @@ -199,6 +199,6 @@ void Ip::update() connect(datajob, &KIO::TransferJob::result, d, &Ip::Private::readCountry); } -K_EXPORT_PLASMA_GEOLOCATIONPROVIDER(ip, Ip) +K_PLUGIN_CLASS_WITH_JSON(Ip, "plasma-geolocation-ip.json") #include "location_ip.moc"