Move the plugins into a different top-ĺevel directory

Reviewed by Albert Vaca
This commit is contained in:
Aleix Pol 2014-06-14 16:34:00 +02:00
parent 232c43838c
commit 741abafaf7
81 changed files with 70 additions and 66 deletions

View file

@ -2,6 +2,8 @@ project(kdeconnect)
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(KDE4 REQUIRED) find_package(KDE4 REQUIRED)
find_package(QJSON REQUIRED) find_package(QJSON REQUIRED)
find_package(QCA2 REQUIRED) find_package(QCA2 REQUIRED)
@ -22,6 +24,7 @@ add_subdirectory(icon)
add_subdirectory(interfaces) add_subdirectory(interfaces)
add_subdirectory(kded) add_subdirectory(kded)
add_subdirectory(plugins)
add_subdirectory(plasmoid) add_subdirectory(plasmoid)
add_subdirectory(cli) add_subdirectory(cli)

View file

@ -3,12 +3,10 @@ project(KDEConnectCore)
include_directories( include_directories(
${KDE4_KIO_LIBS} ${KDE4_KIO_LIBS}
${QJSON_INCLUDE_DIR} ${QJSON_INCLUDE_DIR}
${QCA2_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${QCA2_INCLUDE_DIR}
) )
add_subdirectory(plugins)
add_subdirectory(backends/lan) add_subdirectory(backends/lan)
add_subdirectory(backends/loopback) add_subdirectory(backends/loopback)
@ -18,8 +16,8 @@ set(kded_kdeconnect_SRCS
backends/linkprovider.cpp backends/linkprovider.cpp
backends/devicelink.cpp backends/devicelink.cpp
plugins/kdeconnectplugin.cpp kdeconnectplugin.cpp
plugins/pluginloader.cpp pluginloader.cpp
networkpackage.cpp networkpackage.cpp
filetransferjob.cpp filetransferjob.cpp
@ -39,9 +37,10 @@ PRIVATE
${QT_QTNETWORK_LIBRARY} ${QT_QTNETWORK_LIBRARY}
${QCA2_LIBRARIES} ${QCA2_LIBRARIES}
) )
target_include_directories(kdeconnectcore PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
generate_export_header(kdeconnectcore EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectcore_export.h BASE_NAME KDEConnectCore) generate_export_header(kdeconnectcore EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/kdeconnectcore_export.h BASE_NAME KDEConnectCore)
include(../macros.cmake) include(macros)
generate_and_install_dbus_interface( generate_and_install_dbus_interface(
kdeconnectcore kdeconnectcore

View file

@ -36,8 +36,8 @@
#include <KIcon> #include <KIcon>
#include "kdebugnamespace.h" #include "kdebugnamespace.h"
#include "plugins/kdeconnectplugin.h" #include "kdeconnectplugin.h"
#include "plugins/pluginloader.h" #include "pluginloader.h"
#include "backends/devicelink.h" #include "backends/devicelink.h"
#include "backends/linkprovider.h" #include "backends/linkprovider.h"
#include "networkpackage.h" #include "networkpackage.h"
@ -483,4 +483,4 @@ QString Device::type2str(Device::DeviceType deviceType) {
if (deviceType == Phone) return "phone"; if (deviceType == Phone) return "phone";
if (deviceType == Tablet) return "tablet"; if (deviceType == Tablet) return "tablet";
return "unknown"; return "unknown";
} }

View file

@ -20,12 +20,20 @@
#include "kdeconnectplugin.h" #include "kdeconnectplugin.h"
#include "../device.h" struct KdeConnectPluginPrivate
{
Device* mDevice;
// The Initializer object sets things up, and also does cleanup when it goes out of scope
// Since the plugins use their own memory, they need their own initializer in order to send encrypted packages
QCA::Initializer init;
};
KdeConnectPlugin::KdeConnectPlugin(QObject* parent, const QVariantList& args) KdeConnectPlugin::KdeConnectPlugin(QObject* parent, const QVariantList& args)
: QObject(parent) : QObject(parent)
, d(new KdeConnectPluginPrivate)
{ {
mDevice = qvariant_cast< Device* >(args.first()); d->mDevice = qvariant_cast< Device* >(args.first());
} }
KdeConnectPlugin::~KdeConnectPlugin() KdeConnectPlugin::~KdeConnectPlugin()
@ -34,10 +42,10 @@ KdeConnectPlugin::~KdeConnectPlugin()
Device* KdeConnectPlugin::device() Device* KdeConnectPlugin::device()
{ {
return mDevice; return d->mDevice;
} }
Device const* KdeConnectPlugin::device() const Device const* KdeConnectPlugin::device() const
{ {
return mDevice; return d->mDevice;
} }

View file

@ -24,14 +24,16 @@
#include <QObject> #include <QObject>
#include <QVariantList> #include <QVariantList>
#include <kdemacros.h>
#include <KPluginFactory> #include <KPluginFactory>
#include <KPluginLoader> #include <KPluginLoader>
#include "../networkpackage.h" #include "kdeconnectcore_export.h"
#include "../device.h" #include "networkpackage.h"
#include "device.h"
class KDE_EXPORT KdeConnectPlugin struct KdeConnectPluginPrivate;
class KDECONNECTCORE_EXPORT KdeConnectPlugin
: public QObject : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -57,11 +59,7 @@ public Q_SLOTS:
virtual void connected() = 0; virtual void connected() = 0;
private: private:
Device* mDevice; QScopedPointer<KdeConnectPluginPrivate> d;
// The Initializer object sets things up, and also does cleanup when it goes out of scope
// Since the plugins use their own memory, they need their own initializer in order to send encrypted packages
QCA::Initializer init;
}; };

View file

@ -22,8 +22,8 @@
#include <KServiceTypeTrader> #include <KServiceTypeTrader>
#include "../kdebugnamespace.h" #include "kdebugnamespace.h"
#include "../device.h" #include "device.h"
#include "kdeconnectplugin.h" #include "kdeconnectplugin.h"
PluginLoader* PluginLoader::instance() PluginLoader* PluginLoader::instance()

View file

@ -1,4 +1,4 @@
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/core ${QCA2_INCLUDE_DIR})
install(FILES kdeconnect_plugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) install(FILES kdeconnect_plugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
add_subdirectory(ping) add_subdirectory(ping)

View file

@ -10,7 +10,7 @@ target_link_libraries(kdeconnect_battery kdeconnectcore ${KDE4_KDEUI_LIBS})
install(TARGETS kdeconnect_battery DESTINATION ${PLUGIN_INSTALL_DIR} ) install(TARGETS kdeconnect_battery DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_battery.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) install(FILES kdeconnect_battery.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
include(../../../macros.cmake) include(macros)
generate_and_install_dbus_interface( generate_and_install_dbus_interface(
kdeconnect_battery kdeconnect_battery

View file

@ -20,7 +20,7 @@
#include "batterydbusinterface.h" #include "batterydbusinterface.h"
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
BatteryDbusInterface::BatteryDbusInterface(QObject *parent) BatteryDbusInterface::BatteryDbusInterface(QObject *parent)
: QDBusAbstractAdaptor(parent) : QDBusAbstractAdaptor(parent)

View file

@ -24,7 +24,7 @@
#include <KIcon> #include <KIcon>
#include <KLocalizedString> #include <KLocalizedString>
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
#include "batterydbusinterface.h" #include "batterydbusinterface.h"
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< BatteryPlugin >(); ) K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< BatteryPlugin >(); )

View file

@ -21,7 +21,7 @@
#ifndef BATTERYPLUGIN_H #ifndef BATTERYPLUGIN_H
#define BATTERYPLUGIN_H #define BATTERYPLUGIN_H
#include "../kdeconnectplugin.h" #include <core/kdeconnectplugin.h>
#define PACKAGE_TYPE_BATTERY QLatin1String("kdeconnect.battery") #define PACKAGE_TYPE_BATTERY QLatin1String("kdeconnect.battery")

View file

@ -24,9 +24,7 @@
#include <QObject> #include <QObject>
#include <QClipboard> #include <QClipboard>
#include "../kdeconnectplugin.h" #include <core/kdeconnectplugin.h>
#include "../../networkpackage.h"
#include "../../device.h"
#define PACKAGE_TYPE_CLIPBOARD QLatin1String("kdeconnect.clipboard") #define PACKAGE_TYPE_CLIPBOARD QLatin1String("kdeconnect.clipboard")

View file

@ -28,7 +28,8 @@
#include <QDBusReply> #include <QDBusReply>
#include <QDBusMessage> #include <QDBusMessage>
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
#include <core/device.h>
#include "mprisdbusinterface.h" #include "mprisdbusinterface.h"
#include "propertiesdbusinterface.h" #include "propertiesdbusinterface.h"

View file

@ -24,7 +24,7 @@
#include <QString> #include <QString>
#include <QHash> #include <QHash>
#include "../kdeconnectplugin.h" #include <core/kdeconnectplugin.h>
#define PACKAGE_TYPE_MPRIS QLatin1String("kdeconnect.mpris") #define PACKAGE_TYPE_MPRIS QLatin1String("kdeconnect.mpris")

View file

@ -11,7 +11,7 @@ target_link_libraries(kdeconnect_notifications kdeconnectcore ${KDE4_KDEUI_LIBS}
install(TARGETS kdeconnect_notifications DESTINATION ${PLUGIN_INSTALL_DIR} ) install(TARGETS kdeconnect_notifications DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_notifications.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) install(FILES kdeconnect_notifications.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
include(../../../macros.cmake) include(macros)
generate_and_install_dbus_interface( generate_and_install_dbus_interface(
kdeconnect_notifications kdeconnect_notifications
notificationsdbusinterface.h notificationsdbusinterface.h

View file

@ -22,7 +22,7 @@
#include <QDBusConnection> #include <QDBusConnection>
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
Notification::Notification(const NetworkPackage& np, const QString& iconPath, QObject* parent) Notification::Notification(const NetworkPackage& np, const QString& iconPath, QObject* parent)
: QObject(parent) : QObject(parent)

View file

@ -24,7 +24,7 @@
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include "../../networkpackage.h" #include <core/networkpackage.h>
class Notification class Notification
: public QObject : public QObject

View file

@ -26,8 +26,8 @@
#include <KIcon> #include <KIcon>
#include <KMD5> #include <KMD5>
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
#include "../../filetransferjob.h" #include <core/filetransferjob.h>
#include "notificationsplugin.h" #include "notificationsplugin.h"
NotificationsDbusInterface::NotificationsDbusInterface(Device* device, QObject *parent) NotificationsDbusInterface::NotificationsDbusInterface(Device* device, QObject *parent)

View file

@ -27,7 +27,7 @@
#include <QStringList> #include <QStringList>
#include <QDir> #include <QDir>
#include "../../device.h" #include <core/device.h>
#include "notification.h" #include "notification.h"
class NotificationsDbusInterface class NotificationsDbusInterface

View file

@ -22,7 +22,7 @@
#include <KIcon> #include <KIcon>
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
#include "notificationsdbusinterface.h" #include "notificationsdbusinterface.h"
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< NotificationsPlugin >(); ) K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< NotificationsPlugin >(); )

View file

@ -23,7 +23,7 @@
#include <knotification.h> #include <knotification.h>
#include "../kdeconnectplugin.h" #include <core/kdeconnectplugin.h>
#define PACKAGE_TYPE_NOTIFICATION QLatin1String("kdeconnect.notification") #define PACKAGE_TYPE_NOTIFICATION QLatin1String("kdeconnect.notification")
/* /*

View file

@ -1,17 +1,11 @@
set(kdeconnect_pausemusic_SRCS set(kdeconnect_pausemusic_SRCS
pausemusicplugin.cpp pausemusicplugin.cpp
../kdeconnectplugin.cpp
../../kdebugnamespace.cpp
) )
kde4_add_plugin(kdeconnect_pausemusic ${kdeconnect_pausemusic_SRCS}) kde4_add_plugin(kdeconnect_pausemusic ${kdeconnect_pausemusic_SRCS})
target_link_libraries(kdeconnect_pausemusic target_link_libraries(kdeconnect_pausemusic
${KDE4_KDECORE_LIBS} kdeconnectcore
${KDE4_KDEUI_LIBS}
${QT_QTNETWORK_LIBRARY}
${QJSON_LIBRARIES}
${QCA2_LIBRARIES}
) )
install(TARGETS kdeconnect_pausemusic DESTINATION ${PLUGIN_INSTALL_DIR} ) install(TARGETS kdeconnect_pausemusic DESTINATION ${PLUGIN_INSTALL_DIR} )

View file

@ -24,7 +24,7 @@
#include <KSharedConfig> #include <KSharedConfig>
#include <KConfigGroup> #include <KConfigGroup>
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
#include "ui_pausemusic_config.h" #include "ui_pausemusic_config.h"

View file

@ -29,7 +29,8 @@
#include <KSharedConfig> #include <KSharedConfig>
#include <KConfigGroup> #include <KConfigGroup>
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
#include <core/networkpackage.h>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< PauseMusicPlugin >(); ) K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< PauseMusicPlugin >(); )
K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_pausemusic", "kdeconnect-kded") ) K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_pausemusic", "kdeconnect-kded") )

View file

@ -25,7 +25,7 @@
#include <QSet> #include <QSet>
#include <QString> #include <QString>
#include "../kdeconnectplugin.h" #include <core/kdeconnectplugin.h>
class PauseMusicPlugin class PauseMusicPlugin
: public KdeConnectPlugin : public KdeConnectPlugin

View file

@ -24,7 +24,8 @@
#include <KIcon> #include <KIcon>
#include <KLocalizedString> #include <KLocalizedString>
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
#include <core/device.h>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< PingPlugin >(); ) K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< PingPlugin >(); )
K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_ping", "kdeconnect-kded") ) K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_ping", "kdeconnect-kded") )

View file

@ -23,7 +23,7 @@
#include <QObject> #include <QObject>
#include "../kdeconnectplugin.h" #include <core/kdeconnectplugin.h>
class KDE_EXPORT PingPlugin class KDE_EXPORT PingPlugin
: public KdeConnectPlugin : public KdeConnectPlugin

View file

@ -11,7 +11,7 @@ target_link_libraries(kdeconnect_sftp kdeconnectcore ${KDE4_KFILE_LIBS})
install(TARGETS kdeconnect_sftp DESTINATION ${PLUGIN_INSTALL_DIR} ) install(TARGETS kdeconnect_sftp DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_sftp.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) install(FILES kdeconnect_sftp.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
include(../../../macros.cmake) include(macros)
generate_and_install_dbus_interface( generate_and_install_dbus_interface(
kdeconnect_sftp kdeconnect_sftp

View file

@ -24,7 +24,7 @@
#include <KLocalizedString> #include <KLocalizedString>
#include <KStandardDirs> #include <KStandardDirs>
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
#include "mounter.h" #include "mounter.h"

View file

@ -27,7 +27,7 @@
#include <KStandardDirs> #include <KStandardDirs>
#include "sftpplugin.h" #include "sftpplugin.h"
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
#include "ui_sftp_config.h" #include "ui_sftp_config.h"

View file

@ -35,7 +35,7 @@
#include "sftp_config.h" #include "sftp_config.h"
#include "mounter.h" #include "mounter.h"
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< SftpPlugin >(); ) K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< SftpPlugin >(); )
K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_sftp", "kdeconnect-kded") ) K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_sftp", "kdeconnect-kded") )

View file

@ -21,7 +21,8 @@
#ifndef SFTPPLUGIN_H #ifndef SFTPPLUGIN_H
#define SFTPPLUGIN_H #define SFTPPLUGIN_H
#include "../kdeconnectplugin.h" #include <core/kdeconnectplugin.h>
#include <core/device.h>
#define PACKAGE_TYPE_SFTP QLatin1String("kdeconnect.sftp") #define PACKAGE_TYPE_SFTP QLatin1String("kdeconnect.sftp")

View file

@ -23,7 +23,7 @@
#include <QFile> #include <QFile>
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
class AutoClosingQFile : public QFile class AutoClosingQFile : public QFile
{ {

View file

@ -26,7 +26,7 @@
#include <KSharedConfig> #include <KSharedConfig>
#include <KUrlRequester> #include <KUrlRequester>
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
#include "ui_share_config.h" #include "ui_share_config.h"

View file

@ -33,8 +33,8 @@
#include <QDesktopServices> #include <QDesktopServices>
#include <QDBusConnection> #include <QDBusConnection>
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
#include "../../filetransferjob.h" #include <core/filetransferjob.h>
#include "autoclosingqfile.h" #include "autoclosingqfile.h"
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< SharePlugin >(); ) K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< SharePlugin >(); )

View file

@ -24,7 +24,7 @@
#include <KNotification> #include <KNotification>
#include <KIO/Job> #include <KIO/Job>
#include "../kdeconnectplugin.h" #include <core/kdeconnectplugin.h>
#define PACKAGE_TYPE_SHARE QLatin1String("kdeconnect.share") #define PACKAGE_TYPE_SHARE QLatin1String("kdeconnect.share")

View file

@ -23,7 +23,7 @@
#include <KLocalizedString> #include <KLocalizedString>
#include <KIcon> #include <KIcon>
#include "../../kdebugnamespace.h" #include <core/kdebugnamespace.h>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< TelephonyPlugin >(); ) K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< TelephonyPlugin >(); )
K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_telephony", "kdeconnect-kded") ) K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_telephony", "kdeconnect-kded") )

View file

@ -23,7 +23,7 @@
#include <knotification.h> #include <knotification.h>
#include "../kdeconnectplugin.h" #include <core/kdeconnectplugin.h>
#include <KStatusNotifierItem> #include <KStatusNotifierItem>