Commit 68c8fecf authored by Andrius Štikonas's avatar Andrius Štikonas
Browse files

Simplify code using K_PLUGIN_CLASS_WITH_JSON macro.

Also move kpmcore plugins into separate namespace.
parent a5bdd5a4
Pipeline #113953 passed with stage
in 1 minute and 2 seconds
......@@ -14,7 +14,7 @@ set (RELEASE_SERVICE_VERSION_MICRO "70")
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
project(kpmcore VERSION ${RELEASE_SERVICE_VERSION})
set(SOVERSION "11")
set(SOVERSION "12")
add_definitions(-D'VERSION="${RELEASE_SERVICE_VERSION}"') #"
......@@ -23,7 +23,7 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
# Dependencies
set(QT_MIN_VERSION "5.14.0")
set(KF5_MIN_VERSION "5.73")
set(KF5_MIN_VERSION "5.88")
set(BLKID_MIN_VERSION "2.33.2")
# PolkitQt5-1
......
/*
SPDX-FileCopyrightText: 2010 Volker Lanz <vl@fidra.de>
SPDX-FileCopyrightText: 2014-2018 Andrius Štikonas <andrius@stikonas.eu>
SPDX-FileCopyrightText: 2014-2021 Andrius Štikonas <andrius@stikonas.eu>
SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org>
SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho <caiojcarvalho@gmail.com>
......@@ -56,8 +56,7 @@ QVector<KPluginMetaData> CoreBackendManager::list() const
metaData.category().contains(QStringLiteral("BackendPlugin"));
};
// find backend plugins in standard path (e.g. /usr/lib64/qt5/plugins) using filter from above
return KPluginLoader::findPlugins(QString(), filter);
return KPluginMetaData::findPlugins(QStringLiteral("kpmcore"), filter);
}
bool CoreBackendManager::load(const QString& name)
......@@ -65,7 +64,8 @@ bool CoreBackendManager::load(const QString& name)
if (backend())
unload();
KPluginLoader loader(name);
QString path = QStringLiteral("kpmcore/") + name;
KPluginLoader loader(path);
KPluginFactory* factory = loader.factory();
......
......@@ -3,6 +3,11 @@
# SPDX-License-Identifier: GPL-3.0-or-later
function(kpmcore_add_plugin name)
kcoreaddons_add_plugin(${name} INSTALL_NAMESPACE "kpmcore")
endfunction()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
option(PARTMAN_SFDISKBACKEND "Build the sfdisk backend plugin." ON)
......
# SPDX-FileCopyrightText: 2010 Volker Lanz <vl@fidra.de>
# SPDX-FileCopyrightText: 2016-2018 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2016-2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-License-Identifier: GPL-3.0-or-later
set (pmdummybackendplugin_SRCS
kpmcore_add_plugin(pmdummybackendplugin)
target_sources(pmdummybackendplugin PRIVATE
dummybackend.cpp
dummydevice.cpp
dummypartitiontable.cpp
${CMAKE_SOURCE_DIR}/src/backend/corebackenddevice.cpp
)
add_library(pmdummybackendplugin SHARED ${pmdummybackendplugin_SRCS})
target_link_libraries(pmdummybackendplugin kpmcore KF5::I18n KF5::CoreAddons)
install(TARGETS pmdummybackendplugin DESTINATION ${KDE_INSTALL_PLUGINDIR})
......@@ -25,7 +25,7 @@
#include <KLocalizedString>
#include <KPluginFactory>
K_PLUGIN_FACTORY_WITH_JSON(DummyBackendFactory, "pmdummybackendplugin.json", registerPlugin<DummyBackend>();)
K_PLUGIN_CLASS_WITH_JSON(DummyBackend, "pmdummybackendplugin.json")
DummyBackend::DummyBackend(QObject*, const QList<QVariant>&) :
......
# SPDX-FileCopyrightText: 2020 Gaël PORTAY <gael.portay@collabora.com>
# SPDX-FileCopyrightText: 2018 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-License-Identifier: GPL-3.0-or-later
set (pmsfdiskbackendplugin_SRCS
kpmcore_add_plugin(pmsfdiskbackendplugin)
target_sources(pmsfdiskbackendplugin PRIVATE
sfdiskbackend.cpp
sfdiskdevice.cpp
sfdiskgptattributes.cpp
......@@ -14,8 +16,4 @@ set (pmsfdiskbackendplugin_SRCS
${CMAKE_SOURCE_DIR}/src/core/copytargetbytearray.cpp
)
add_library(pmsfdiskbackendplugin SHARED ${pmsfdiskbackendplugin_SRCS})
target_link_libraries(pmsfdiskbackendplugin kpmcore KF5::I18n KF5::CoreAddons)
install(TARGETS pmsfdiskbackendplugin DESTINATION ${KDE_INSTALL_PLUGINDIR})
......@@ -47,7 +47,7 @@
#include <KLocalizedString>
#include <KPluginFactory>
K_PLUGIN_FACTORY_WITH_JSON(SfdiskBackendFactory, "pmsfdiskbackendplugin.json", registerPlugin<SfdiskBackend>();)
K_PLUGIN_CLASS_WITH_JSON(SfdiskBackend, "pmsfdiskbackendplugin.json")
SfdiskBackend::SfdiskBackend(QObject*, const QList<QVariant>&) :
CoreBackend()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment